Conversation
Signed-off-by: King Star <mcxin.y@gmail.com>
ianegordon
added a commit
to ianegordon/swift-sdk
that referenced
this pull request
Sep 10, 2026
…s HTTP request exchanges Brings modelcontextprotocol#264 onto the modelcontextprotocol#254 branch so its exchange-scoped id routing can be verified against this branch's regression tests. Sources are the PR's head e14ef60, unmodified.
ianegordon
added a commit
to ianegordon/swift-sdk
that referenced
this pull request
Sep 10, 2026
…lcontextprotocol#264, jstar0) Manifest entry 1. Upstream refs/pull/264/head at e14ef60, unmodified. Fixes modelcontextprotocol#254 and modelcontextprotocol#265.
ianegordon
added a commit
to ianegordon/swift-sdk
that referenced
this pull request
Sep 10, 2026
…rotocol#264 Manifest entry 1a. Tests-only, stacked on pr/264 at e14ef60; offered upstream alongside modelcontextprotocol#264.
ianegordon
added a commit
to ianegordon/swift-sdk
that referenced
this pull request
Sep 10, 2026
…fest entries 1 and 1a
ianegordon
added a commit
to ianegordon/swift-sdk
that referenced
this pull request
Sep 10, 2026
…tream modelcontextprotocol#260, rebased onto modelcontextprotocol#264) Manifest entry 2. Upstream refs/pull/260/head b5da0ef (branch pr/260), rebased onto modelcontextprotocol#264 as 12b8c92 with the cancellation routed through the exchange table. Fixes modelcontextprotocol#255.
ianegordon
added a commit
to ianegordon/swift-sdk
that referenced
this pull request
Sep 10, 2026
…otocol#264) as manifest entry 2
This was referenced Sep 10, 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.
Summary
Fixes #254.
StatelessHTTPServerTransportcurrently keys response waiters by the client'sraw JSON-RPC id. Because ids are scoped to each client, concurrent POSTs can
legally reuse the same id; the later request then overwrites the earlier
continuation, leaving one HTTP exchange suspended indefinitely. String and
integer ids also collide after stringification.
Changes
This change assigns a private UUID to each in-flight HTTP exchange before the
request is yielded to
Server. Responses route by that private id, then restorethe client's original string or integer id before returning over HTTP.
The same exchange identity now scopes HTTP request context, while typed raw-id
aliases preserve existing direct lookups. A package-only mapping keeps
Server.currentHandlerContext.idand cancellation lookup on the original clientid without changing public transport or handler APIs. Cancellation fails closed
when multiple active exchanges make a reused wire id ambiguous.
Verification
flight before sending either response.
cancellation compatibility coverage.
swift test -vResult: 555 tests in 40 suites passed.
Scope
are unchanged.
completion. PR fix: StatelessHTTPServerTransport leaves the original POST hanging after notifications/cancelled (#255) #260 covers that separate path and currently lists StatelessHTTPServerTransport: concurrent requests sharing a JSON-RPC id overwrite each other's response waiter (hang + continuation leak) #254 as a
non-goal; if it lands first, its raw-id waiter lookup will need to resolve the
active exchange instead.