[Bug]: Creating a Claude tab from mobile spawns it on the desktop, then reaps it ~10s later — mobile tab creation broken
Operating system
Windows
Orca version
v1.4.124
Details
Short summary
Creating a new Claude tab from Orca Mobile (+ → Claude) spawns a real Claude session on the paired desktop, which is then fully destroyed about 10 seconds later. The new tab never appears in the mobile client and disappears from the desktop, so creating tabs from mobile does not work.
What happened?
A new terminal appears briefly on the desktop, then vanishes ~10s later; the mobile client never shows it. Captured objectively on the desktop by polling orca-data.json (claudeLivePtySessionIds) and the terminal-history/ directory across the tap:
- A new Claude session id is registered in
claudeLivePtySessionIdsand aterminal-history/<sessionId>folder is created. - ~10 seconds later the session id is removed from
claudeLivePtySessionIdsand theterminal-history/<sessionId>folder is deleted entirely. (A normal terminal close preserves that folder; deleting it indicates a rollback, not a graceful close.)
How can we reproduce it?
- Pair Orca Mobile (Android) to a desktop Orca instance.
- On mobile, tap
+and choose Claude. - Observe a new terminal appear briefly on the desktop, then disappear after ~10s; the mobile client never shows the new tab.
Expected Creating a tab from mobile should create a persistent tab visible on both the mobile client and the desktop.
Anything else that might help (root cause from source at HEAD)
runCreateMobileSessionTerminal (src/main/runtime/orca-runtime.ts, def ~L16042; create/wait/catch ~L16090–16176) spawns the tab + PTY, then waits up to MOBILE_TERMINAL_SURFACE_TIMEOUT_MS = 10_000 (orca-runtime.ts:1173) for the new tab's surface to appear in mobileSessionTabsByWorktree (findMobileTerminalSurface, ~L16421–16446). If it never appears, it throws "Timed out waiting for terminal surface after creation"; the catch (~L16168–16176) rolls the tab back via notifier.closeTerminal(reply.tabId) → shutdown(keepHistory:false) (src/main/daemon/daemon-pty-adapter.ts:369-372) → HistoryManager.removeSession deletes the folder (src/main/daemon/history-manager.ts:302-309), and the live id is removed via markClaudePtyExited (src/main/claude-accounts/live-pty-gate.ts:54-58). This matches the observed teardown (10s delay, id removed, folder deleted).
Strongly indicated but not directly observed: the surface never appears due to the stale-snapshot behavior in #7400 — touchMobileSessionSnapshotsForPty (orca-runtime.ts:3481) bumps snapshotVersion on a stale snapshot without rebuilding the tab set, so the freshness guard (orca-runtime.ts:18352-18357) rejects the newer renderer snapshot carrying the new tab; the mobile snapshot stays stale and the surface lookup starves until the timeout fires. The same staleness would also explain divergent tab sets/titles between desktop and mobile.
Environment: desktop Orca v1.4.124 on Windows 10, running locally (not SSH/WSL); tab type = Claude; Claude Code v2.1.200. Mobile: Orca Android v0.0.24 (also reproduced on v0.0.22).
Related: #7400 (stale mobileSessionTabs snapshot — likely the underlying cause of the surface timeout). Same code region as PRs #5935 / #5839 / #4843 (mobile pending-tab pruning / renderer-snapshot authority). Adjacent: #7345, #6927 (mobile terminal-lifecycle).