Repository navigation
Conversation
|
@michaelneale is on triage rotation this week and is the reviewer for this one. Labels come from the PR labeler. Please review the change. Automated triage. Labels are a first pass and the assigned maintainer has the final say. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tsarlandie-oai
left a comment
There was a problem hiding this comment.
Looks good to me - two minor suggestions.
| } | ||
| serde_json::from_slice::<ClientJsonRpcMessage>(&collected).map_err(|e| { | ||
| let error = JsonRpcError::new( | ||
| None, |
There was a problem hiding this comment.
Could we echo the ID when it is readable? The wrong-version fixture has id: 1, and MCP requires the matching ID when the server can recover it. MCP error responses
There was a problem hiding this comment.
Good catch. A body with valid JSON but an invalid message now echoes its id if it’s a number or string, so the jsonrpc: "1.0" fixture gets id: 1 back.
| serde_json::from_slice::<ClientJsonRpcMessage>(&collected).map_err(|e| { | ||
| let error = JsonRpcError::new( | ||
| None, | ||
| ErrorData::parse_error(format!("Parse error: {e}"), None), |
There was a problem hiding this comment.
{ is a parse error (-32700), while null is valid JSON and warrants invalid request (-32600). Could we check the full body on the deserialization error path and test both codes, including trailing garbage as a parse error? JSON-RPC error codes
Motivation and Context
According to the transport spec,
StreamableHttpServiceshould respond to a POST body that isn’t a JSON-RPC message with 400 Bad Request and a JSON-RPC parse error, instead of 415 Unsupported Media Type.How Has This Been Tested?
Added tests
Breaking Changes
None
Types of changes
Checklist
Additional context
Every malformed body gets
-32700, including valid JSON of the wrong shape (e.g.null), where-32600would be more precise. Telling the two apart means re-parsing the body, and serde's limits (trailing bytes, number range, recursion depth) make that re-parse misclassify some inputs. The spec doesn't require the split, so this keeps one path.