Skip to content

perf(wsl): search Windows-drive projects with host ripgrep - #27690

Merged
nwparker merged 2 commits into
mainfrom
nwparker/wsl-a3-drive-path-routing
Oct 12, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/wsl-a3-drive-path-routing

Conversation

@nwparker

@nwparker nwparker commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​255 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​226
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​123 $\color{#cf222e}{\Huge{\mathbf{−}}}$​25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​98

ELI5

When a project lives on a Windows drive (like C:\code\app) but you picked WSL as its runtime, Orca's file search used to reach the files from inside Linux, through a slow bridge. Now search reads them directly from Windows, which is much faster and returns the same results.

What Changed

  • Before: quick open, file-name search, text search (both the in-app search and the runtime/provider path), and the Markdown document list all ran the bundled Linux rg inside WSL via wsl.exe, reading the project over /mnt/c.
  • After: for a Windows drive root they run the bundled Windows rg on the host. Results are the same; searches finish much sooner.
  • Mechanism: new resolveBundledRipgrepWslRouting (src/main/ripgrep/bundled-ripgrep-wsl-routing.ts) chooses where rg runs from the root path. Every rg caller uses it. Drive-letter roots stay on the host; \\wsl.localhost\... roots still run inside their distro, as before.
  • Git routing is deliberately unchanged.

Why

Reading NTFS through WSL's drive mount is slow, and every search also pays the wsl.exe startup cost. rg only reads files, so which side runs it doesn't affect anything else.

We did not move git as well. We measured that alternating Windows git and WSL git on the same repo invalidates the index stat cache: the next WSL git status took ~250 s after Windows git rewrote the index. Repos checked out by Windows git with core.autocrlf=true also show ~21k false "modified" files to WSL git. Moving git needs its own user-facing design.

Known differences: host rg respects the Windows user's global gitignore instead of the WSL one, and symlinks created from WSL on the drive may not resolve for Windows rg.

Linked Issue

Part of #9300. Related: #9284 (its git part is not addressed here).

Visual Proof

N/A. The UI is unchanged and the results are identical; only speed changes (see Testing).

Testing

Real Windows 11 + WSL host, 21,645-file clone on C::

Operation WSL rg (before) Host rg (after) Results
Content search 3.5 s 0.19 s 924 = 924
File listing 130–150 ms + ~65 ms wsl.exe startup 28 ms 21,632 = 21,632

Local (macOS): pnpm tc, pnpm test src/main/ripgrep src/main/ipc src/main/providers src/main/runtime, oxlint + oxfmt --check on changed files, and pnpm run check:code-quality:changed all pass. I updated the runtime search test so it covers both a drive root (host rg) and a \\wsl.localhost root (WSL rg).

  • 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

SSH and non-Windows hosts are unaffected: the routing only changes for local Windows drive-letter roots. Folder workspaces and git worktrees take the same path. No wire changes.

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)

@coderabbitai

coderabbitai Bot commented Oct 12, 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: a138c593-173a-4ee6-833b-4948d20be835

📥 Commits

Reviewing files that changed from the base of the PR and between dc8e0f7d91c0f7deee13fae13cd7ed7088ff83b5 and 1130b65.


📒 Files selected for processing (9)
  • src/main/ipc/filesystem-list-files.ts
  • src/main/ipc/filesystem-search-file-paths.test.ts
  • src/main/ipc/filesystem-search-file-paths.ts
  • src/main/ipc/filesystem-search-rg-timeout.test.ts
  • src/main/ripgrep/bundled-ripgrep-text-search.ts
  • src/main/ripgrep/bundled-ripgrep-wsl-routing.test.ts
  • src/main/ripgrep/bundled-ripgrep-wsl-routing.ts
  • src/shared/ripgrep-search-diagnostics.test.ts
  • src/shared/ripgrep-search-diagnostics.ts

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



📝 Walkthrough

Walkthrough

The change adds a shared resolver that selects host or WSL ripgrep based on the root path and followSymlinks. Filesystem listing, path search, content search, Markdown document search, and local filesystem search use the resolved execution and output distros. Windows host searches can classify configured per-path OS errors without marking results truncated when no other error is present.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 1130b

No actionable merge-blocking issue is established. Normal checks remain appropriate before merging.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: using host ripgrep for searches in Windows-drive projects under WSL.
Description check Passed The description is complete and matches the required template. It explains the user impact, mechanism, rationale, linked issues, testing, known differences, and checklist status.
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.

  • 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.

A project stored on a Windows drive (C:\...) with the WSL runtime selected
ran quick open, file-path search, content search and Markdown listing
through wsl.exe and the Linux rg reading /mnt/c over drvfs. rg only reads
files, so it has no git index whose stat cache two writers could thrash;
the host binary reads NTFS directly.

Measured on a 21.6k-file clone on C: (Windows 11, Ubuntu-24.04):
  content search  WSL rg 3.5 s  -> host rg.exe 0.19 s
  file listing    WSL rg 0.14 s + ~65 ms wsl.exe spawn -> host 0.03 s

Git routing is intentionally unchanged: alternating Windows git and WSL git
on the same index forced a full ~250 s rehash on the next WSL git status.

WSL UNC roots and non-drive roots keep their existing routing.
…exist

Windows rg cannot open a 'nul' file, Win32-trimmed names, or WSL-created
symlinks; treat those per-file errors as skipped rather than failing or
truncating the search, and keep symlink-following scans in WSL.
@nwparker
nwparker force-pushed the nwparker/wsl-a3-drive-path-routing branch from dc8e0f7 to 1130b65 Compare October 12, 2026 01:59
@nwparker
nwparker merged commit be4cea1 into main Oct 12, 2026
74 of 76 checks passed
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