Handle remote SSE servers closing POST connections early#258
Handle remote SSE servers closing POST connections early#258aponcedeleonch merged 1 commit intomainfrom
Conversation
PR Review: Handle remote SSE servers closing POST connections early✅ Strengths
🔍 Issues & SuggestionsCritical: Resource Leak Risk (
|
08f8dab to
f96b64d
Compare
- Add tolerant HTTP transport that ignores `httpx.RemoteProtocolError` on POST responses - Some SSE servers (behind proxies/CDNs) close the POST response connection before the body is sent - The actual MCP response arrives via the SSE stream, so the POST response body is not needed - Increase default MCP timeout from 10 to 20 seconds - Add DEBUG logging when RemoteProtocolError is ignored for troubleshooting - Add unit tests for `_TolerantStream` class - Inline `_execute_sse_session_with_client` into `_execute_sse_session` to reduce indirection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
f96b64d to
19e36c0
Compare
|
@claude check if your feedback was addressed |
|
Claude finished @aponcedeleonch's task —— View job Feedback Review Complete ✅All previous review feedback has been addressed: ✅ Critical: Type Annotation Issue - FIXEDPrevious issue: Type mismatch in Resolution: Fixed in
✅ Silent Error Swallowing - FIXEDPrevious issue: Resolution: Added debug logging in logger.debug(
"Ignoring RemoteProtocolError on POST response (expected for some SSE servers)",
error=str(e),
)✅ Missing Test Coverage - FIXEDPrevious issue: No direct unit tests for Resolution: Added comprehensive tests in
✅ Redundant Helper Method - ADDRESSEDPrevious suggestion: Inline Resolution: Method was simplified and inlined directly into
✅ Test Brittleness - ADDRESSEDPrevious issue: Conditional logic in test made it harder to understand. Resolution: Test updated at
📊 Additional Improvements
SummaryAll critical and recommended issues from the previous review have been properly addressed. The PR is ready to merge from a code review perspective. Job Run | Branch: |
therealnb
left a comment
There was a problem hiding this comment.
This makes the connection more robust, but it might also hide errors.
I think this is probably a good workaround in the name of usability.
Closes: #255
httpx.RemoteProtocolErroron POST responses