Skip to content

test(wsl): account for the route quarantine in stalled-mount tests - #15408

Merged
brennanb2025 merged 2 commits into
mainfrom
fix-wsl-stall-quarantine-tests
Aug 19, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
fix-wsl-stall-quarantine-tests

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​22 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16
Prod 0 0 0 0

ELI5

Orca now "quarantines" a WSL folder for a few seconds after a read hangs, so it stops hammering a stuck drive. Four tests were written before that rule existed and still expected the very next read to work instantly, so they failed. They now wait out the short cool-off, like a real caller does — and they clean up after themselves so one test's stall can't break the next one.

What Changed

Test-only, two files (session-scanner-index-cache-wsl-stall.test.ts, session-scanner-parse-wsl-stall.test.ts):

  1. releaseAndSettle() advances by WSL_TRANSCRIPT_FS_ROUTE_QUARANTINE_BASE_MS instead of 0.
  2. resetWslTranscriptFsGateForTests() runs first in beforeEach.
  3. vi.useFakeTimers({ toFake: [..., 'performance'] }), since performance.now drives the quarantine clock.

Why

#15381 added a route-level quarantine (wsl-transcript-fs-route-quarantine.ts): a timed-out task blocks new admissions on that route for a back-off window, so the next real task probes recovery instead of hammering a hung mount. Deliberate — but main is currently red because of two test-side gaps it exposed:

1. In-test recovery is refused. Each failing test stalls a read, advances past WSL_TRANSCRIPT_FS_SCAN_TIMEOUT_MS, then re-reads expecting success. A result landing past the deadline never lifts the quarantine, so that second read hits routeIsBlocked() → wsl-transcript-fs-gate.ts:338 rejects WslTranscriptFsError('unavailable').

2. Quarantine state leaked across tests. blockedRoutes is module-level and no test cleared it. Every path in both files sits on one route (wsl.localhost/ubuntu), so surfaces a refused optional JSON enrichment quarantined the route and the next test — still degrades a missing optional JSON file to null — failed without ever stalling anything.

This is the fix #15381 already shipped elsewhere. That PR applied the same three edits to session-scanner-core-parser-wsl-stall.test.ts, session-scanner-discovery-wsl-gate.test.ts, and opencode-usage/scanner-wsl-gate.test.ts, and simply missed these two files. This PR adopts that established shape verbatim — same releaseAndSettle wait, same beforeEach reset, same toFake list, same rationale comments — rather than inventing a parallel idiom.

Production behavior is unchanged and correct as designed: the cache eviction these tests are really about still happens; only the immediate re-read is deferred by the back-off. A real WSL user sees refusals for the window, then recovery.

Testing

main is red before this change and green after — not introduced by any open PR:

Each edit verified load-bearing by reverting it independently:

Arm Result
releaseAndSettle back to advancing 0 3 failed / 6
no beforeEach gate reset 2 failed / 6
plain vi.useFakeTimers() 6 passed / 6
this change 6 passed / 6

Reported honestly: the explicit toFake is not load-bearing today — vitest's default already fakes performance. It is kept because the sibling suites carry it and it stops a future default change from silently unfaking the quarantine clock.

Neighbouring suites sharing the gate, lane pool, process client, and route machinery: 80 files / 527 tests pass (src/main/native-chat/wsl-transcript*, src/main/ai-vault, src/main/opencode-usage/scanner-wsl-gate.test.ts).

The one stalled-mount test that already passed — refuses the stalled candidate and still parses a sibling on a healthy distro — is deliberately untouched: it reads a different route, which is why the quarantine never blocked it, and it doubles as proof the quarantine stays route-scoped.

pnpm typecheck passes.

Visual Proof

N/A — test-only change, no UI surface.

Notes

No change to wsl-transcript-fs-route-quarantine.ts or the gate. If the intended contract were instead "a released stall lifts the quarantine immediately", the fix would belong in liftRouteQuarantine call sites — but the sibling suites #15381 did update encode the wait-it-out behavior, so this reads as intended.

