Repository navigation
fix(terminal): a seen distro stop drops its cached boot id, and the relaunch test waits on the reap - #35133
Conversation
…elaunch test waits on the reap Follow-up to #35050 review: a pane spawned after a running list saw its distro stop, but before any bridge exit reached the adapter, could take the old boot's id. The identity now drops the distro's cache on a stop observation, listening only while bridge panes live. The relaunch suite waits on the daemon reaping the session rather than assuming it is synchronous. Co-Authored-By: Claude <[email protected]>
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b1b3300c-6830-417c-b3ee-e88fad9d309d
Files selected for processing: 4-
src/main/daemon/daemon-pty-adapter-test-harness.tssrc/main/daemon/daemon-pty-adapter-wsl-distro-loss-relaunch.test.tssrc/main/daemon/daemon-wsl-bridge-boot-identity.test.tssrc/main/daemon/daemon-wsl-bridge-boot-identity.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
-
| this.unsubscribeStops ??= | ||
| this.deps.onDistrosStopped?.((stopped) => stopped.forEach((name) => this.noteExit(name))) ?? |
There was a problem hiding this comment.
Release the listener when the adapter closes.
dispose() and finishDisconnectOnly() in daemon-pty-event-subscriptions.ts disconnect the adapter without forgetting its tracked sessions. The global listener then retains this tracker indefinitely, even after those sessions exit. Repeated adapter lifecycles accumulate listeners and session state. Release the tracker’s subscription during both teardown paths. (raw.githubusercontent.com)
ELI5
This is a small follow-up to #35050, which keeps a WSL terminal's session when its distro is shut down and started again. It closes one more narrow race, and makes one test wait on a real event instead of assuming timing.
What Changed
exitwould then read as "rebooted", and its tab wouldn't close.WslBridgeBootIdentitynow also listens toonRunningWslDistrosStopped, the shared running-list cache's stop notice. It drops a stopped distro's cached id, so the next spawn reads it fresh.onPtySessionExitserver hook, newly passable through the test harness). Before, it assumed reaping is synchronous.Why
Flag-off: not behind the WSL hosts gate. This is WSL bridge-pane behaviour, the same with the gate on or off. Native, SSH and hosted-WSL panes are unaffected.
User risk: very low. It only drops a cache on a confirmed stop observation, which at worst causes one extra boot-id read.
Linked Issue
Follow-up to #35050 (reviewer notes a and b).
Visual Proof
N/A.
Testing
daemon-wsl-bridge-boot-identity.test.ts:daemon-pty-adapter-wsl-distro-loss-relaunch.test.tswaits on the reap.pnpm tc:node,oxlint,pnpm run check:code-quality:changedand the ast-grep gate pass.src/main/daemonandsrc/main/wsl: 3,874 passed.AI Disclosure
Written with Claude Code.
Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)