Repository navigation
[Server] Send a stdio call's notifications before its response - #601
Merged
Merged
Conversation
chr-hertel
requested review from
CodeWithKyrian,
Nyholm and
soyuka
as code owners
October 14, 2026 23:06
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused ordering fix includes a regression test, with no unresolved review findings.
0 open findings
What changed in this PR
Fixes stdio message ordering so queued handler notifications reach clients before the final response.
Changes:
- Flush outgoing messages before sending a completed call’s result.
- Add a regression test for notification-before-response ordering.
- Document the fix in the changelog.
| File | Description |
|---|---|
| tests/Unit/Server/Transport/StdioSuspendedFibersTest.php | Tests notification and response ordering. |
| src/Server/Transport/StdioTransport.php | Flushes queued messages before the final response. |
| CHANGELOG.md | Documents the stdio ordering fix. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
When a handshake-era handler's last notification and its return happened in the same resume, the response was written before the queued notification. A client returning on the response could miss it, which made NotificationTest::testLoggingReachesTheClient flaky in CI.
chr-hertel
force-pushed
the
fix-stdio-notification-order
branch
from
October 14, 2026 23:18
de355d8 to
411cd1d
Compare
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 free
to 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.
Fixes the flaky
NotificationTest::testLoggingReachesTheClient("handshake era") in CI lately - turned out to be an actual bug, not the test.On stdio, when a handler's last notification and its return land in the same resume,
handleFiberTermination()wrote the response beforeflushOutgoingMessages()wrote the queued notification. Our client only caught it when both lines arrived in the same read.StdioSuspendedFibersTest- fails deterministically without the fix