Repository navigation
Conversation
There was a problem hiding this comment.
This looks good to me. I checked it with a live test against real ripgrep and fff layers on a temp directory. On the base branch, a file created before a 2 s pause was still missing from ripgrep results. With this PR it shows up on the next query, and fff no longer returns [] on its first query. I couldn't test the WSL/9p watcher-blind case here. The search tests pass and packages/core type-checks.
The public API is unchanged (Fff.Picker is internal).
One inline note: on slow mounts, fff's cold-start wait is capped at 250 ms.
Related: #46417
| const scanned = result.value.scanFiles() | ||
| if (!scanned.ok) yield* Effect.logWarning("failed to rescan fff index", { error: scanned.error }) | ||
| } | ||
| // Rescans swap in atomically, but the initial scan exposes a partial index until it completes. |
There was a problem hiding this comment.
This wait is capped at next.wait (≤ 250 ms). So on the slow mounts this PR targets, an initial fff scan that takes longer than that still serves a partial (often empty) index for the first queries. The ripgrep layer instead waits fully while !initialized. If the description's "no partial results on fff cold start" is meant to hold, should the first scan be awaited without the cap, like ripgrep does (e.g. track an initialized flag here too)?
The ripgrep index rescanned at most every 10 s and never waited for the rescan; fff trusted its watcher, which never reports changes on WSL /mnt, 9p, and network mounts. Both now rescan at most every 2 s, and the query that starts a rescan waits up to 250 ms for it. Fixes anomalyco#32747.
ca31785 to
c78123a
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Fixes #32747 (and its duplicates #38065, #37103).
Problem
ripgrepLayer(Windows default, non-VCS directories) rescanned at most every 10 s and never waited for the rescan, so the query that started it still got the old index.fffLayer(git repos on Linux/macOS) relied only on fff's watcher. On WSL/mnt/*, 9p, SMB, and NFS mounts, the watcher reportsisWatcherReady: truebut never delivers changes. New files never appeared until a restart.Fix
Both backends now follow one rule: rescan at most every 2 s, and the query that starts a rescan waits up to 250 ms for it.
sequenceDiagram participant P as @ picker participant S as FileSystemSearch participant I as index (ripgrep walk / fff) P->>S: find("plan"), index older than 2 s S->>I: rescan (ripgrep.find / picker.scanFiles()) S-->>S: wait ≤ 250 ms I-->>S: fresh index swaps in atomically S->>P: results include plan.mdscanFiles()on the same interval instead of relying on its watcher, which misses every change on drvfs/9p whilescanFiles()finds them. Queries also wait for the initial scan, which otherwise served a partial index right after boot.Before / after
Live
GET /api/fs/findprobes against a server built from this branch and fromdev. Each yellow line marks when the new file was written.\\wsl.localhost\…). This has the same 9p watcher blindness as WSL/mnt.