Repository navigation
fix(terminal): a WSL bridge pane that lost its distro keeps its session across a relaunch - #34200
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
…on across a relaunch #34095 turns a bridge pane's exit into host loss (code -1) when its distro is gone, so the window keeps the tab and the history stays unended. But main's exit handling still retired the pane's surface from the saved workspace session, as for any provider-observed exit, so the next launch found no session id for the tab and started a fresh shell instead of cold-restoring. The adapter now labels that exit hostLost, the pty listener forwards it, and the runtime keeps the surface, as it already does for a sleep or an SSH loss. Co-Authored-By: Claude <[email protected]>
3708fac to
932a77a
Compare
ELI5
If a WSL distro is stopped (for example with
wsl --terminate) while Orca has terminals open in it, Orca keeps those terminal tabs so they can come back. But after you quit and reopen Orca, those tabs started brand-new, empty shells, and the saved output was never used. Now they come back with their old output, the same way they do after a terminal-daemon crash.What Changed
wsl --terminatethe distro, then quit and relaunch. p10, p1 and p5 opened new sessions (new ids…p10@@973afe32,…p1@@85b95082,…p5@@c982ceb4in the daemon log) with no history. p1's 49.5 KB checkpoint, still unended, was never read.onPtyExit) treats every exit the provider reports (providerExitObserved) as permanent. It retired the pane from the saved workspace session, removing the leaf and tab binding and its incarnation. On the next launch the tab had no session id, so the window spawned a fresh one. The adapter now labels that exithostLost. The pty listener forwards it toonPtyExit, and the runtime keeps the pane's saved surface. Sleep panes and SSH panes that lose their connection already get this treatment. The process is still recorded as exited.Why
TerminalExitCausereason. A new reason would be published to paired clients and phones. This field never leaves main, so nothing changes on the wire.Linked Issue
Internal: WSL via orcad, verify-15b 5e (relaunch after
wsl --terminateloses sessions).Visual Proof
N/A. This is about saved state. The tests reproduce the lost binding; verify-15c repeats the 5e check on Windows.
Testing
src/main/runtime/wsl-distro-loss-exit-retention.test.ts: a host-loss exit, then quit, then the saved session still binds the leaf to its session and incarnation. A shell's own exit still retires the leaf.src/main/ipc/pty/pty-host-lost-exit.test.ts: the pty listener passeshostLostto the runtime, and never adds it to an ordinary exit.daemon-pty-adapter-wsl-distro-loss.test.ts: the host-loss exit carrieshostLost; a normal exit doesn't.pnpm tc, theipc/pty, runtime exit-lifecycle, retirement and daemon adapter suites (166 files, 1,615 tests), andcheck:code-quality:changedpass.User risk: only WSL bridge panes whose distro is confirmed gone are affected (#34095's path). Such a tab now keeps its session, and opening it restores that session (and boots the distro, as opening it does today). Everything else, including a shell's own
exit, is unchanged.AI Disclosure
Review
Agent skill upstream boundary
Notes
hostLostlives only in main's provider-to-runtime event.applyProcessExitstill unbinds a leaf on any negative code. It will need the same exception before that path ships.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)