Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: Preview automation stays pinned to the first desktop client and is never re-ranked when the user moves to another machine

Closed Beginner friendly
#16,491 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Start in the apps/server directory, open the PreviewAutomationBroker file and locate its invoke method, where the session assignment keyed by environmentId + providerSessionId is currently reused without re-ranking when the connection is live. Find the existing ranking logic that prioritizes hosts with the visible target tab and active focus, then modify invoke to trigger this re-ranking when the request has an explicit tabId owned by another host, or when another host has the target tab visible and focused while the assigned host does not. Run the preview automation test suite to confirm sessions re-assign correctly when users switch between desktop clients.

Written by the indexing model from the issue text.

Description

Area

apps/server (PreviewAutomationBroker)

Steps to reproduce
  1. Connect T3 Code Desktop on Machine A and Machine B to one environment that runs on Machine A.
  2. While working from Machine B, have an agent in a thread call any preview tool. The broker assigns the session to Machine B's browser host.
  3. Move to Machine A, open the same thread's Browser panel, and keep a tab visible and focused there. Leave Machine B's app running.
  4. Have the agent call preview_snapshot or preview_navigate with an explicit tabId for the tab that is visible on Machine A.
Expected behavior

The call runs in Machine A's browser, which owns the visible target tab and is focused.

Actual behavior

Every call still goes to Machine B (Preview automation <op> failed on client preview-…). localhost URLs fail with ERR_CONNECTION_REFUSED because Machine B can't reach Machine A's localhost. preview_status reports the tab as visible: false. Focusing Machine A, opening new tabs, and passing an explicit tabId have no effect.

Cause

In invoke, the assignment keyed by environmentId + providerSessionId is reused whenever its connection is still live. The ranking that prefers a host owning the visible target tab, then focus, only runs when there is no live assignment. Nothing re-ranks an existing assignment, so the session is pinned to the first host until that host disconnects. The only ways out are reloading or quitting the stale client, restarting the provider session, or triggering the eviction in #12898.

Suggested fix

Re-rank when the request has an explicit tabId that only another host owns, or when another host owns the target tab as visible and focused while the assigned host doesn't have it visible.

Related

#12898, #15335

Version

0.0.46-nightly.20261003.2638, macOS, Claude provider, local environment with a second desktop client over Tailscale.

Dominant language
TypeScript
Stars
24.8k
Forks
6.4k
Avg merge
13h 9m
Merged PRs (30d)
271

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pingdotgg/t3code

All issues in pingdotgg/t3code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.