[Bug]: Preview automation stays pinned to the first desktop client and is never re-ranked when the user moves to another machine
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
- Connect T3 Code Desktop on Machine A and Machine B to one environment that runs on Machine A.
- 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.
- 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.
- Have the agent call
preview_snapshotorpreview_navigatewith an explicittabIdfor 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
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pingdotgg/t3code
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
pingdotgg/t3code#17157 · 1 comment ·
Maintainers usually reply within 1 day
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
pingdotgg/t3code#17013 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
documentation via-triage
Difficulty 1/5 1-3 hours Newbie friendliness 83/100
pingdotgg/t3code#16995 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation via-triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
pingdotgg/t3code#16988 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
All issues in pingdotgg/t3code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
answerLoops/answerLoops#345 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
siyuan-note/siyuan#20313 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
LanternOps/breeze#8254 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
gofish-graphics/gofish-graphics#1084 ·
Maintainers usually reply within 1 day