Repository navigation
fix(mobile): open a phone-created workspace on the agent it started - #28985
brennanb2025 wants to merge 1 commit into
Conversation
A paired client's worktree create never selected the launched tab for the caller, so the phone opened the workspace's first tab (often Setup). The create no longer activates the host, so it now selects for the caller like an existing-workspace or folder launch.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
When you create a new workspace from the phone with an agent (for example Claude with Chat UI on), the phone should open straight onto that agent. It opened on the workspace's first tab instead, usually Setup. Now it opens on the agent's tab.
What Changed
Before: Phone → New workspace → Claude, Chat UI on. The workspace opens on its first tab (Setup, or the first terminal), and you have to find the chat yourself. The same happens with Chat UI off: the agent's terminal is not the tab you land on.
After: The workspace opens on the chat (or, with Chat UI off, on the agent's terminal). The desktop is not moved, same as today.
Mechanism: The host remembers which tab each paired device (phone, or a desktop client of a remote server) has selected in each workspace. A device that has never picked a tab in a workspace gets the first tab. When a paired device launches an agent,
agent.launchrecords the launched tab as that device's selection (selectAgentLaunchTabForCaller). That already happened for launches into an existing workspace and for folder-workspace creates, butagentLaunchCallerNavigationIdreturned "no caller" for any launch that creates a worktree. So for the most common phone flow nothing was recorded, and the phone fell back to the first tab.The exclusion was there so a create would keep the host's own create navigation. That reason is gone: a paired device's create already skips host activation (
withoutHostActivationinagent-launch-worktree-creation.ts), so the host window is never switched. The exclusion is removed, and a create now follows the same rule as every other paired launch: the tab is selected for the caller, and nothing activates host-wide. The mobile comment inreadAgentLaunchCreateOutcome, which already claimed this happened, now describes what the host does.Side effects for a paired caller's worktree create, both the same as an existing-workspace launch from that device already behaves:
activate: false). A per-device selection ignores host-wide activation anyway, and the host window was never on the new workspace.In-process and desktop callers are unchanged. There is no wire change: an older host simply keeps today's behaviour for the phone.
Why
The phone already reads its own per-device selection, and the host already has one tested path that sets it for the device that launched. Reusing that path for creates fixes the problem without a new field or a phone-side guess about which tab to open (which would race the host's tab snapshot). The alternative, having the phone pick a tab from the launch reply, would add a second source of truth for selection and would not help a desktop client of a remote server.
The separate extra plain "Terminal 1" shell created beside Setup is tracked in #28451 and is not touched here.
Linked Issue
Internal report (no issue).
Visual Proof
N/A: this changes which tab the host records as the phone's selection; it is covered by a flow test through
agent.launch. Not yet checked on a real phone.Testing
New flow test in
agent-launch-caller-selection.test.ts: a paired caller creates a worktree throughagent.launch, in both chat mode and terminal mode, and the launched tab is selected for that caller. It fails without the fix.Two
agent-launch.test.tscases that used a paired caller to check create activation and warning merging now use an in-process caller, which is the behaviour they pin.src/main/runtime/rpc/methods/agent-launch*andsrc/main/agent-launch/suites pass locally (370 tests). Lint and typecheck: CI.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Mobile: the fix is on the host; no phone release needed. Older hosts: unchanged behaviour. SSH and remote: selection is recorded on the host that runs the launch. Cross-platform: no platform-specific code.
Author X: @BrennanKB5
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)