Repository navigation
fix(wsl): forget an interrupted wake's token once its fence is settled - #35759
Conversation
A wake that finds the slot serving returned before the fence branch that clears an interrupted wake's token, so a stale token kept WSL's one-fence wake answering 'fenced' until restart. Before that early return, forget the token when its fence is gone or names another owner.
|
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 11 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 |
[Low impact] The change affects interrupted wake recovery and the same-version WSL connect path. The production change appears safe to merge; the test cleanup issue is non-blocking. Findings
SummaryClears stale interrupted-wake tokens before a full wake returns
Reviews (1) · Last reviewed commit: "fix(wsl): forget an interrupted wake's t..." · Reviewed by Greptile |
| await dropOneFenceWake() | ||
| expect(await wakeStoppedManagedOrcad(slot)).toEqual({ outcome: 'serving' }) | ||
| expect(await wakeExpectedOrcadUnderOneFence(slot, OLD)).toEqual({ outcome: 'fenced' }) |
There was a problem hiding this comment.
This test leaves an interrupted token behind for the shared slot. beforeEach clears mocks but not interruptedWakes, so moving this test before another one-fence test makes that test return fenced instead of doing its work. After checking that the token stays, stop the fake server and complete a full wake to clear it.
ELI5
When a WSL host start is cut off mid-way, Orca keeps a note so it can later clean up the lock that start left behind. If the server came back up some other way, Orca never cleared that note. While the note existed, the faster one-lock start from #35708 stayed off until the app restarted. Now the note is cleared as soon as Orca can see the lock is gone or belongs to someone else.
What Changed
Before:
wakeAfterPriorreturned "serving" (or "unverifiable") before reaching the branch that clears an interrupted wake's token. A stale token therefore stayed ininterruptedWakes. perf(wsl): take one activation fence on a same-version connect #35708'swakeExpectedOrcadUnderOneFenceanswers "fenced" whenever a token is on record, so every later same-version connect took the slower two-fence path.After: before that early return,
forgetSettledInterruptedWakeruns. It does nothing unless a token is on record. If one is, it deletes it only when:An owner file not yet written, or a probe that gets no answer, keeps the token. That is the same caution
releaseOwnInterruptedWakeFenceuses.Why
This is review feedback on #35708 from d1c-review-high. The token exists only so the full wake can prove a dropped fence is its own. Once the fence is gone or another run's, the token proves nothing, and keeping it only disables the one-fence path. The extra reads run only when a token is on record, which is rare.
Flag-off: the token only gates the WSL one-fence wake, which runs only with ORCA_INTERNAL_WSL_HOSTS set. SSH wakes see no change except the same token cleanup on the rare interrupted-wake path.
User-risk: low. A token is cleared only on positive evidence that its fence is gone or someone else's.
Linked Issue
N/A (follow-up to #35708).
Visual Proof
N/A: no UI.
Testing
orcad-managed-wake-one-fence.test.ts:orcad-managed-wake.test.ts(16) andwsl-orcad-one-fence-deploy.test.tspass.pnpm tc,pnpm run typecheck:ci, the changed-code quality gate, anti-slop oxlint and oxlint all pass.Review
Agent skill upstream boundary
Notes
No wire change. SSH keeps the same wake behaviour.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)