Repository navigation
fix(wsl-host): prove an unrecorded orcad by kernel identity before adopting it - #31685
Conversation
|
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 3 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
…opting it A WSL connect adopted the orcad named by a leftover instance lock whenever a bare kill -0 found its PID. After a distro restart PIDs are reused, and a stale lock plus a stale readiness file that name the same PID passed every other check, so the record was repointed at a dead build. The holder is now live only when the lock's boot id and start ticks match the PID's; an unanswered guest or an older lock without them is unverifiable and is never adopted.
7e2dbc8 to
094d078
Compare
ELI5
When you connect a WSL distro, Orca checks whether an Orca server it doesn't know about is still running there, for example one a failed Remove left behind. If so, Orca adopts it instead of starting a second one. The "is it still running?" check only asked whether that process ID existed. After a distro restart, process IDs are handed out again from the start, so an unrelated program could hold the old number, and Orca would "adopt" a server that was gone. Orca now checks that the process really is that server.
What Changed
adoptUnrecordedWslOrcadread the data root's instance lock and rankill -0 <pid>.compareOrcadProcessIdentity, fed from the existing one-exec WSL guest identity read.Why
PID reuse is the case this check exists for. The shared identity comparison already solves it for orcad's lock, so the fix reuses it rather than hardening the shell probe (for example a
pscommand-line match). Losing contact with the guest is never treated as the process exiting: it is unverifiable, and the code declines to act.The report described this as WSL Remove's check. In code it is the adoption step of a WSL connect, which recovers from an orcad that a failed Remove left running. Remove itself does not use this check.
Linked Issue
None; found by the SSH cleanup pass (maintainer work).
Visual Proof
N/A: no UI change; this changes when a leftover WSL server is adopted on connect.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
A reused PID (same number, different start ticks) and an unanswered guest were both adopted as live on main. Both tests fail there and pass here.
An older lock without the kernel identity is unverifiable and is not adopted.
Holder changes under the fence still refuse.
Ran the WSL adoption, guest identity and deploy suites,
pnpm tc:nodeand the changed-code gates. The WSL orcad E2E lane runs in CI.Verified live: nothing beyond CI (this machine has no WSL).
Mixed versions: every orcad build that WSL can deploy writes the boot id and start ticks into its lock. An older lock is left to the launch's own lock handling rather than adopted.
Review
Codex review and an independent review.
Agent skill upstream boundary
Notes
WSL only. The live/unverifiable/exited vocabulary is kept, and loss of contact is unverifiable.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)