Repository navigation
fix(terminal): drop a replaced process's title and input modes on restore - #35889
Conversation
…tore When a host restart restores a pane by starting a new shell, the pane kept the dead process's title and the client's xterm kept its input modes. A pane that had Claude open came back as bash but still read as Claude, so the reattach picked the agent-preserving reset and mouse moves and focus changes were typed into the shell as escape codes. Two process-bound facts now follow the respawn verdict: - Title: the cold-restore payload no longer carries the checkpoint's last title into the new process's records, and durable checkpoints of the new process take the title from the live terminal only. The title, agent identity and title-derived status reflect the new shell. - Input modes: a pane records which process incarnation its xterm's modes belong to. When the host binds a different known incarnation, the pane grounds the process boundary before the new process's replay, the same ground a fresh spawn already writes, so only modes the new process set are armed. Older servers still report incarnations, so new clients ground their modes against them; older clients get the neutral title from new servers and take the shell reset path. Fixes #35559
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
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. Comment |
[Medium impact] This PR appears safe to merge; no actionable issues were found. SummaryThis PR stops a replacement shell from inheriting the dead process’s title and input modes.
|
ELI5
If the machine running a remote Orca server restarts while Claude was open in a terminal, the pane comes back with a fresh shell. Before this change, Orca still treated the pane as Claude. It showed Claude's title, and it left the browser terminal "listening" for mouse moves and window focus, so moving the mouse typed garbage like
^[[<35;59;2Minto bash. Now the restored shell starts clean: a neutral title, no agent label, and none of the dead program's mouse, focus or cursor-key settings.What Changed
Before: after a host restart that lost the terminal daemon,
orca terminal listshowedtitle: "✳ Claude Code"andagentIdentity: "claude"for a pane running only bash. Orca Web and paired desktop clients also kept mouse tracking, focus reporting and cursor-key mode armed. After: the pane shows a neutral title, has no agent identity, and only modes the new shell set itself are armed.Two kinds of state that belong to a process now follow the "this is a new process" verdict:
Why
The root problem was that state belonging to the dead process outlived it. Two narrower fixes were rejected:
terminal list, on mobile and in orchestration.shellon a cold restore would claim a proof the daemon never makes.Each half also covers mixed versions on its own:
This does not duplicate #30195 (a mouse/focus reset before every snapshot replay) or #15666 (retiring resume authority).
Linked Issue
Fixes #35559
Thanks to @clayphi for the detailed report and code-path analysis.
Visual Proof
N/A. This is a terminal-state change, not a visual one. It is verified by the e2e below, which reads the client's xterm modes and the host's terminal list.
Testing
New e2e
tests/e2e/paired-serve-respawn-process-state.spec.ts, using a headlessorca servehost and a paired client:Unit tests:
process-boundary-ground.test.tschecks that neither the cold-restore payload nor the durable checkpoint folds keep the dead title. It fails on origin/main.pty-restore-record-seeding.test.tschecks that a cold restore seeds the history but not the checkpoint title.Related e2e specs pass: serve-restart binding, serve cold-restore agent status, desktop restart/cold restore input, and the reattach mouse-mode leak and live-TUI mouse specs.
A desktop-local cold-restore probe also came back clean.
All unit tests that import the changed modules pass (63 files). check:changed static checks pass.
Tested on macOS. The new e2e is skipped on Windows because it uses POSIX
printf. The code itself has no platform branches.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)