Skip to content

test(orcad): wait out the WSL service hold on a serve-parity profile - #29845

Merged
nwparker merged 1 commit into
mainfrom
fix/orcad-serve-parity-wsl-cwd-hold
Oct 16, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/orcad-serve-parity-wsl-cwd-hold

Conversation

@nwparker

@nwparker nwparker commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​74 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12

ELI5

On Windows ARM CI, the orca serve parity 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 (in orcad-daemon-teardown-fixture.ts) takes a new optional windowsBusyHoldMs. On Windows, once the usual 8 attempts run out, it keeps retrying an EBUSY until that window ends.

  • ENOTEMPTY (a late writer) keeps the original attempt bound.
  • Other platforms ignore the hold.
  • Other callers are unchanged.

orcad-serve-parity.integration.test.ts passes WINDOWS_WSL_PROFILE_HOLD_MS (75s) and raises its afterEach timeout to 150s, because the 60s hook default cannot cover daemon cleanup plus the hold.

The new orcad-daemon-teardown-removal.test.ts covers 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 is EBUSY: 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:

  • Every process in the test's tree had exited before removal started: orcad, the daemon, OpenConsole, and cmd.exe. Each one's verdict is exited.
  • No process with the profile in its command line was still running.
  • Removal then failed for its whole ~44.8s budget (8 x Node's 5.4s rm retries). 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.

  • Onset. All 10 windows-11-arm runs sampled before 00:29Z passed, with the recipe case taking about 5s. fix(orcad): orca serve owns its Claude and Codex accounts again #29209 ("orca serve owns its Claude and Codex accounts again") merged at 00:38Z. It installs ClaudeRuntimeAuthService in orcad, and on Windows its constructor probes running WSL distros. Every later sample is bimodal: either about 5s, or held for about 60s.
  • Mechanism. resolveWslInteropSpawnCwd() runs wsl.exe with its working directory set to ORCA_USER_DATA_PATH, which is the test's profile.
  • Platform split. The windows-11-arm failure logs show wsl.exe exited with 1 from that probe. The windows-2022 runs print no such line and never take the slow path.
  • Test split. The "refuses with exit 78" case never starts a full orcad and never fails.

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.

  • Leave the empty root behind: this would weaken the cleanup check that catches leaked daemons.
  • Defer removal to afterAll: the D7 case runs last, so this saves nothing.
  • Run wsl.exe from a directory other than the profile: this is a product change to wsl-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, and check:code-quality:changed pass.

  • 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Test-only. No impact on SSH, mobile, or wire compatibility. Behavior changes on Windows only.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b998a8ef-33e8-44d4-b323-8b36835c9128
📥 Commits

Reviewing files that changed from the base of the PR and between f96c672 and 28191da.

📒 Files selected for processing: 3
  • src/main/orcad/orcad-daemon-teardown-fixture.ts
  • src/main/orcad/orcad-daemon-teardown-removal.test.ts
  • src/main/orcad/orcad-serve-parity.integration.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The removal fixture exports a 75-second Windows profile hold and accepts an optional hold duration in removeTestRoot. On Windows, EBUSY retries can continue beyond the existing attempt limit until the hold deadline. Tests cover retry outcomes on Windows and Linux. The parity integration test passes the hold duration and allows 150 seconds for teardown.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 28191

The Windows parity test has additional time to remove a temporarily busy profile. No merge-blocking issue is established by the supplied evidence.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the Windows WSL service-hold cleanup change for the serve-parity profile and matches the main purpose of the pull request.
Description check Passed The description is complete and relevant. It explains the failure, implementation, rationale, alternatives, testing, platform impact, and checklist status. The maintainer-specific lack of a linked iss…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is complete and relevant. It explains the failure, implementation, rationale, alternatives, testing, platform impact, and checklist status. The maintainer-specific lack of a linked issue is explicitly explained, and the empty AI Disclosure and Review sections are non-critical.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 3d2f376 into main Oct 16, 2026
38 checks passed
nwparker added a commit that referenced this pull request Oct 17, 2026
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant