Files
codex/codex-rs/file-search/src
jif dd90f160ed Prevent stale file search results from being labeled with a new query (#49946)
## Why

The asynchronous matcher can return results for the previous query while a new query is still running. Labeling those results with the latest query produces a mismatched search snapshot.

## What changed

Only report a file search snapshot when its pattern atoms match the currently requested pattern. Extract snapshot conversion into `snapshot::for_query`, which skips pending results from an older pattern.

## Testing

Add a regression test that changes the query from empty to `bet`, verifies that the old snapshot is withheld, and checks that the completed snapshot contains `beta.txt` with the expected match indices and counts.

GitOrigin-RevId: 01b62b822db69e15480d3233b66ec55c45646fad
2026-10-01 09:52:54 +00:00
..