Repository navigation
[Server] Add outgoing (elicitation, sampling) request and client response events - #564
Merged
chr-hertel merged 2 commits intoOct 10, 2026
Conversation
chr-hertel
requested review from
CodeWithKyrian,
Nyholm and
soyuka
as code owners
October 10, 2026 00:45
8 of 9 tasks
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Deferred listener exceptions can terminate connections, and unsolicited responses are incorrectly reported as replies.
3 open findings
What changed in this PR
Adds observability events for handshake-era server/client exchanges and deferred Fiber completion.
Changes:
- Adds server-request and client-response events.
- Dispatches result events when suspended Fibers complete.
- Updates tests, documentation, and changelog.
| File | Description |
|---|---|
src/Server/Protocol.php |
Dispatches new lifecycle events and deferred results. |
src/Event/ServerRequestEvent.php |
Defines outgoing request events. |
src/Event/ClientResponseEvent.php |
Defines incoming client response events. |
tests/Unit/Server/ProtocolTest.php |
Tests event dispatch and concurrent Fibers. |
docs/advanced/events.md |
Documents the expanded event API. |
CHANGELOG.md |
Records the new event behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
chr-hertel
force-pushed
the
pr-386-elicit-lifecycle-events
branch
from
October 10, 2026 01:01
dbdaff8 to
93a9a20
Compare
chr-hertel
force-pushed
the
pr-386-elicit-lifecycle-events
branch
from
October 10, 2026 01:14
93a9a20 to
31db107
Compare
chr-hertel
force-pushed
the
pr-386-elicit-lifecycle-events
branch
from
October 10, 2026 01:24
31db107 to
d145a7c
Compare
chr-hertel
force-pushed
the
pr-386-elicit-lifecycle-events
branch
from
October 10, 2026 01:33
d145a7c to
9e1cf30
Compare
chr-hertel
force-pushed
the
pr-386-elicit-lifecycle-events
branch
from
October 10, 2026 01:42
9e1cf30 to
36297e4
Compare
Comment on lines
+426
to
+429
| if (!\is_array($pending) || $this->hasTimedOut($pending)) { | ||
| $this->logger->warning('Received a client response for an unknown or timed out request ID.', ['message_id' => $messageId]); | ||
|
|
||
| return; |
chr-hertel
force-pushed
the
pr-386-elicit-lifecycle-events
branch
from
October 10, 2026 01:51
36297e4 to
e149ed2
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.



Takes over #386, rebased onto
main; the2026-07-28part already landed with #528.ServerRequestEventandClientResponseEventfor handshake-era server-initiated requests and the client's replies.ResponseEvent/ErrorEventwhen a suspended fiber completes, from inside the fiber, so concurrent calls on one session each report under their own request. No transport callback, noTransportInterfaceBC break.ErrorEvent, like a handler throwing before it suspends. Same for a throwing result or error listener.ClientResponseEvent, and no longer stored in the session, where it would pile up unconsumed. Read-only check against the pending entry's deadline, so no extra session write that could race a concurrent worker.Closes #386
🤖 Generated with Claude Code