Repository navigation
fix(mobile): open a worktree on the tab the desktop is showing - #31215
Conversation
A phone with no pick in a worktree fell back to the first tab, nearly always the starting terminal. It now follows the host's tab until the phone picks one.
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
07258c0e-1a62-479c-b8e0-1e045b08e37d
📒 Files selected for processing: 3
src/main/runtime/client-session-tab-selection.test.tssrc/main/runtime/client-session-tab-selection.tssrc/main/runtime/multi-client-navigation-isolation.integration.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
ELI5
Opening a workspace on the phone always showed its terminal, even when you were in a chat on the desktop. Now the phone opens on whatever the desktop is showing.
What Changed
Before: you open a worktree or folder workspace on the phone and land on its first tab, which is nearly always the terminal it started with, whatever the desktop has open.
After: the phone lands on the tab the desktop is showing. If you have already picked a tab in that workspace on the phone, you land on that tab, as before.
How it works: the desktop host keeps a separate tab selection per paired phone, per workspace, and that selection decides which tab the phone opens. A phone that hadn't picked a tab yet started from an empty selection, which falls back to the first tab.
ClientSessionTabSelectionStore.project()now uses the host's current tab for a phone that hasn't picked one in that workspace. It checks again on every open, so leaving, switching tabs on the desktop and reopening follows the desktop.Why
The phone always opens on the tab the host marks as active. The empty starting selection came from #9664, which stopped devices from moving each other's tabs. That protection holds: once you're inside a workspace the phone keeps its own tab, and paired desktop clients ignore active-tab changes they didn't request (#5435). So the desktop switching tabs still never moves a phone that's already open.
I considered seeding the selection once, the first time the host builds the phone's view. That froze on whatever the desktop showed at that moment, which is often when the phone first connects, so a later open could still land on a stale tab.
The change lives on the desktop host, so it ships with the desktop release. The phone (over-the-air page included) needs no update. A phone paired to a desktop that hasn't updated keeps the old behaviour.
Linked Issue
None.
Visual Proof
N/A: no visual change. The phone opens on a different, already-existing tab. The unit tests cover this.
Testing
The old unit test required a new phone to ignore the desktop's tab. It's replaced by two tests: a phone with no pick follows the desktop, including after the desktop moves, and a phone's own pick survives the desktop moving. The multi-client navigation integration test passes unchanged apart from a comment. Not yet tried on a real phone.
AI Disclosure
Review
Agent skill upstream boundary
Notes
Host-side only. The same path serves local, SSH and
orca servehosts, and git worktrees and folder workspaces alike. No wire change, so older phones get the fix as soon as their host updates.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)