Repository navigation
fix(explorer): find files by name in large local workspaces - #22369
Conversation
The Explorer name filter only searched remote workspaces directly; local workspaces still filtered the first 20,001 listed files, so files beyond that cap never matched in large repos. Local name queries now rank the whole workspace on the host, and fall back to an uncapped git listing when ripgrep is not installed.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughLocal filename filtering now uses shared tokenization, matching, and query-size validation. The IPC and preload APIs accept a local-only Priority: ➖ Normal Merge Risk: 🔵 Low · up to After a host-side filter failure, the Explorer performs another full local listing and briefly shows loading despite already having the capped fallback. Avoid that extra scan before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
…orer word rule Replaces the Quick Open fuzzy top-32 routing, which dropped multi-word matches and capped visible results. The Explorer keeps its instant renderer-side filter; only when the local listing hits its cap does it re-list on the host with the same word rule applied before the cap.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 19be44a5-d361-4feb-a80e-f6a57589e236
📒 Files selected for processing (16)
src/main/ipc/filesystem-list-files-handler-name-filter.test.tssrc/main/ipc/filesystem-list-files-name-filter.test.tssrc/main/ipc/filesystem-list-files-without-ripgrep.tssrc/main/ipc/filesystem-list-files.tssrc/main/ipc/filesystem/filesystem-search-handlers.tssrc/preload/api/filesystem-api.tssrc/preload/api/fs-bridge.tssrc/renderer/src/components/quick-open-file-list.react.test.tsxsrc/renderer/src/components/quick-open-file-list.tssrc/renderer/src/components/right-sidebar/file-explorer-name-filter-projection.tssrc/renderer/src/components/right-sidebar/use-file-explorer-name-filter.test.tssrc/renderer/src/components/right-sidebar/use-file-explorer-name-filter.tssrc/renderer/src/runtime/runtime-file-client-search-listing.test.tssrc/renderer/src/runtime/runtime-file-request-debounce.tssrc/renderer/src/runtime/runtime-file-search-client.tssrc/shared/file-name-filter-tokens.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| maxResults | ||
| ) | ||
| } | ||
| return files.filter(pathFilter).slice(0, maxResults) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve results when maxResults is undefined.
slice(0, undefined) returns an empty array. A filtered request without maxResults therefore returns no files when ripgrep is unavailable.
Apply slice only when the caller supplies a cap.
Proposed fix
- return files.filter(pathFilter).slice(0, maxResults)
+ const filteredFiles = files.filter(pathFilter)
+ return maxResults === undefined ? filteredFiles : filteredFiles.slice(0, maxResults)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return files.filter(pathFilter).slice(0, maxResults) | |
| const filteredFiles = files.filter(pathFilter) | |
| return maxResults === undefined ? filteredFiles : filteredFiles.slice(0, maxResults) |
- Fall back to the capped listing (and stop re-listing) if the host scan fails - Keep primary matches when the ignored-file pass fails during a filtered scan - Key host scans on normalized filter words; reset capped state per filter session - Bound nameFilter size at the IPC boundary; drop the double readdir walk
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the current head f84763b (2 commits, 16 files) — the rework of the local name-filter fix after the first version's review. The first version (c8db0e1) reused Quick Open's fuzzy top-32 host search; the current version filters the host scan with the Explorer's own word rule and only when the local listing is capped. The earlier multi-word, 32-result, and gitignored-crowding concerns are addressed.
- Shared matching rule —
src/shared/file-name-filter-tokens.tsnow holdssplitFileNameFilterTokens/pathMatchesFileNameFilterTokens, used by both the renderer projection and the main process, so the host filters a scan exactly like the window. - Host-side filtered listing —
fs:listFilestakes a local-onlynameFilter;listQuickOpenFilesapplies it before its cap in the ripgrep path, andlistFilesWithoutRipgrepfilters the git/readdir listing (falling back to the capped prefix on a walk-budget overflow). - Capped-only re-list —
useRuntimeFileListForWorktreedoes the cheap listing first and only re-lists on the host once the local listing is capped, so small repos keep instant in-window filtering. - Debounce extraction — the debounce helper moved to
runtime-file-request-debounce.ts; behavior is unchanged, andsearchRuntimeFilePathsagain requires a connection, so Quick Open, SSH, and paired hosts are untouched.
ℹ️ The no-ripgrep fallback scans the whole workspace per settled query
Without ripgrep, a capped local listing re-lists uncapped, so each settled query runs a full git ls-files and materializes the entire path list before filtering. This is the exact large-repo case the fix targets, and ripgrep is not bundled, so it is worth confirming the memory/time envelope is acceptable rather than silently regressing it.
Technical details
# No-ripgrep fallback is uncapped per settled query
## Affected sites
- `src/main/ipc/filesystem-list-files-without-ripgrep.ts:18` — with a `pathFilter`, calls `listFilesWithGit(..., signal)` with no `maxResults`, so the full git/readdir listing is materialized.
- `src/main/ipc/filesystem-list-files.ts:56-75` — the wrapper only applies `maxSerializedBytes` when the caller passes it; the `fs:listFiles` handler passes `undefined`.
- `src/renderer/src/components/quick-open-file-list.ts:265-268` — the re-list runs once per 120 ms-settled query while the listing is capped.
## Required outcome
- Decide whether the uncapped git scan (full `git ls-files` retained in memory) is acceptable for the target large-repo case, or bound it (e.g. filter while streaming the git listing so retention is `maxResults`-sized).
## Open questions for the human
- Is a million-file repo without ripgrep a scenario worth bounding, or is the transient scan acceptable given the PR body already documents "lists every file and then filters"?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the delta since the prior pullfrog review at f84763b — the new commits 3f4cb870 and 1a81a052. Both harden the host name-filter path; I found no new issues.
- Host-filter failure fallback —
quick-open-capped-local-listing.tsrecords the last capped local listing; when the host-filtered re-list rejects,useRuntimeFileListForWorktreerestores that capped listing and setshostFilterFailed, so the workspace is not re-scanned until the filter is reopened.listFilesWithoutRipgrepnow rejects on a walk-budget overflow instead of silently re-listing, so the renderer owns the fallback. - Ignored-pass resilience — during a filtered rg scan, an ignored-file pass failure (timeout/kill) keeps the primary matches; unfiltered listings still surface the error.
- Locale-independent matching —
file-name-filter-tokens.tsusestoLowerCase()and now ownsFILE_NAME_FILTER_QUERY_MAX_BYTES/isFileNameFilterQueryTooLarge(the projection re-exports them). The hook normalizes the filter to lowercased words, so changing only case or spacing no longer triggers a rescan. - IPC guard —
fs:listFilesrejects an oversizednameFilterbefore scanning.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 00380b2c-0627-40c8-9610-092756a98b6a
📒 Files selected for processing (3)
src/renderer/src/components/quick-open-capped-local-listing.tssrc/renderer/src/components/quick-open-file-list-host-name-filter.react.test.tsxsrc/renderer/src/components/quick-open-file-list.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| if (!cancelled) { | ||
| if (!cancelled && hostNameFilter) { | ||
| // Why: a failed host scan falls back to filtering the capped listing, not an error. | ||
| setCappedLocalListing((current) => current && { ...current, hostFilterFailed: true }) |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '120,340p' src/renderer/src/components/quick-open-file-list.ts
sed -n '1,260p' src/renderer/src/components/quick-open-file-list-host-name-filter.react.test.tsx
sed -n '1,80p' src/renderer/src/components/quick-open-capped-local-listing.tsRepository: stablyai/orca
Length of output: 16315
Skip the unfiltered request after a host-filter failure.
When the host-filter request fails, hostFilterFailed clears hostNameFilter and changes requestKey back to listingKey. The capped result remains available, but startsRequest becomes true, so the effect starts another unfiltered listFiles() request and shows loading.
Add a failed-host-filter branch that keeps the capped result and stops the effect before it starts a request.
Suggested fix
const listingKey = `${worktreePath ?? ''}\n${operationOwnerKey}\n${excludeRequest.key}\n${activeTargetStatus ?? ''}`
+ const hostFilterFailed =
+ cappedLocalListing?.key === listingKey && cappedLocalListing.hostFilterFailed
// Why: a capped listing can omit matches, so only then pay for a host scan per query.
const hostNameFilter =
hostFilterWhenCapped &&
runtimeEnvironmentId === null &&
connectionId === undefined &&
cappedLocalListing?.key === listingKey &&
- !cappedLocalListing.hostFilterFailed
+ !hostFilterFailed
? splitFileNameFilterTokens(query ?? '').join(' ')
: ''
if (usesRuntimePathSearch && (remoteQuery.length === 0 || remoteQueryTooLarge)) {
setListing(NO_LISTING)
setLoadingRequest({ requestKey, loading: false })
setListedOperationOwner(operationOwnerRef.current)
return
}
+ if (hostFilterWhenCapped && !usesRuntimePathSearch && hostFilterFailed) {
+ setLoadingRequest({ requestKey, loading: false })
+ return
+ }
+
setLoadingRequest({ requestKey, loading: true })
...
hostNameFilter,
+ hostFilterFailed,
+ hostFilterWhenCapped,There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the delta since the prior pullfrog review at 1a81a052 — the single new commit e5b8792. It removes a render-time ref write from the host name-filter fallback and splits the host-filter tests into a dedicated file. I found no new issues.
- Fallback no longer caches the listing —
CappedLocalListingis now{ key, hostFilterFailed }(thefilesfield is gone) andnextCappedLocalListingtakes atruncatedboolean, so the hook no longer assigns a ref during render. On a failed host scan it setshostFilterFailed, which flipshostNameFilterto empty and re-runs the plain capped listing instead of restoring cached files. - Host-filter tests split out — the host name-filter cases moved from
quick-open-file-list.react.test.tsx(now back to its base state) into a dedicatedquick-open-file-list-host-name-filter.react.test.tsx, covering the filtered re-list, the uncapped no-rescan case, and the failure fallback.
I ran the new test file and the sibling quick-open-file-list.react.test.tsx / use-file-explorer-name-filter.test.ts; all pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
In a large local project, the Explorer's "Names" filter only searched the first 20,001 files it had listed. A file past that point looked like it did not exist, even though Contents search could find it. Now, when a local project is that large, the filter asks the computer to scan every file for the name instead.
What Changed
AppDelegate.swiftshowed "No files match this filter". The earlier fix (fix(explorer): make filename search find all workspace files #21423) only covered SSH and remote-host workspaces, so this still reproduced on 1.4.207.src/shared/file-name-filter-tokens.ts, used by both the renderer and the main process.fs:listFilesaccepts an optional local-onlynameFilter.listQuickOpenFilesapplies it before its cap in the ripgrep path.Why
The first version of this PR reused Quick Open's fuzzy top-32 host search. Review found it broke multi-word queries (for example "app delegate"), limited visible results to 32 with no notice, and could let gitignored files crowd out real matches. Filtering during the scan with the Explorer's exact rule avoids all three.
Doing this only when the listing is capped keeps the instant, no-scan-per-keystroke behavior for the common case.
Alternatives considered:
Linked Issue
Fixes Slack report: https://stablygroup.slack.com/archives/C0BSSHPEL66/p1789581486749449 (follow-up to #21423)
Visual Proof
N/A: no visual change. The same Explorer UI now shows matches it used to miss in large repos. Verified with real scans (see Testing).
Testing
Real-filesystem check (temporary, not committed) on a 25,001-file git repo with
zz/Notion Web Clipper/AppDelegate.swift:New tests:
nameFilterto local listings only, not SSH.pnpm tc, oxlint, oxfmt,check:code-quality:changed, and the main/ipc, runtime, right-sidebar, quick-open, and shared suites (16,897 tests) pass on macOS.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
nameFilteris never sent with aconnectionId, and older hosts ignore unknown fields.nameFilterto the same 2 KB limit as the Explorer input.rg --filesthat takes more than 10 s, or a repo without ripgrep whose ignored folders exceed the directory-walk budget. Bundling ripgrep and narrowing the scan inside ripgrep are follow-ups.toLowerCase), so the host and the window always agree.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)