René's URL Explorer Experiment


Title: Stop answering cancelled requests by maxisbey · Pull Request #3188 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Stop answering cancelled requests by maxisbey · Pull Request #3188 · modelcontextprotocol/python-sdk

X Title: Stop answering cancelled requests by maxisbey · Pull Request #3188 · modelcontextprotocol/python-sdk

Description: When a peer sent notifications/cancelled for an in-flight request, the dispatcher interrupted the handler and then answered the request anyway with a synthesized error, {"code": 0, "message": "Request cancelled"} — a v1 carry-over pinned as a spec divergence. The 2026-07-28 transport rules say a cancelled request MUST NOT be answered (and 0 isn't a valid JSON-RPC code), so a cancelled request now settles with no response at all: no result if the handler runs to completion, no error if it fails. This matches typescript-sdk and csharp-sdk, which both suppress the write. Motivation and Context Removing the frame exposed that it was doing a second job on the 2025-era streamable HTTP wire, where a request's POST stays open until its response arrives — the error frame was what let the POST complete, so simply suppressing it would park the POST until session end. The dispatcher now signals the transport when a request settles unanswered (on_request_unanswered on the inbound message metadata), and the legacy transport ends the request's stream on it: empty 202 Accepted in JSON-response mode, a cleanly-ended event stream in SSE mode. For the same reason, the client transport now releases an abandoned request's own POST at every era (not just 2026-07-28): otherwise the stream sits parked, or — against an event-store server — resumes via Last-Event-ID for an answer that will never exist. At 2025 the cancellation frame is still POSTed; only the lingering stream goes. How Has This Been Tested? Full suite (./scripts/test, 100% coverage, strict-no-cover) plus end-to-end runs: a stdio server subprocess driven with hand-typed JSON-RPC (cancel → silence, session healthy; unknown-id / completed-request / double cancel all silent); a live uvicorn streamable-HTTP server in both response modes (cancelled call's POST completes at cancel time — 202 empty / clean SSE end — where main returns the code-0 body); and an event-store server with client abandon-by-timeout (no Last-Event-ID reconnect). Breaking Changes Callers of the built-in Client are unaffected — abandon and timeout never waited on the error frame. A caller that hand-sends notifications/cancelled while still awaiting the call now waits instead of receiving the code-0 error; see docs/migration.md. Types of changes Bug fix (non-breaking change which fixes an issue) Breaking change (fix or feature that would cause existing functionality to change) Checklist I have read the MCP Documentation My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed Additional context No conformance-suite scenario covers "no response after cancel" yet; worth an issue there. Spec-internal note: the transport pages say MUST NOT while basic/patterns/cancellation still says SHOULD for the same behaviour. AI Disclaimer

Open Graph Description: When a peer sent notifications/cancelled for an in-flight request, the dispatcher interrupted the handler and then answered the request anyway with a synthesized error, {"code": 0, "...

X Description: When a peer sent notifications/cancelled for an in-flight request, the dispatcher interrupted the handler and then answered the request anyway with a synthesized error, {"code": 0...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/3188

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:1dd339a4-6a1c-9c36-4fec-6fef2e11287c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBFD8:30ACB3:1E921A:282E93:6B00BE4B
html-safe-noncef259c65acc14c099a81f215b76e1c15cd03b118340db291571ee41503949697f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkQ4OjMwQUNCMzoxRTkyMUE6MjgyRTkzOjZCMDBCRTRCIiwidmlzaXRvcl9pZCI6IjUxNjgxNjEzMTA0NDUxOTA3MzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd519d07dcb4af808267b22ec3f55d40fb2bf5e7bba5f05f72327b2a26b4c613a
hovercard-subject-tagpull_request:4145061010
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/3188/files
twitter:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
og:image:altWhen a peer sent notifications/cancelled for an in-flight request, the dispatcher interrupted the handler and then answered the request anyway with a synthesized error, {"code": 0, "...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None93edd3bebc4afb7ce711ee74cb5d2a95927850b082a4d43e212222389cb1c415
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1fee81a280ea86312b69448e261b418189bfd5b5
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3188%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3188%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues308 (308)https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests112 (112)https://github.com/modelcontextprotocol/python-sdk/pulls
Actionshttps://github.com/modelcontextprotocol/python-sdk/actions
Projectshttps://github.com/modelcontextprotocol/python-sdk/projects
Security and quality12 (12)https://github.com/modelcontextprotocol/python-sdk/security
Insightshttps://github.com/modelcontextprotocol/python-sdk/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
maxisbeyhttps://github.com/maxisbey
mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
suppress-response-after-cancelhttps://github.com/modelcontextprotocol/python-sdk/tree/suppress-response-after-cancel
Conversation 17 https://github.com/modelcontextprotocol/python-sdk/pull/3188
Commits 3 https://github.com/modelcontextprotocol/python-sdk/pull/3188/commits
Checks 39 https://github.com/modelcontextprotocol/python-sdk/pull/3188/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/3188/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
Stop answering cancelled requests https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#top
Show all changes 3 commits https://github.com/modelcontextprotocol/python-sdk/pull/3188/files
8cd2d22 Stop answering cancelled requests maxisbey Jul 27, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3188/commits/8cd2d22e4e40742ed6a95998c26f462036a8631d
706d0ce Terminate cancelled requests in-band on the legacy HTTP wire maxisbey Jul 27, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3188/commits/706d0cefe0a02c99eadd22ad32136b9dc4a144d0
5dc226b Correct the requirements manifest and README after the rework maxisbey Jul 27, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3188/commits/5dc226b51f7ba5c0c62ce7e0ef6f6f2b1ddbedf2
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3188/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
migration.md https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
README.md https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-d456418e603ea851518990bbc030ce5be6250b0962c21ff4997690af6724effb
streamable_http.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
jsonrpc_dispatcher.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
message.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-e87607af2a5ca4eeaf91e471c711340e954899e1504ebb1fcc981afe4639bc70
_requirements.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-c12ce54cbf13a11daa3f93343e5df8c89ca2b25d0f20f00b5408a2402a223228
test_cancellation.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-bbb272049658e36f86bd66e16deef2e8ac8f7f90bb4bd89aa0f025bf1db48fee
test_wire.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-163576971f36a4e8babc1808a586ab93dc81945e27aad2f238bd5b77fa441ac5
test_streamable_http.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-e1892a1b798bbf5427ad12171841966db1086dcbbbd3f6c12b4bcd76405530c7
test_cancel_handling.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-c1f187f0c3cd17c4a86593f3fd13298817256f3be47c48065168959055ad0753
test_jsonrpc_dispatcher.py https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-ce6a750fbce4c4bfa60b1845cdd92c08be0c2ed1fdcecdcb2a2efa24170efabd
docs/migration.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
View file https://github.com/modelcontextprotocol/python-sdk/blob/5dc226b51f7ba5c0c62ce7e0ef6f6f2b1ddbedf2/docs/migration.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3188/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
examples/stories/streaming/README.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-d456418e603ea851518990bbc030ce5be6250b0962c21ff4997690af6724effb
View file https://github.com/modelcontextprotocol/python-sdk/blob/5dc226b51f7ba5c0c62ce7e0ef6f6f2b1ddbedf2/examples/stories/streaming/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3188/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-d456418e603ea851518990bbc030ce5be6250b0962c21ff4997690af6724effb
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-d456418e603ea851518990bbc030ce5be6250b0962c21ff4997690af6724effb
src/mcp/server/streamable_http.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
View file https://github.com/modelcontextprotocol/python-sdk/blob/5dc226b51f7ba5c0c62ce7e0ef6f6f2b1ddbedf2/src/mcp/server/streamable_http.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3188/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-0119e4c1bbf2fde7ba89b9c9f5bc472ccc2332f84e96e47cf9e45cebef801da3
src/mcp/shared/jsonrpc_dispatcher.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
View file https://github.com/modelcontextprotocol/python-sdk/blob/5dc226b51f7ba5c0c62ce7e0ef6f6f2b1ddbedf2/src/mcp/shared/jsonrpc_dispatcher.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3188/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
https://github.com/modelcontextprotocol/python-sdk/pull/3188/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3188/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.