Skip to content

fix(mobile): open a phone-created workspace on the agent it started - #28985

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/mnce-landing
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/mnce-landing

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25 $\color{#cf222e}{\Huge{\mathbf{−}}}$​14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8

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.launch records the launched tab as that device's selection (selectAgentLaunchTabForCaller). That already happened for launches into an existing workspace and for folder-workspace creates, but agentLaunchCallerNavigationId returned "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 (withoutHostActivation in agent-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 in readAgentLaunchCreateOutcome, 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:

  • The chat is published without host-wide activation (activate: false). A per-device selection ignores host-wide activation anyway, and the host window was never on the new workspace.
  • If a structured chat is refused and the launch falls back to a terminal, the host's "could not reveal the tab" warning is no longer passed on, since the caller shows the tab itself.

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 through agent.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.ts cases 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* and src/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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 15, 2026 05:26
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb9a94d7-0638-4ef0-8338-07161286b194
📥 Commits

Reviewing files that changed from the base of the PR and between 117d362 and 6d63b38.

📒 Files selected for processing: 5
  • mobile/src/tasks/agent-launch-request.ts
  • src/main/runtime/rpc/methods/agent-launch-caller-selection.test.ts
  • src/main/runtime/rpc/methods/agent-launch-caller-selection.ts
  • src/main/runtime/rpc/methods/agent-launch.test.ts
  • src/main/runtime/rpc/methods/agent-launch.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

📝 Walkthrough

Paired-device callers now receive a navigation ID for launches that create a worktree. The launch flow derives this ID from RPC context alone. Tests cover caller selection of the new chat session or terminal pane, and update structured-session and terminal-warning cases to use an empty RPC context. A mobile comment now states that the device’s selection determines what opens.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 6d63b

No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary behavior change: opening phone-created workspaces on the agent that started them.
Description check Passed The description is complete and focused. It explains the user impact, mechanism, rationale, testing, compatibility considerations, visual-proof exception, and checklist status. The internal-report not…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: replaced by #29204 (the reworked landing-tab change, stacked on #29095).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant