Repository navigation
Conversation
Contributor
|
@bolinfest is on triage rotation this week and is the reviewer for this one. Labels come from the PR labeler. Please review the change. Automated triage. Labels are a first pass and the assigned maintainer has the final say. |
DaleSeo
reviewed
Oct 16, 2026
expect_response dropped a server ping while waiting for the initialize response, so the ping never got a reply. Answer it with an empty result during the initialize wait, the same way the server answers an early client ping. The server/discover wait still leaves it unanswered. Refs modelcontextprotocol#745 Fixes modelcontextprotocol#1362
gocamille
force-pushed
the
fix/client-ping-during-initialize
branch
from
October 16, 2026 17:55
2746663 to
4b06f72
Compare
DaleSeo
previously approved these changes
Oct 16, 2026
DaleSeo
left a comment
Member
There was a problem hiding this comment.
Looks good, @gocamille. Just one extra comment before merging.
The compiler now flags this spot if PreInitPing gains a variant, and the PartialEq and Eq derives are no longer needed.
DaleSeo
approved these changes
Oct 16, 2026
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 #1362
Motivation and Context
expect_responsenow answers a serverpingwith an empty result while the client waits for theinitializeresponse, instead of logging and dropping it. The reply goes straight onto the transport and a send failure becomes a transport error, matching how the server answers an early client ping (#745).expect_responsealso handles theserver/discoverwait, so it takes ananswer_pingflag:trueforinitialize,falsefor discover. Discover keeps ignoring the ping since 2026-07-28 has noping. Auto mode's fallback goes through the initialize path, so it answers there too.How Has This Been Tested?
client_answers_server_ping_during_initialize(test_client_initialization.rs): both sides on 2025-11-25. The server pings after readinginitializeand before sending the result, then checks the next message is the ping response and the one after isnotifications/initialized. Fails onmain.discover_startup_ignores_server_ping(test_client_lifecycle_modes.rs): the server pings before the discover result, and the next message it reads must be the client'stools/list. This passes onmaintoo; it's there so the flag can't leak into the discover path.Validation:
cargo test -p rmcp --features client --test test_client_initialization --test test_client_lifecycle_modes: passed (20 tests).cargo test -p rmcp --all-features: passed.cargo clippy --all-targets --all-features -- -D warningsandcargo +nightly fmt --all -- --check: clean.Breaking Changes
None.
Types of changes
Checklist