mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3139] [CLOSED] [Engine] serve/mcp: a cut-off HTTP answer is an error, not a TypeError on the waiting side #4473
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4473
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3139
Author: @ctr-137
Created: 10/19/2026
Status: ❌ Closed
Base:
main← Head:serve-mcp-incompleteread📝 Commits (1)
6797ae5serve/mcp: a cut-off HTTP answer is an error, not a TypeError on the waiting side📊 Changes
4 files changed (+70 additions, -9 deletions)
View changed files
📝
docs/DETAILS.md(+4 -3)📝
serve/mcp.py(+16 -3)📝
serve/mcp_fake_server.py(+16 -3)📝
serve/test_mcp.py(+34 -0)📄 Description
Issue: none; found in the gap analysis, related to the HTTP-bridge scenario in #3113
Summary
HttpTransport._postcaughturllib.error.HTTPError,OSError,ValueErrorandMcpError, but nothttp.client.IncompleteRead(anHTTPException). A Streamable HTTP MCP server that closes in the middle of its bodyleft the slot with
msg = Noneanderror = None;_waitthen evaluated"error" in Noneand raised aTypeError.Two user-visible consequences:
McpServer._startcatches onlyMcpError, so theTypeErrorescaped and the server stayed onstartingforever - noFailedbadge, no reason, and its tools simply missing. That is indistinguishable from aserver that is still loading.
TypeErrorescapedMcpHub.call, whose contract is "onlyMcpCancelledis raised";the chat ended without the
error: ...result the model should have read.What changed
serve/mcp.pyhttp.client.IncompleteReadbecomesMcpError("the server's answer was cut off: ...").http.client.HTTPExceptionbecomes a failed-answerMcpErrorinstead of escaping the same way._waitrefuses a slot that has neither a message nor an error with a clearMcpError- theTypeErrorcannotcome back through a future transport path either.
serve/mcp_fake_server.py:http_server(port, truncate=...)and--truncate METHODanswer that method with aContent-Lengthlonger than the body, then close. This is the deterministic reproduction of the bug.serve/test_mcp.py: two new tests (below).docs/DETAILS.mdand the module docstring list "a cut-off HTTP answer" among the cases that become anerror: ...result.
Validation
python -m unittest serve.test_mcp- 27 tests, OK, two of them new:initializefailed, error says "cut off", no toolstools/listfailed, error says "cut off", no toolstools/callafter a good starthub.callreturnsok=Falsewitherror: ... cut off, noTypeErrorRegression proof: with
serve/mcp.pyreverted (the tests and the fake server kept), the two new tests fail:AssertionError: 'starting' != 'failed'and aTypeError: argument of type 'NoneType' is not iterable- 2 failures,1 error. With the fix: 2 passed.
The full
servesuite: 850 tests; the only error istest_winjob.TestWinJob(a Windowstasklistcall returningNonehere), the same one as on unmodifiedmain(848 tests).test_keepawakeis timing-flaky under the full runand passes alone; neither is related to this change. No new skips.
What I left alone
call may still work; a dead server already fails with the connection error. A 404 with a session id still marks it
broken, as before.
GET /mcpretry and the 10 s start wait are the other two paths in the same family; they areseparate PRs.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.