Skip to content

test: cover raw invalid UTF-8 stdio regression#2370

Closed
raashish1601 wants to merge 1 commit intomodelcontextprotocol:mainfrom
raashish1601:contributor-65/python-sdk-2328-raw-invalid-utf8-stdio
Closed

test: cover raw invalid UTF-8 stdio regression#2370
raashish1601 wants to merge 1 commit intomodelcontextprotocol:mainfrom
raashish1601:contributor-65/python-sdk-2328-raw-invalid-utf8-stdio

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

  • add a regression test for raw invalid UTF-8 bytes over the stdio transport
  • reproduce the issue-specific EOF race by delaying tool-side validation until after stdin closes
  • assert the server still completes initialization and exits cleanly instead of crashing with ClosedResourceError

Closes #2328.

Testing

  • PYTHONPATH=src python -m pytest tests/issues/test_2328_raw_invalid_utf8_stdio.py
  • python -m ruff check tests/issues/test_2328_raw_invalid_utf8_stdio.py
  • git diff --check

@raashish1601
Copy link
Copy Markdown
Author

Closing this duplicate in favor of #2369. The additional delayed-validation EOF regression was pushed as follow-up commit c492865 onto the existing PR branch.

@raashish1601 raashish1601 deleted the contributor-65/python-sdk-2328-raw-invalid-utf8-stdio branch March 28, 2026 14:29
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.

[Bug] Server crashes with anyio.ClosedResourceError when receiving raw invalid UTF-8 bytes

1 participant