Repository navigation
feat(mobile): Resume in New CLI from a phone chat tab - #29783
Conversation
A chat tab on the phone had only Close in its long-press menu, so a chat that would not load left no way to reach its conversation. The phone now offers Resume in New CLI, like the desktop tab menu: the chat's host prepares the conversation and the phone opens a copy in a new terminal tab. The resume and fork startup builders move to src/shared so the desktop and the phone build the same command.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f63d45db-82ab-4ea4-9858-449c85a721d2
📒 Files selected for processing: 10
mobile/src/session/MobileSessionSheets.tsxmobile/src/session/mobile-native-chat-cli-fork.test.tsmobile/src/session/mobile-native-chat-cli-fork.tsmobile/src/session/mobile-session-launch-operations.tsmobile/src/session/session-launch-reply-schema.tsmobile/src/session/use-mobile-session-terminal-create-actions.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/ai-vault-resume-platform.tssrc/renderer/src/lib/ai-vault-session-fork-startup.tssrc/shared/ai-vault-resume-startup.ts
💤 Files with no reviewable changes: 1
- src/renderer/src/lib/ai-vault-resume-platform.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.
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:
51e99f33-7a7d-42c4-894a-6ee7d877f620
📒 Files selected for processing: 27
mobile/src/session/mobile-native-chat-cli-fork.test.tsmobile/src/session/mobile-native-chat-cli-fork.tsmobile/src/session/session-write-reply-schema.tsmobile/src/session/use-mobile-session-terminal-create-actions.test.tsmobile/src/session/use-mobile-session-terminal-create-actions.tssrc/main/ai-vault/structured-chat-cli-fork.tssrc/main/runtime/agent-launch-scope-runtime.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/session-tabs.tssrc/main/runtime/runtime-notifier-contract.tssrc/main/runtime/runtime-pane-admission.test.tssrc/main/runtime/runtime-pane-admission.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/terminal/launch/mobile-terminal-chat-fork-create.tssrc/main/runtime/terminal/launch/mobile-terminal-chat-fork.test.tssrc/main/runtime/terminal/launch/mobile-terminal-chat-fork.tssrc/main/runtime/terminal/launch/mobile-terminal-create.tssrc/main/runtime/terminal/launch/mobile-terminal-owned-create.tssrc/main/runtime/terminal/launch/mobile-terminal-renderer-create.tssrc/main/runtime/terminal/launch/terminal-create.tssrc/main/window/runtime-window-lifecycle.tssrc/preload/api/ui-bridge-terminal-and-session-tabs.tssrc/preload/api/ui-command-event-api.tssrc/renderer/src/hooks/ipc-events/terminal-presentation-ipc-bridge.tssrc/shared/rpc-contract/session-tabs-schemas-params.tssrc/shared/runtime-session-contracts.tssrc/shared/session-tabs-runtime-capabilities.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
♻️ Duplicate comments: 1
mobile/src/session/use-mobile-session-terminal-create-actions.ts: 1
169-177: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winBranch on
response.ok. The fork branches still read fields thatRpcResponsedoes not have.
requestMobileSessionTerminalCreatereturns a plainRpcResponse(RpcSuccess | RpcFailure). Because of this, the Mobile verify typecheck fails with TS2339 at Lines 176, 177, 180 and 194.Runtime effects:
response.kindis alwaysundefined. Thechat_fork_*refusal guidance never runs.- On success,
response.raw.okthrowsTypeErrorafter the host has already created the terminal. Thecatchblock then reports a failure and skips terminal selection and subscription.Fix:
- Use
!response.okandresponse.error.codefor refusals.- Use
response.resultfor the desktop warning.- Remove the
'incompatible'branch.RpcIncompatibleReplyErroralready reaches thecatchblock.🐛 Proposed fix
- if (sourceFork && response.kind === 'outer-refused') { + if (sourceFork && !response.ok) { reportFork(mobileChatForkRefusalMessage(agentName, response.error.code)) return 'reported-failure' } - if (sourceFork && response.kind === 'incompatible') { - reportFork(`${agentName} may have opened. Reconnect and check open tabs on the host before retrying.`) - return 'reported-failure' - } @@ - if (sourceFork && response.raw.ok && createdTerminalDesktopWarning(response.raw.result)) { + if (sourceFork && response.ok && createdTerminalDesktopWarning(response.result)) {Source: Pipeline failures
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
bd751124-95e4-4577-b615-bc4ef9e6ee87
📒 Files selected for processing: 7
mobile/src/session/mobile-chat-fork-create-feedback.tsmobile/src/session/mobile-native-chat-cli-fork.tsmobile/src/session/mobile-session-quick-command-launch.tsmobile/src/session/mobile-session-terminal-create-request.tsmobile/src/session/use-mobile-session-terminal-create-actions.tsmobile/src/session/use-mobile-terminal-create-route-owner.tssrc/main/runtime/terminal/launch/mobile-terminal-chat-fork-create.ts
🚧 Files skipped from review as they are similar to previous changes: 2
- mobile/src/session/mobile-native-chat-cli-fork.ts
- src/main/runtime/terminal/launch/mobile-terminal-chat-fork-create.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Resolve the session-tabs capability list (chat fork + main's create-terminal shell) and refuse a shell pick on a chat fork, which uses the host's own launch runtime.
…sages into the fork feedback module Formatting pushed the create hook past its line limit, so the fork-only reply message, partial-success warning and host capability check now live beside the other fork messages. Same order and copy as before.
…hat-resume-in-cli
…ter the main merge
…hat-resume-in-cli
|
When a saved chat could not load on the phone, there was no way to continue it in a terminal. Resume in New CLI now opens an independent conversation using the host’s agent command, permissions, arguments, environment and actual shell. The original chat stays open. The phone selects terminal view even with Chat as its default, and desktop shows the same running terminal without changing selection or editor focus. Five review rounds and the final readiness review are complete. Repairs moved preparation and launch under the host’s existing create operation, preserved Manual/custom settings and Windows runtime selection, added truthful busy/refusal/uncertain-outcome feedback, prevented late replies from changing another phone screen, and removed the selected-chat placement refusal. The last repairs only completed test fixtures; no behavior was weakened to pass CI. Verified: full PR workflow and aggregate gate pass on Retained differences: hiding the action on hosts without its complete capability is intended. Desktop-relayed server workspaces remain hidden temporarily until source preparation reaches their owning server; Agent History’s separate builder remains a follow-up. If the host cannot resolve the selected chat in saved layout, creation still proceeds and desktop may append through ordinary placement instead of beside the chat; exact placement waits on the layout-owner work tracked in #27982. Existing phone terminal-first/chat-last order is tracked in STA-10875. Preparation can leave an unused independent copy after a later refusal; existing failed preference-save recovery can remove the immediate terminal override. Limits: missing-saved-layout fallback passes the real-admission CI contract but was not reached in rendered QA. Busy-refusal timing, subsecond first paint and a complete remote/folder/provider matrix were not established. Windows evidence exercises the real host handler through desktop IPC, not phone transport. No local app/build/install/lint/typecheck ran in this review worktree. For Brennan’s review Main, before the action existed: Final head: phone terminal immediately after Resume, then about 20 seconds later (Chat remained the default): Desktop after Resume: the new terminal is beside its source; README remains selected: The same action with real Claude preserves the copied conversation: Judgment points: |





ELI5
When a phone chat could not load, its tab menu offered no way to reach that conversation in a terminal. Resume in New CLI now opens a separate copy in a new terminal tab and keeps the original chat.
What Changed
A long Claude conversation exposed this gap after the phone showed “Could not load conversation.” The stream overflow was fixed separately in #28203 and desktop 1.4.227; this change provides the requested terminal escape hatch.
Long-press a supported chat tab on the phone and choose Resume in New CLI. A new terminal tab opens, running the agent on a copy of the conversation, and becomes selected on the phone in terminal view, even when the phone's default view for agent tabs is the chat reader. On the desktop the new tab lands right after the chat, and the desktop keeps its current selection and keyboard focus. The original chat stays as it was. The action covers Claude, Codex, Grok, Pi, OpenCode and OMP when the host can prepare a separate conversation.
The phone sends the source chat ID through its existing terminal-create request. The host finds or copies the conversation, reads its own settings, builds the command with the same execution environment that will launch it, and creates one terminal. A desktop window adopts that running terminal in the background. Repeated requests share the existing create admission; navigation away prevents an old response from changing the new phone screen. Known refusals give a recovery step, while an uncertain connection result asks the user to check existing tabs before retrying.
Where the new tab goes never blocks the action. The phone names the selected chat by its phone-side tab id, which differs from the desktop's id for the same chat. The host translates it through the saved desktop layout when the layout already has the chat; otherwise it places the tab the way any new phone terminal is placed. An earlier build of this PR refused with “Select a tab and try again” in that case.
Why
Source identity, settings and execution belong to the host. Keeping preparation and launch together prevents a failed settings read from replacing Manual permissions or custom commands with defaults, and prevents Windows shell settings from disagreeing with the project's actual execution environment. Desktop and host launch paths use the same extracted command builders.
Intentional differences: hosts must advertise the complete
session.tabs.chat-fork-cli.v1contract before the phone offers the action; older phones and ordinary terminal creation retain their existing paths. Native chat sources cannot run on SSH hosts; incompatible native/WSL combinations are refused without launching elsewhere. Folder workspaces use the same path as git worktrees. Desktop Resume in New CLI keeps its existing behavior. The new CLI tab is set to terminal view through the phone's existing per-tab view setting; the global default and ordinary new tabs are unchanged.Temporary differences:
No new saved field or request method was added; the source-chat request field and created-result warning are optional and capability gated.
Linked Issue
N/A — reported in Discord; stream-overflow fix tracked in #28203.
Visual Proof
Phone: iOS Simulator with the Orca dev client built from this branch, paired to a hidden test copy of the desktop on the M4Air. Agents: real OpenCode with no login, and a real signed-in Claude. Final checks ran on the exact final head
85c80e39694.New tab's first view with the phone's default set to the chat reader:
Resume with the chat itself selected while a terminal tab is open:
Testing
Real QA on the phone and desktop, all passing (driven by Codex; never Claude):
claude --resume <id> --fork-sessionin a new terminal tab; the original chat was unchanged.Automated tests cover the host capability gate, create admission and stale-route ownership, host settings and native-runtime command construction (including a global WSL shell with a native Windows project), source-selected placement with and without a saved desktop layout, and the new tab's terminal view. CI is the full static-analysis gate.
Review
Authored for @BrennanKB5. Review loop evidence is kept outside the repository; the single final status comment will summarize its result.
Agent skill upstream boundary
Checklist