cowork: reject non-object JSON-RPC payloads with -32600 instead of crashing - #40
Draft
Coding-Dev-Tools wants to merge 4 commits into
Draft
cowork: reject non-object JSON-RPC payloads with -32600 instead of crashing#40Coding-Dev-Tools wants to merge 4 commits into
Coding-Dev-Tools wants to merge 4 commits 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
|
… adapter handler - Boolean False on a flag pair (--x/--no-x) previously dropped the value silently, so the command ran with its default instead of the caller's explicit False. The handler now emits the negative flag. - Options without a long name (e.g. short-only '-n') had an invented '--name' emitted, which Click rejects as unknown. The handler now uses each parameter's actual option string. - Adds tests/test_flag_pairs.py covering both paths (4 tests).
… adapter handler - Boolean False on a flag pair (--x/--no-x) previously dropped the value silently, so the command ran with its default instead of the caller's explicit False. The handler now emits the negative flag. - Options without a long name (e.g. short-only '-n') had an invented '--name' emitted, which Click rejects as unknown. The handler now uses each parameter's actual option string. - Adds tests/test_flag_pairs.py covering both paths (4 tests).
Hidden click surface is intentionally undocumented; exposing it as MCP tool properties/commands leaks internal knobs to model callers. Skip hidden commands (incl. nested groups), options and arguments during introspection. +3 tests (7 pass, ruff clean).
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.