Skip to content

fix(mcp): reject chat streams without completion - #4843

Merged
lyingbug merged 1 commit into
Tencent:mainfrom
ydflow:fix/mcp-incomplete-chat-stream
Oct 28, 2026
Merged

lyingbug merged 1 commit into
Tencent:mainfrom
ydflow:fix/mcp-incomplete-chat-stream

Conversation

@ydflow

@ydflow ydflow commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Description

The legacy Python MCP server's chat and agent_chat tools return partial (or empty) answers as successful results when the SSE connection ends before the backend sends a complete event. Raise a request error on EOF before completion so callers can detect an incomplete answer. Existing server error and complete-event handling are preserved.

Type of Change

  • 🐛 Bug fix

Testing

  • python -m unittest test_chat_sse test_chat_async_preflight (31 tests passed, Python 3.13 / MCP 2.3.0). Regression cases failed on the unmodified code and cover both chat paths, empty streams, partial answers, and unterminated frames.
  • git diff --check origin/main...HEAD passed.
  • python -m unittest discover -p 'test_*.py' (62 tests): 3 errors in test_file_path_security on Windows (temporary directory cleanup permissions and missing symlink privilege), and test_mcp_transports.HttpStatelessSmokeTest timed out waiting for the HTTP server. The targeted chat tests passed. Full repository checks were not run; this change is limited to the legacy Python MCP server.

Checklist

  • git diff --check origin/main...HEAD passes
  • Targeted tests for the changed components pass
  • Full-repository checks were run, or limitations are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change

@lyingbug
lyingbug merged commit bad6d38 into Tencent:main Oct 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants