Skip to content

[DO NOT MERGE] Rollup of #3080 sub-issue PRs (integration check) - #3097

Closed
cliffhall wants to merge 34 commits into
v2/mainfrom
v2/chore/3080-rollup
Closed

cliffhall wants to merge 34 commits into
v2/mainfrom
v2/chore/3080-rollup

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Part of #3080

Temporary rollup PR. Do not merge. It merges every open PR for tracker #3080's sub-issues onto v2/main. Its only job is to prove they work together without conflict. Once CI is green it will be closed, and the constituent PRs will be merged individually in this order:

  1. Reject a blank --connect-timeout instead of disabling the timeout #3083 (CLI/mcpdo: --connect-timeout "" (e.g. an unset shell variable) silently disables the timeout and the run never ends #3072): blank --connect-timeout is a usage error
  2. Reject or clamp timeouts that overflow setTimeout to 1 ms (#3071) #3082 (CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it further #3071): timeouts above 2^31−1 ms
  3. fix(cli): reject non-finite numbers in --tool-args-json #3084 (CLI --tool-args-json silently sends 1e400 as null (round-trip guard missing; mcpdo rejects it) #3067): --tool-args-json round-trip guard
  4. Accept empty values for -e, --tool-arg and --header (#3069) #3085 (CLI/mcpdo reject empty values for --tool-arg k=, -e VAR= and --header "X:" (--prompt-args q= and config env accept them) #3069): empty values (also covers -e KEY= (empty value) is rejected on all four clients, though --config passes an empty env value through #3066)
  5. fix(cli): reject method-specific flags given to another method #3081 (CLI: method-specific flags given to another method are silently ignored (--cursor / --tool-arg on tools/list, …) #3073): method-specific flags on the wrong method
  6. Classify server JSON-RPC errors, failed stdio starts and bad URL schemes (#3070) #3086 (CLI/mcpdo: server JSON-RPC errors and stdio servers that fail to start still exit 1 (usage); bad URL scheme exits 4 (retryable) — follow-up to #2842 #3070): server error classification
  7. Refuse integers a double would round in the CLI's and mcpdo's JSON-typed flags #3088 (CLI and mcpdo silently round integers beyond 2^53 in --tool-arg, --tool-args-json, --metadata, --tool-metadata #3068): integers beyond 2^53. It now carries CLI/mcpdo reject empty values for --tool-arg k=, -e VAR= and --header "X:" (--prompt-args q= and config env accept them) #3069's branch to resolve a CLI README conflict.
  8. Type --tool-arg values by the tool's inputSchema (#3075) #3087 (CLI: coerce --tool-arg values using the tool's inputSchema (zip=10001 is sent as a number to a string field) #3075): schema-typed --tool-arg. It now carries the other seven branches, because it conflicted with each of them in cli.ts. It also makes two behaviour fixes that only matter once these PRs are combined:

#3074 (PR #3079) already merged into v2/main.

No Copilot review is requested on this PR; each constituent PR completed its own review loop.

🤖 Generated with Claude Code

cliffhall and others added 30 commits November 30, 2026 00:27
… it (#3072)

Number("") and Number("   ") are 0, and 0 means "no timeout", so an unset
shell variable passed as --connect-timeout "$X" silently turned off the
connect safeguard and a run against a hung server never ended. Parse a
blank value as NaN, the idiom the --load-* parsers already use, so it is
the same usage error as any other non-number. Applied to both the
one-shot CLI and mcpdo's connect parser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
A flag such as --cursor or --tool-arg passed to a method that does not
read it was accepted and ignored with exit 0, so a script paging
tools/list with --cursor fetched the same page forever. A table now maps
each method-specific flag to the methods runMethod actually consumes it
for, and any other combination is a usage error naming those methods.
The check runs ahead of the short-circuit returns, as --strict does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
--connect-timeout (CLI and mcpdo) and --wait-for-auth now reject a value
above 2^31-1 ms as a usage error. A connectionTimeout from a config file,
catalog or Server Settings is clamped to that bound by
InspectorClient.connect(), since those values are not validated at read
time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
JSON.parse turns 1e400 into Infinity, which JSON.stringify writes as
null, so the tool silently received null. Run the same finite-number
check --tool-arg already uses and fail before connecting, with mcpdo's
wording and without echoing the value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Only the key (or header name) has to be non-empty. `-e KEY=` sets KEY to
the empty string on web, TUI, CLI and mcpdo, as a config file's
`"env": {"KEY": ""}` already does (#3066). `--tool-arg k=` (and
`--metadata` / `--tool-metadata` / `--event-arg`, which share the parser)
sends "" on the CLI and mcpdo, matching `--prompt-args q=`. `--header
"X:"` sends an empty field value, which RFC 9110 allows. A missing `=` or
colon, and an empty key or name, are still rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
…mes (#3070)

A JSON-RPC error response now exits 5 as server_error, carrying
jsonRpcCode/jsonRpcData; a stdio server that cannot be spawned or exits
before answering exits 14 as server_exited; a non-http(s) server URL is
refused up front as a usage error instead of exiting 4 (retryable).
mcpdo relays the new envelope fields across the daemon socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
`--tool-arg` (CLI and mcpdo) and mcpdo's `key:=value` positionals used to
JSON-parse every value at parse time, so `zip=10001` reached a string-typed
property as a number and was rejected. The values now stay raw text until
`tools/call` / `--load` has looked the tool up, and a shared core helper
(core/cli/utils/tool-arg-types.ts) types them by the declared property type:
string keeps the text (a whole JSON string literal is still unquoted),
number/integer/boolean/object/array go through the client's existing JSON
parse and must match, and undeclared or union-typed keys keep the old parse.
--tool-args-json and inline JSON stay verbatim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
…3068)

`JSON.parse` turns every number into a float64, so an integer past
±2^53 in --tool-arg, --tool-args-json, --metadata, --tool-metadata or
mcpdo's key:=value / inline-JSON positionals reached the server rounded,
with exit 0. A shared `parseJsonExact` (core/cli/utils/exact-json.ts)
uses the reviver's `context.source` to detect an integer literal that
does not survive the conversion, and both clients reject it as a usage
error naming the key but never the value, as they already do for 1e400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
… refusal (#3070)

Address Copilot's first review on #3086: a ConnectionClosed counts as a
server exit only at the top level (a wrapped HTTP subscription close is
not one); a ProtocolError is classified before the HTTP/auth checks so an
application-defined 401/429 code keeps its JSON-RPC fields; the scheme
refusal is its own error type so an aborted:// scheme cannot match the
unreachable pattern; and mapJsonStrings copies into a null-prototype
record so an own __proto__ key survives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
…3075)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
…off (#3073)

Both short-circuit modes return before any method runs, so a method flag
matching the given --method was still ignored there. Refuse every
method-specific flag with either mode, and run the check after the
--load validations so a load run keeps its own conflict messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
`JSON.stringify` writes a double's shortest round-trip form, so an
exactly representable literal like 1000000000000000128 still reached
the wire as 1000000000000000100. Compare the source digits against the
integer the serialized token denotes, exponent notation included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
InspectorClient raises a -32602 ProtocolError itself when a successful
tool result fails its outputSchema; the server sent no error code. Raise
it as a marked ToolOutputValidationError subclass, so every existing
ProtocolError consumer is unchanged, and exclude it from server_error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
The reviver walk recurses where a plain JSON.parse does not, so very
deep but valid JSON now throws RangeError, and the key=value parsers'
catch-all fallback would have sent it as a string. A shared
`parseJsonOrString` takes the fallback on SyntaxError only, turns an
inexact integer into the usage error, and propagates anything else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
…3080 rollup)

Both PRs edit the --tool-arg row; the resolution keeps #3069's `key=` sends `""` and #3068's integer-precision sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
…-trip' into v2/feat/3075-schema-typed-tool-args
… into v2/feat/3075-schema-typed-tool-args

Signed-off-by: cliffhall <cliff@futurescale.com>

# Conflicts:
#	clients/cli/README.md
…hod-flags' into v2/feat/3075-schema-typed-tool-args
…rs' into v2/feat/3075-schema-typed-tool-args
Rollup for tracker #3080: #3075 conflicted textually with every sibling in
clients/cli/src/cli.ts and with #3068 in mcpdo's parsers, so this branch
carries the resolution and merges last.

- Imports: keep #3075's tool-arg-types imports beside #3068's exact-json
  ones and #3074's suggest-flag import.
- mcpdo: #3075 moved --tool-arg / key:=value parsing into autoParseValue;
  it now passes the key so #3068's integer-precision guard applies on that
  path (parseToolArgValue included), with a regression test.
- collectToolArgText accepted no empty value, which would have undone
  #3069 for --tool-arg once both merged; k= is now the empty string, which
  a string or undeclared property receives as "" and a typed non-string
  property refuses as a usage error (tests for both).
- CLI README --tool-arg row: #3075's schema typing plus #3069's k= and
  #3068's integer-precision sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
@cliffhall cliffhall added the v2 Issues and PRs for v2 label Nov 30, 2026
@cliffhall

Copy link
Copy Markdown
Member Author

Closing as intended. CI is green on this rollup (build, coverage, windows, DCO, CodeQL), and all eight constituent branches merged onto v2/main without conflict. That proves PRs #3083, #3082, #3084, #3085, #3081, #3086, #3088 and #3087 work together. They will now be merged individually, in the order listed in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant