Repository navigation
test(orcad): wait out the WSL service hold on a serve-parity profile - #29845
Conversation
Since #29209 a full orcad on Windows runs wsl.exe in its profile directory. On windows-11-arm the WSL service keeps that empty directory busy for ~60s after every process in the test's tree has exited, past removeTestRoot's ~45s retry budget, so the recipe and D7 cases fail cleanup with EBUSY.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
#29853) * fix(wsl): run wsl.exe probes from the system root, never the profile WSL holds wsl.exe's working directory busy for about its idle timeout after the probe exits. Since #29209 the orcad startup probe ran in the profile, so a temporary orca serve profile could not be deleted for about a minute (diagnosed in #29845). * test(orcad): drop the WSL profile-hold wait from serve parity Reverts #29845's extended EBUSY retry: wsl.exe no longer runs in the profile, so nothing outside the test's process tree holds it. * build(cli): list the WSL spawn-directory module in the CLI typecheck project
ELI5
On Windows ARM CI, the
orca serveparity test fails while deleting its temporary profile folder, after every assertion has already passed. Every process the test started is gone by then, but Windows still reports the folder as busy for about a minute. The test now waits out that minute instead of giving up after about 45 seconds.What Changed
removeTestRoot(inorcad-daemon-teardown-fixture.ts) takes a new optionalwindowsBusyHoldMs. On Windows, once the usual 8 attempts run out, it keeps retrying anEBUSYuntil that window ends.ENOTEMPTY(a late writer) keeps the original attempt bound.orcad-serve-parity.integration.test.tspassesWINDOWS_WSL_PROFILE_HOLD_MS(75s) and raises itsafterEachtimeout to 150s, because the 60s hook default cannot cover daemon cleanup plus the hold.The new
orcad-daemon-teardown-removal.test.tscovers four cases: an EBUSY that outlasts the attempts but not the window, an EBUSY that outlasts the window, ENOTEMPTY, and a non-Windows platform. Its first case fails without the fixture change.Why
It is the same EBUSY that #29669 targeted. Waiting for daemons did not fix it. Since #29669 merged at 13:16Z,
persistence (windows-11-arm)failed 11 of 30 runs. One more failure was an unrelated pnpm lockfile mismatch. Every failure isEBUSY: resource busy or locked, rmdir '<profile root>', in the "prints only the recipe line" case, the "serve restart (D7)" case, or both. The other five platforms passed in every run except one PR run where all six failed.The cleanup diagnostics added before #29669 show three things:
cmd.exe. Each one's verdict isexited.rmretries). The same root was removed successfully about 14s later, during the next test's cleanup.So a process outside the test's tree holds the empty directory for a bounded time of roughly 55 to 60 seconds.
Why I attribute the hold to WSL.
ClaudeRuntimeAuthServicein orcad, and on Windows its constructor probes running WSL distros. Every later sample is bimodal: either about 5s, or held for about 60s.resolveWslInteropSpawnCwd()runswsl.exewith its working directory set toORCA_USER_DATA_PATH, which is the test's profile.wsl.exe exited with 1from that probe. The windows-2022 runs print no such line and never take the slow path.The ~60s lifetime matches WSL's default idle timeout. I could not list open handles on the hosted runner, so the WSL service as the exact holder is an inference. The behavior on the runner is directly measured: a bounded hold of about 60s that starts after every process in the test's tree has exited.
Alternatives considered.
afterAll: the D7 case runs last, so this saves nothing.wsl.exefrom a directory other than the profile: this is a product change towsl-interop-spawn-directory.ts, which deliberately prefers the app-owned profile. It is left for the WSL owners. If they make that change, this hold can be removed.Cost. About 60s of extra wait, only on the roughly 45% of windows-11-arm runs that hit the hold. That is what those runs took before #29439.
Linked Issue
N/A (maintainer CI flake fix; failing on #29825, #29827, #29833, #29821, #29829). Follows #29669 and #29439.
Visual Proof
N/A, test-only change with no UI.
Testing
pnpm vitest run --config config/vitest.config.ts src/main/orcad/orcad-daemon-teardown-removal.test.ts src/main/orcad/orcad-daemon-teardown-linux.test.ts: 24 passed, 1 skipped.The new removal test fails without the fixture change.
pnpm tc:node, oxlint, oxfmt, andcheck:code-quality:changedpass.The Windows ARM integration path is verified by this PR's
persistence (windows-11-arm)job.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Test-only. No impact on SSH, mobile, or wire compatibility. Behavior changes on Windows only.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)