[pull] main from QwenLM:main - #529
Merged
Merged
Conversation
…probe (#10091) After the mandatory POST-based MCP handshake succeeds, the SDK also probes an optional standalone GET <mcp-url> (Accept: text/event-stream) for a server-push notification stream. A server that rejects that optional probe with 404 instead of 400 (very common: it's what Express's default fallthrough gives an unhandled GET route, including the official SDK's own documented stateless StreamableHTTPServerTransport pattern) currently tears down the whole MCP connection, even though the mandatory POST path works fine. STREAMABLE_HTTP_GET_SSE_FALLBACK_STATUSES already tolerates 400 for this same reason (#4521, Spring AI). Extend it to 404, deliberately leaving 405 out (the SDK's _startOrAuthSse already short-circuits on a raw 405) and 401 out (the OAuth challenge-capture path depends on observing it). Bound readResponseBodyExcerpt's body read with the file's existing runWithTimeout idiom (already used by disconnect()'s terminateSession call for the same headersTimeout:0/bodyTimeout:0 dispatcher reason): a server that sends 404 headers and then never completes the body would otherwise park the diagnostics read forever, since nothing above this wrapper ever times out the connection attempt. On timeout the reader is cancelled so the abandoned read settles instead of leaking; this also hardens the pre-existing, previously-untimed 400 path. Supersedes stalled PR #8785 (kenshin1986), which implemented the same Set change but left the body read unbounded -- the repo's own review bot caught that as a Critical and the PR went unaddressed for 17 days. Credit to #8785 for the Set change and initial test; the timeout fix, doc correction, and two of the four tests here are new. Also corrects a factual claim in the original PR's test comment (attributing the 404 behavior to two public servers) that the issue thread itself retracted as a reporter-side misconfiguration. Refs #8784, #8785 Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )