Skip to content

Prevent stale file search results from being labeled with a new query - #49946

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/01b62b822db69e15480d3233b66ec55c45646fad
Oct 1, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/01b62b822db69e15480d3233b66ec55c45646fad

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Prevent stale file search results from being labeled with a new query

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.

…#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
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/01b62b822db69e15480d3233b66ec55c45646fad branch from fd13c4d to dd90f16 Compare October 1, 2026 09:53
@copyberry
copyberry Bot merged commit dd90f16 into main Oct 1, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/01b62b822db69e15480d3233b66ec55c45646fad branch October 1, 2026 09:53
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 1, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants