Skip to content

Fix fuzzy search notification buffering in app-server tests#14955

Merged
aibrahim-oai merged 1 commit intomainfrom
codex/fuzzy-search-session-buffer
Mar 17, 2026
Merged

Fix fuzzy search notification buffering in app-server tests#14955
aibrahim-oai merged 1 commit intomainfrom
codex/fuzzy-search-session-buffer

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

What is flaky

codex-rs/app-server/tests/suite/fuzzy_file_search.rs intermittently loses the expected fuzzyFileSearch/sessionUpdated and fuzzyFileSearch/sessionCompleted notifications when multiple fuzzy-search sessions are active and CI delivers notifications out of order.

Why it was flaky

The wait helpers were keyed only by JSON-RPC method name.

  • wait_for_session_updated consumed the next fuzzyFileSearch/sessionUpdated notification even when it belonged to a different search session.
  • wait_for_session_completed did the same for fuzzyFileSearch/sessionCompleted.
  • Once an unmatched notification was read, it was dropped permanently instead of buffered.
  • That meant a valid completion for the target search could arrive slightly early, be consumed by the wrong waiter, and disappear before the test started waiting for it.

The result depended on notification ordering and runner scheduling instead of on the actual product behavior.

How this PR fixes it

  • Add a buffered notification reader in codex-rs/app-server/tests/common/mcp_process.rs.
  • Match fuzzy-search notifications on the identifying payload fields instead of matching only on method name.
  • Preserve unmatched notifications in the in-process queue so later waiters can still consume them.
  • Include pending notification methods in timeout failures to make future diagnosis concrete.

Why this fix fixes the flakiness

The test now behaves like a real consumer of an out-of-order event stream: notifications for other sessions stay buffered until the correct waiter asks for them. Reordering no longer loses the target event, so the test result is determined by whether the server emitted the right notifications, not by which one happened to be read first.

Preserve out-of-order fuzzy-search notifications in the app-server test harness so session completion events are not dropped while a later-matching session update is still pending.

Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai aibrahim-oai merged commit f26ad3c into main Mar 17, 2026
31 of 33 checks passed
@aibrahim-oai aibrahim-oai deleted the codex/fuzzy-search-session-buffer branch March 17, 2026 17:52
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2026
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.

2 participants