modelcontextprotocol / modelcontextprotocol/python-sdk

Deeply-nested-body test fails on macOS: rejected as INVALID_REQUEST (-32600) instead of PARSE_ERROR (-32700)

未关闭
#3,146 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3 spec-2026-07-28 v2
主要语言
Python
星标
24.3k
派生
4k
平均合并
1 天 1 小时
30 天内合并 PR
31

描述

Running the test suite on macOS (observed on GitHub macos-latest, Python 3.14) fails one test that passes on Ubuntu and Windows:

FAILED tests/server/test_streamable_http_modern.py::test_modern_post_with_deeply_nested_body_is_parse_error_not_a_crash
>       assert response.json()["error"]["code"] == PARSE_ERROR
E       assert -32600 == -32700

https://github.com/modelcontextprotocol/python-sdk/blob/3a6f2996cdd8358957479791e8b26198c07d6a75/tests/server/test_streamable_http_modern.py#L1011

The response status is 400 in both cases; only the JSON-RPC error code differs. The test expects the RecursionError raised while parsing the deeply nested body to classify as a parse error, but on Darwin it surfaces as INVALID_REQUEST, so the recursion limit is evidently being hit in a different layer there (macOS threads run with a smaller default stack, which moves where the recursion guard strikes).

This is unrelated to any open PR: it fails identically on current main (3a6f299) and on feature branches, reproduced across repeated runs on macos-latest. Repro:

uv sync --frozen
uv run --frozen pytest tests/server/test_streamable_http_modern.py::test_modern_post_with_deeply_nested_body_is_parse_error_not_a_crash

CI currently runs Ubuntu and Windows only, which is why this has gone unnoticed; worth deciding separately whether macos-latest should join the matrix.

AI Disclaimer

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 tests/server/test_streamable_http_modern.py::test_modern_post_with_deeply_nested_body_is_parse_error_not_a_crash 开始,并在 macOS 和另一个平台上运行提供的 uv pytest 命令。跟踪 RecursionError 在哪里被分类,并比较得到的 JSON-RPC 代码。完成的标准是理解特定于平台的行为,并且测试对预期解析错误的处理保持一致且不会崩溃。

由索引模型根据 Issue 内容生成。

评估

技术栈
macos, python
领域
operating-systems, testing-qa
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。