Repository navigation
Conversation
## Motivation and Context `StreamableHTTPTransport` counted a session's idle time from the start of its latest request, so a request that ran longer than `session_idle_timeout` lost its session while the client was still waiting for the response. Removing the session closes its streams, which dropped the response over SSE, and since modelcontextprotocol#692 it also cancels the requests in flight, so in JSON response mode the POST was answered 202 with no body instead of the result. A session is now idle only while none of its requests is running, and its idle time counts from the later of the last activity that touched it and the end of its last request. `ServerSession` records when a request leaves the in-flight registry, and the transport reads that together with whether any request is left. With that, a session that expires has no request to cancel: the cancellation modelcontextprotocol#692 added applies when the client ends the session with `DELETE`, when its GET stream breaks without an event store, and when the transport is closed. The tests of modelcontextprotocol#692 that expired a session with a request in flight now assert that it stays, and the docs say so. ## How Has This Been Tested? `test/mcp/server/transports/streamable_http_transport_test.rb`; the test that lets the reaper, a request, a notification, a broadcast and an `initialize` check a session whose request outlived the timeout fails on the previous library, where the request is cancelled. ## Breaking Changes None. A session whose request outlives `session_idle_timeout` is kept until the request ends.
6 of 9 tasks
6 of 9 tasks
This branch has not been deployed
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.
Motivation and Context
StreamableHTTPTransportcounted a session's idle time from the start of its latest request, so a request that ran longer thansession_idle_timeoutlost its session while the client was still waiting for the response. Removing the session closes its streams, which dropped the response over SSE, and since #692 it also cancels the requests in flight, so in JSON response mode the POST was answered 202 with no body instead of the result.A session is now idle only while none of its requests is running, and its idle time counts from the later of the last activity that touched it and the end of its last request.
ServerSessionrecords when a request leaves the in-flight registry, and the transport reads that together with whether any request is left.With that, a session that expires has no request to cancel: the cancellation #692 added applies when the client ends the session with
DELETE, when its GET stream breaks without an event store, and when the transport is closed. The tests of #692 that expired a session with a request in flight now assert that it stays, and the docs say so.How Has This Been Tested?
test/mcp/server/transports/streamable_http_transport_test.rb; the test that lets the reaper, a request, a notification, a broadcast and aninitializecheck a session whose request outlived the timeout fails on the previous library, where the request is cancelled.Breaking Changes
None. A session whose request outlives
session_idle_timeoutis kept until the request ends.Types of changes
Checklist