cowork: reject non-object JSON-RPC payloads with -32600 instead of crashing - #40
Draft
Coding-Dev-Tools wants to merge 1 commit into
Draft
cowork: reject non-object JSON-RPC payloads with -32600 instead of crashing#40Coding-Dev-Tools wants to merge 1 commit into
Coding-Dev-Tools wants to merge 1 commit into
Conversation
…f crashing A JSON body that parses but is not an object ([1,2], "x", 5, null) reached msg.get() outside the per-request try/except in all three transports: the stdio server loop died with AttributeError and both HTTP transports returned 500. Now stdio replies with a JSON-RPC -32600 Invalid Request error and keeps serving; HTTP transports return 400 with the same error. Adds regression tests for all three.
🤖 Automated Code Review✅ Ruff Lint — No issues
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A JSON body that parses but is not an object (
[1,2],"x",5,null) reachedmsg.get(...)outside the per-request try/except in all three transports:server.py): AttributeError killed the entire server loop — every subsequent request was lost.http_server.py) and Streamable HTTP (streamable_http.py): unhandled AttributeError → Starlette 500.Now: stdio replies with JSON-RPC
-32600 Invalid Requestand keeps serving; both HTTP transports return 400 with the same error. Addstests/test_invalid_request_payloads.py(7 regression tests, all transports + server-survives check).Full suite: 210 passed, ruff clean.