Repository navigation
fix(wsl): a bridge pane keeps its folder when its distro stops while Orca is quit - #35141
Conversation
|
STATUS: ready. Head 94fc77a, branched from origin/main aab2254. At quit, live WSL bridge panes get their shell folder read once (same probe as Sleep, never boots a stopped distro, 1 s overall cap) and quit's final save records it. This closes a gap that has always existed, not a regression: the 9ac..f59 comparison shows no change in this area. Checks: pnpm tc, typecheck:ci, 11 daemon test files (123 tests passing; the new suite fails 3 of 5 on main), code-quality, anti-slop, ast-grep scan and gates. Open: a distro stopped while Orca is still open (pane already gone at quit) isn't covered. That needs the deferred periodic re-read. |
|
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 55 seconds. 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 |
ELI5
A terminal that runs a WSL distro from the Windows app (a "bridge" pane) forgets which folder you had
cd'd into if the distro is stopped while Orca is closed. When you reopen Orca, the pane comes back at the project's top folder. Orca now writes down the folder when you quit, so the pane reopens where you left it.What Changed
Before: say you open a bridge pane in
\\wsl.localhost\Ubuntu\home\me\repo, runcd deep, quit Orca, and the distro then stops (wsl --terminate, a reboot, WSL idling it). The pane's history comes back, but it opens inrepo, notrepo/deep.After: the same pane reopens in
repo/deep.Mechanism:
wsl.exedoes not, so Orca only ever knew the folder the pane started in. Sleep already fixes this by asking the distro for the shell's folder (/proc/<pid>/cwd) before its last save.probedShellCwds. It is now honoured by any final save that sets it (Sleep or quit). Only those exclusive final passes set it.readDaemonWslSleepCwdgains an optional time cap.readDaemonWslQuitCwdsreads all bridge panes in parallel.Why
This is complementary to the regression fix in the mover's pause path, not a replacement for it. Device evidence shows that path used to record the bridge pane's folder and no longer does; that fix is tracked separately. This PR covers a case that path never covered: plain quit, after which the distro stops. Before this, nothing recorded the folder in that case, whether or not a move happened.
Alternatives considered:
wsl.exeper save, which costs performance and is the kind of repeated process start that security software flags.Reading once at quit covers "quit, then the distro stops" with one bounded read.
Not covered: if the distro is stopped while Orca is still open, the pane is already gone by the time you quit, so there is no shell left to ask. It keeps its start folder, as before.
Flag-off: this does not depend on
ORCA_INTERNAL_WSL_HOSTS. Off Windows, and on Windows with no WSL bridge panes, quit does no reads and saves exactly as before.User-risk: low. On Windows with live WSL bridge panes, quit may take up to 1 s longer, only while waiting on a running distro. A failed read keeps today's behaviour.
Linked Issue
Found in on-device WSL verification (5e: terminate + quit + relaunch, and terminate-while-quit).
Visual Proof
N/A. This changes which folder a restored terminal starts in. Covered by adapter tests that drive quit, a distro stop, and the relaunch restore.
Testing
New
src/main/daemon/daemon-pty-adapter-wsl-quit-cwd.test.tsuses the real daemon adapter, a mocked distro process read and a simulated win32 platform. On main, 3 of its 5 tests fail.daemon-wsl-sleep-cwd.test.tsalso covers the parallel quit read and its budget.Checks run:
pnpm tc,pnpm run typecheck:ci, 11 daemon test files (123 tests passing, including the existing Sleep-folder, distro-loss, relaunch, history-recovery and cold-restore suites),pnpm run check:code-quality:changed, anti-slop oxlint, ast-grep scan and gates.Review
Agent skill upstream boundary
Notes
Status
Ready for review.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)