René's URL Explorer Experiment


Title: [v1.x] Resolve a failed SSE message POST instead of hanging the caller by Darshak03 · Pull Request #3892 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: [v1.x] Resolve a failed SSE message POST instead of hanging the caller by Darshak03 · Pull Request #3892 · modelcontextprotocol/python-sdk

X Title: [v1.x] Resolve a failed SSE message POST instead of hanging the caller by Darshak03 · Pull Request #3892 · modelcontextprotocol/python-sdk

Description: Fixes #2110 (the SSE half, on v1.x). This brings the SSE fix from #3278 (on main) to v1.x. Problem When the SSE transport's message POST fails, with a non-2xx status or an exception, post_writer logs Error in post_writer and stops. The request that was sent never gets a response, so the caller waits out the full session read timeout, and every later message in that session is dropped because the writer is gone. This matters most where response time is critical. A phone-call voice agent connects to its MCP server when a call is answered, and every second of silence counts. Today a failed POST turns into a long wait, and by the time the timeout fires the caller has often hung up. If the request failed at once, the agent could hand the call to a human agent while the caller is still on the line. Fix post_writer now resolves the failed request instead of stopping: a non-2xx status: INTERNAL_ERROR "Server returned an error response"; a 404 on an endpoint that carries a session id: INVALID_REQUEST "Session terminated", as the streamable HTTP transport does; an exception raised by the POST (network error, auth flow, event hook): CONNECTION_CLOSED; a failed notification has no caller waiting, so it is only logged. The writer keeps running, so the session stays usable after a failed POST. The error is sent to the read stream from its own task. On v1.x the client session answers server requests (for example roots/list) inside its receive loop. If the writer delivered the error itself, it could block while that loop is blocked sending a reply to the writer, and both would hang. A test covers this interleaving. Tests New tests in tests/shared/test_sse.py use an in-process SSE server that fails chosen POSTs: initialize answered with 302, 401, 429, 500 or 503 fails at once with McpError, with a 20 s session read timeout; a later tools/call answered with 500 fails at once, and the next ping and tool call succeed; a POST that raises fails its request with CONNECTION_CLOSED, and the session keeps working; the 404 mapping with and without a session id; a failed notification leaves the session usable; a failed POST while a server request is being answered does not deadlock; an error that can no longer be delivered, because the read stream closed, does not stop the writer. All of them fail on unpatched v1.x. uv run pytest passes (1342 passed) with 100% coverage, and ruff check, ruff format --check and pyright are clean.

Open Graph Description: Fixes #2110 (the SSE half, on v1.x). This brings the SSE fix from #3278 (on main) to v1.x. Problem When the SSE transport's message POST fails, with a non-2xx status or an exception, post_write...

X Description: Fixes #2110 (the SSE half, on v1.x). This brings the SSE fix from #3278 (on main) to v1.x. Problem When the SSE transport's message POST fails, with a non-2xx status or an exception, post_w...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3

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:2260a9fb-8278-cc81-7b28-b15e85399623
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9C10:A31EB:1194077:189E944:6B05BBD5
html-safe-nonce1cf14971426d0cd2cd9509f54c30544f7e297da9ab8f9ab2edeb1406a6fc4e8e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzEwOkEzMUVCOjExOTQwNzc6MTg5RTk0NDo2QjA1QkJENSIsInZpc2l0b3JfaWQiOiI2MjkzNTU1MzUxNzQ1MDUxNjA1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacffcfdd27851570e09cab7ac8f1a6214bd7f280dc417d28d280e63ef37e55e397
hovercard-subject-tagpull_request:5438660798
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/3892/files
twitter:imagehttps://avatars.githubusercontent.com/u/115038906?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/115038906?s=400&v=4
og:image:altFixes #2110 (the SSE half, on v1.x). This brings the SSE fix from #3278 (on main) to v1.x. Problem When the SSE transport's message POST fails, with a non-2xx status or an exception, post_write...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None708c2f10d746dbcf1dd80dc8309daa7d595df3fce8066244380fc3238618f09c
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
release2a29e3cf4fb57e81fd311774f91f345cc4436f40
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3892%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%2F3892%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/3892/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues320 (320)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
Darshak03https://github.com/Darshak03
modelcontextprotocol:v1.xhttps://github.com/modelcontextprotocol/python-sdk/tree/v1.x
Darshak03:fix/v1.x-sse-post-error-resolves-requesthttps://github.com/Darshak03/python-sdk/tree/fix/v1.x-sse-post-error-resolves-request
Conversation 1 https://github.com/modelcontextprotocol/python-sdk/pull/3892
Commits 1 https://github.com/modelcontextprotocol/python-sdk/pull/3892/commits
Checks 28 https://github.com/modelcontextprotocol/python-sdk/pull/3892/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/3892/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files
[v1.x] Resolve a failed SSE message POST instead of hanging the caller https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#top
Show all changes 1 commit https://github.com/modelcontextprotocol/python-sdk/pull/3892/files
11791ec [v1.x] Resolve a failed SSE message POST instead of hanging the caller Darshak03 Nov 22, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3892/commits/11791ec91cc02c2f1d372ef13f7ecb2bd45ee56b
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3892/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files
sse.py https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
test_sse.py https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-a2934f5f6ec610dff6774352c41b8c697b539614667643d69fd67f6fc6d7765e
src/mcp/client/sse.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
View file https://github.com/Darshak03/python-sdk/blob/11791ec91cc02c2f1d372ef13f7ecb2bd45ee56b/src/mcp/client/sse.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3892/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
tests/shared/test_sse.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-a2934f5f6ec610dff6774352c41b8c697b539614667643d69fd67f6fc6d7765e
View file https://github.com/Darshak03/python-sdk/blob/11791ec91cc02c2f1d372ef13f7ecb2bd45ee56b/tests/shared/test_sse.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3892/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-a2934f5f6ec610dff6774352c41b8c697b539614667643d69fd67f6fc6d7765e
https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-a2934f5f6ec610dff6774352c41b8c697b539614667643d69fd67f6fc6d7765e
https://github.com/modelcontextprotocol/python-sdk/pull/3892/files#diff-a2934f5f6ec610dff6774352c41b8c697b539614667643d69fd67f6fc6d7765e
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3892/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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.