Uh oh!
There was an error while loading. Please reload this page.
fix(connection): preserve notification response ordering - #129
Open
hallerite wants to merge 2 commits into
Open
Conversation
hallerite
marked this pull request as ready for review
August 6, 2026 11:02
halleriteforce-pushed
the
codex/fix-notification-response-ordering
branch
from
August 6, 2026 11:02
11dcb7d to
a966b23Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
we had a downstream issue in verifiers where an ACP request could complete before handlers for preceding notifications had finished. we patched it in our codebase by adding a wait, which is not optimal. this is my attempt of upstreaming a better fix.
Summary
Root cause
Connectionpublishes notifications to the asynchronous dispatcher, but handles responses directly in the receive loop. A notification followed immediately by its request response could therefore resolvesend_request()before the notification handler had updated client state. ACP consumers could observe a completed prompt with its final streamed content still missing.The response is now stored as soon as it arrives, while
send_request()waits on a per-request notification barrier before returning or raising. This keeps wire-order semantics without turning notification dispatch synchronous. Responses to nested requests exclude the notification that initiated them, avoiding a circular wait.The immediate response storage is important for transport shutdown: an EOF after a valid response can no longer replace that response with
ConnectionErrorwhile a preceding notification handler is still finishing.Downstream reproduction: PrimeIntellect-ai/verifiers#2262
Validation
make checkmake test(199 passed, 1 skipped)