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 摘要。