Checklist

  • Focused on unbreaking main
  • Explained what changed and why
  • Test-only; no production behavior change
  • Verified the tests fail without each load-bearing edit

Author

  • @BrennanKB5

#15381 added a route-level quarantine: a timed-out task blocks new
admissions on that route for a back-off window, so the next real task
probes recovery instead of hammering a hung mount. It merged with four
tests already failing on main, and they still fail.

Two causes, both test-side:

- The recovery half of three tests read again immediately after releasing
  the stall, which the quarantine now refuses. They wait out the window,
  which is what a real caller does — resetting the gate would skip the
  admission the recovery assertions exist to prove.
- `blockedRoutes` is module state that no test cleared, so a stall in one
  test refused an unrelated read in the next. Both files now reset the
  gate in beforeEach.

Production behavior is unchanged and is working as designed: eviction
still happens, only the immediate re-read is deferred by the back-off.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a1784ba-42f5-42b1-83bc-c08c6dc99ce9

📥 Commits

Reviewing files that changed from the base of the PR and between c6d3683 and 9c385ca.

📒 Files selected for processing (2)
  • src/main/ai-vault/session-scanner-index-cache-wsl-stall.test.ts
  • src/main/ai-vault/session-scanner-parse-wsl-stall.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

Updated WSL stall-recovery tests for session indexes and transcripts. Tests now reset filesystem gate state before each test, fake performance, and advance timers beyond the route-quarantine period. Recovery cases retry index reads and transcript parsing after quarantine expiry.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the test updates required for WSL route-quarantine behavior.
Description check ✅ Passed The description covers the required sections, explains the changes and rationale, documents testing, and marks visual proof as not applicable for a test-only change.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

#15381 applied this same fix to session-scanner-core-parser-wsl-stall,
session-scanner-discovery-wsl-gate, and opencode-usage/scanner-wsl-gate,
and missed these two files. Adopt that established shape rather than a
parallel one: fold the back-off wait into releaseAndSettle instead of a
separate helper at each call site, and fake performance explicitly, since
performance.now drives the quarantine clock.

The explicit toFake is not strictly required today — vitest's default
already fakes performance — but it documents the dependency and stops a
default change from silently unfaking the quarantine clock.
@brennanb2025
brennanb2025 merged commit fae9282 into main Aug 19, 2026
46 checks passed
AmethystLiang pushed a commit that referenced this pull request Aug 20, 2026
…15408)

* test(wsl): account for the route quarantine in stalled-mount tests

#15381 added a route-level quarantine: a timed-out task blocks new
admissions on that route for a back-off window, so the next real task
probes recovery instead of hammering a hung mount. It merged with four
tests already failing on main, and they still fail.

Two causes, both test-side:

- The recovery half of three tests read again immediately after releasing
  the stall, which the quarantine now refuses. They wait out the window,
  which is what a real caller does — resetting the gate would skip the
  admission the recovery assertions exist to prove.
- `blockedRoutes` is module state that no test cleared, so a stall in one
  test refused an unrelated read in the next. Both files now reset the
  gate in beforeEach.

Production behavior is unchanged and is working as designed: eviction
still happens, only the immediate re-read is deferred by the back-off.

* test(wsl): match the sibling suites' quarantine idiom

#15381 applied this same fix to session-scanner-core-parser-wsl-stall,
session-scanner-discovery-wsl-gate, and opencode-usage/scanner-wsl-gate,
and missed these two files. Adopt that established shape rather than a
parallel one: fold the back-off wait into releaseAndSettle instead of a
separate helper at each call site, and fake performance explicitly, since
performance.now drives the quarantine clock.

The explicit toFake is not strictly required today — vitest's default
already fakes performance — but it documents the dependency and stops a
default change from silently unfaking the quarantine clock.
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 21, 2026
…tablyai#15408)

* test(wsl): account for the route quarantine in stalled-mount tests

