Files
pad/internal/cli
xarmian 88a5af1a74 fix(mcp): stdio passes "-"-leading free text as text, and reports argv refusals and 429s with the right code (BUG-3142, BUG-3147) (#1444)
* fix(mcp): stdio sends positionals behind "--", so free text starting with "-" is no longer parsed as a flag (BUG-3142)

BuildCLIArgs emitted positionals first with no terminator, so cobra read
`item search "-ship it"` as an unknown shorthand flag and refused the call
before the command ran, on all 12 free-text positionals the stdio transport
carries. It now emits every flag (root flags, --workspace, --format
included) and then `--` and the positionals; the remote door ignores this
vector. Pinned against the real cobra tree through each command's own flag
parser, including a positional that is literally "--workspace".

Claude-Session: https://claude.ai/code/session_01RYiqbqXmxQMoKHsGm8B77N

* fix(mcp): stdio reports an argv refusal as validation_failed, with its message, instead of a retryable server_error (BUG-3142)

Two defects on one path. The root command's flag-error hook prints cobra's
usage block BEFORE the "Error:" line, and stripCobraUsageBlock truncated at
"Usage:", so a flag-parse refusal reached the classifier as an empty string.
And no stderr pattern matched cobra's or pflag's argv refusals at all. The
strip now stops at a following "Error:" line, and one anchored pattern covers
the parse-time family enumerated from cobra v1.10.2 and pflag v1.0.10.

Pinned end to end: the test binary re-executes as the real CLI under
ExecDispatcher, so the real stderr ordering is what gets classified.

Claude-Session: https://claude.ai/code/session_01RYiqbqXmxQMoKHsGm8B77N

* fix(mcp): a 429 reaches a stdio caller as rate_limited with the server's wait, and the tool surface is 0.42 (BUG-3147, BUG-3142)

The CLI printed only the limiter's message, which no stderr pattern matched,
so every 429 reached a stdio MCP caller as a retryable server_error while the
remote transport said rate_limited. The CLI now writes the structured marker
line at its root for a 429 on any command, carrying Retry-After as
details.retry_after_seconds, and stdio lifts it.

ToolSurfaceVersion 0.42 covers this and BUG-3142's classification change in
one entry: both change the code a stdio caller receives, and nothing else.

Claude-Session: https://claude.ai/code/session_01RYiqbqXmxQMoKHsGm8B77N

* test(cmd/pad): the stdio argv test restores the root flag globals it parses into (BUG-3142)

Claude-Session: https://claude.ai/code/session_01RYiqbqXmxQMoKHsGm8B77N
2026-09-22 22:49:36 -04:00
..
2026-09-16 12:00:11 -04:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00