Repository navigation
perf: skip WSL discovery when filtering native-only paths - #20266
Conversation
📝 WalkthroughWalkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to On Windows, valid AI Vault WSL sessions and paths can be missed while an empty distro result is cached; resolve this before merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Skip the WSL probe for native-only lists —
filterPathsToRunningWslDistrosAsyncnow callslistRunningWslDistrosAsync()only whenpaths.some(isWslUncPath), passing[]otherwise. BecauseisWslUncPathis exactlyparseWslUncPath(path) !== null— the same predicate the inner filter uses to decide distro membership — the guard is provably equivalent: with no WSL UNC path in the list, no entry can be dropped regardless of which distros are running, so the result is unchanged. - New focused test —
src/main/wsl-running-path-filter.test.tscovers empty/local/ordinary-UNC inputs asserting no probe, a mixed list asserting one probe plus order preservation with the stopped distro dropped, and a non-Windows case asserting WSL-shaped paths are not interpreted. Thenot.toHaveBeenCalledassertions fail against the pre-change code, so the coverage is real. Ran locally: 5 passed.
openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
- getAiVaultWslHomeDirs, the sibling in the same Promise.all as the native-path filter, still spawned wsl.exe unconditionally on win32; gate it on the cached installed-distro list so a host with no distro performs no probe when only native Codex homes are configured. - Hosts with a distro installed keep probing from that sibling, so the running-distro last-known-good cache is still warmed by the listing and a later probe outage falls back to the observed list, not []. - Add a test against the real wsl module asserting zero wsl.exe spawns across the whole listing Promise.all, plus the warmed-cache fallback.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Skipped the AI Vault running-distro probe on WSL-less hosts —
getAiVaultWslHomeDirsnow returns[]when(await listWslDistrosAsync()).length === 0, so a Windows host with no installed distro no longer pays forlistRunningWslHomeDirsAsync()'swsl.exe --list --runningspawn. An installed distro is a precondition for a running one, so the guard is result-preserving. - End-to-end spawn-count test —
cached-session-list-wsl-probe.test.tsdrives the realwslmodule against a mockedchild_process(a per-function mock cannot observe the whole listing'sPromise.all): zerowsl.exespawns for a native-only listing when the installed cache is empty, exactly one--list --runningplus one-d Ubuntu … echo $HOMEwhen a distro is installed, then the filter's last-known-good fallback after a probe failure. - Mock plumbing —
cached-session-list.test.ts,ai-vault.test.ts, andai-vault-scan-coalescing.test.tsmock the newly importedlistWslDistrosAsync.
Verified locally: 64 tests pass across the five touched/related files.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
… a probe `listWslDistrosAsync()` resolves `[]` when the `wsl.exe` probe is rejected, so a transient failure made `getAiVaultWslHomeDirs()` conclude "no WSL distros" and skip discovery. That narrowed the allowed-roots set `ai-vault-delete` and `ai-vault-subagent-list` validate against, wrongly rejecting WSL-hosted paths. Gate on `hasCachedWslDistros()` / `getCachedWslDistros()` instead: a pure cache read that only skips discovery once a successful probe has reported zero user distros. It also never probes, so the AI Vault listing cannot be the first to cache `[]` and flip a configured distro to "missing" in runtime resolution.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Replaced the probe-based WSL guard with a pure cache read —
getAiVaultWslHomeDirsnow short-circuits only whenhasCachedWslDistros() && getCachedWslDistros()?.length === 0, instead of callinglistWslDistrosAsync(). The prior guard treated a rejectedwsl.exe --list --quietprobe (which resolves[]without caching) as "no distros installed", which narrowed the rootsai-vault-deleteandai-vault-subagent-listvalidate against and rejected legitimate WSL-hosted paths. A cache read cannot poison the cache and cannot confuse an unreachable WSL with an absent one — matchingdocs/reference/wsl-probe-failure-semantics.md. - Added a rejected-probe regression test —
cached-session-list-wsl-probe.test.tsasserts that afterlistWslDistrosAsync()resolves[]from a rejected probe,getAiVaultWslHomeDirs()still issues the--list --runningprobe and returns the WSL home. The test fails against the previous guard, so it is real coverage. - Reworked the test mocks —
cached-session-list.test.tsnow mockshasCachedWslDistros/getCachedWslDistrosand covers both the cached-empty skip and the never-probed fallthrough;ai-vault.test.tsandai-vault-scan-coalescing.test.tsadd thehasCachedWslDistrosmock. Ran the five touched/related files locally: 66 passed.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
check-changed-code-quality runs config/oxlint-code-quality-casting.json with assertionStyle:'never' over changed lines, and `args as string[]` in the new wsl-probe spy failed it. Narrow through Array.isArray instead, which is also honest about execFile's argv being optional. cached-session-list-wsl-probe + cached-session-list: 9/9 pass; tc:node clean; changed-code quality gate passes.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
src/main/ai-vault/cached-session-list.ts (1)
140-146: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDo not short-circuit running-distro discovery when the installed-distro cache is empty.
listWslDistros()caches successful empty results during retry backoff because WSL can report no installed distros while provisioning.getAiVaultWslHomeDirs()treats that cached result as authoritative and skipslistRunningWslHomeDirsAsync(), which independently lists running distros and resolves their home paths. This can omit valid AI Vault sessions and leave the subagent IPC path without the WSL roots needed to accept valid paths. Distinguish transient empty results from authoritative cache states or retain the running probe.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: cf2a37c4-8b5c-467c-b9f5-5f9ac61c31ca
📒 Files selected for processing (1)
src/main/ai-vault/cached-session-list-wsl-probe.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.

ELI5
Filtering local transcript/home paths on Windows no longer launches WSL just to return the same paths.
What Changed
Query running WSL distros only when at least one input is a WSL UNC path. Reuse the existing path predicate and filtering policy; mixed lists still query and filter by running distro, retaining original path order and spelling. Non-Windows behavior is unchanged.
Why
Measured the complete exported filter on Windows with actual
wsl.exe --list --running --quietcalls. Median of 11 measured calls per variant after two warmups, alternating original/modified order:The modified native-only path performs zero WSL probes. This measures filtering latency, not full transcript loading. WSL-containing lists keep the existing probe, single-flight and failure-backoff behavior.
Linked Issue
User-requested Windows/WSL performance audit; no linked issue.
Visual Proof
N/A — no visual or interaction change.
Testing
Review
No filesystem cache, process ownership, SSH routing, guest command or protocol changes. No query is skipped when WSL status can affect the filtering result; folder/worktree distinctions are irrelevant to this existing path-based policy.
Agent skill upstream boundary
Checklist