stablyai#15381 added a route-level quarantine: a timed-out task blocks new
admissions on that route for a back-off window, so the next real task
probes recovery instead of hammering a hung mount. It merged with four
tests already failing on main, and they still fail.

Two causes, both test-side:

- The recovery half of three tests read again immediately after releasing
  the stall, which the quarantine now refuses. They wait out the window,
  which is what a real caller does — resetting the gate would skip the
  admission the recovery assertions exist to prove.
- `blockedRoutes` is module state that no test cleared, so a stall in one
  test refused an unrelated read in the next. Both files now reset the
  gate in beforeEach.

Production behavior is unchanged and is working as designed: eviction
still happens, only the immediate re-read is deferred by the back-off.

* test(wsl): match the sibling suites' quarantine idiom

stablyai#15381 applied this same fix to session-scanner-core-parser-wsl-stall,
session-scanner-discovery-wsl-gate, and opencode-usage/scanner-wsl-gate,
and missed these two files. Adopt that established shape rather than a
parallel one: fold the back-off wait into releaseAndSettle instead of a
separate helper at each call site, and fake performance explicitly, since
performance.now drives the quarantine clock.

The explicit toFake is not strictly required today — vitest's default
already fakes performance — but it documents the dependency and stops a
default change from silently unfaking the quarantine clock.
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…tablyai#15408)

* test(wsl): account for the route quarantine in stalled-mount tests

stablyai#15381 added a route-level quarantine: a timed-out task blocks new
admissions on that route for a back-off window, so the next real task
probes recovery instead of hammering a hung mount. It merged with four
tests already failing on main, and they still fail.

Two causes, both test-side:

- The recovery half of three tests read again immediately after releasing
  the stall, which the quarantine now refuses. They wait out the window,
  which is what a real caller does — resetting the gate would skip the
  admission the recovery assertions exist to prove.
- `blockedRoutes` is module state that no test cleared, so a stall in one
  test refused an unrelated read in the next. Both files now reset the
  gate in beforeEach.

Production behavior is unchanged and is working as designed: eviction
still happens, only the immediate re-read is deferred by the back-off.

* test(wsl): match the sibling suites' quarantine idiom

stablyai#15381 applied this same fix to session-scanner-core-parser-wsl-stall,
session-scanner-discovery-wsl-gate, and opencode-usage/scanner-wsl-gate,
and missed these two files. Adopt that established shape rather than a
parallel one: fold the back-off wait into releaseAndSettle instead of a
separate helper at each call site, and fake performance explicitly, since
performance.now drives the quarantine clock.

The explicit toFake is not strictly required today — vitest's default
already fakes performance — but it documents the dependency and stops a
default change from silently unfaking the quarantine clock.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#15408)

* test(wsl): account for the route quarantine in stalled-mount tests

stablyai#15381 added a route-level quarantine: a timed-out task blocks new
admissions on that route for a back-off window, so the next real task
probes recovery instead of hammering a hung mount. It merged with four
tests already failing on main, and they still fail.

Two causes, both test-side:

- The recovery half of three tests read again immediately after releasing
  the stall, which the quarantine now refuses. They wait out the window,
  which is what a real caller does — resetting the gate would skip the
  admission the recovery assertions exist to prove.
- `blockedRoutes` is module state that no test cleared, so a stall in one
  test refused an unrelated read in the next. Both files now reset the
  gate in beforeEach.

Production behavior is unchanged and is working as designed: eviction
still happens, only the immediate re-read is deferred by the back-off.

* test(wsl): match the sibling suites' quarantine idiom

stablyai#15381 applied this same fix to session-scanner-core-parser-wsl-stall,
session-scanner-discovery-wsl-gate, and opencode-usage/scanner-wsl-gate,
and missed these two files. Adopt that established shape rather than a
parallel one: fold the back-off wait into releaseAndSettle instead of a
separate helper at each call site, and fake performance explicitly, since
performance.now drives the quarantine clock.

The explicit toFake is not strictly required today — vitest's default
already fakes performance — but it documents the dependency and stops a
default change from silently unfaking the quarantine clock.
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