Repository navigation
fix(cli): preserve mcp doctor output choices on argument errors - #2693
Conversation
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. |
[Low impact] The changes appear safe to merge. SummaryThis PR preserves MCP doctor output choices when arguments are invalid, without changing normal diagnostic runs.
The parser fix remains distinct from the full-output support already on the base branch. No actionable correctness or security issues were found. Tests were not run during this review. Reviews (8) · Last reviewed commit: "Merge main and keep MCP doctor output va..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38056e9c35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 744f4c2393
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. Source changes are on 075b43a. The argument owner now walks option positions once, retains the first validation error, and continues collecting format/full-output/help choices. A token consumed as --format's value remains a value. Validation projection therefore honors --full-output before or after an invalid option; the superseded help-only pre-scan was removed. Added ordering regressions without launching MCP for invalid invocations. Source inspection and git diff checks completed. Tests, typecheck/lint, generated-schema checks and real-provider lanes were not run for this final revision at the user's explicit request. |
Use one named input-schema projection for clients and catalog identity, preserve dialect declarations, and bound compact schema depth. Keep canonical SDK output validation when output advertisements are disabled. Release request-owned state on cancellation and carry upstream limitations through composed workflows. Preserve doctor full-output envelopes and validate navigation facts at their owner. Reviewed fixes: #2088, #2108, #2513, #2684, #2693, #2695, #2836, #2864, #2868, #2877, #2933, #2998, #3002, #3015. Validation: focused schema, SDK output-validation, context, and workflow tests passed; no schema dialect or canonical output validation was relaxed.
|
Heads up: the core of this is on main now. 80de314 added the same One part is not on main yet. On this branch, a bad option still honors This branch now conflicts with main. A smaller pull request with just that part may be easier to merge. I only read the code here. I did not build or run it, because every test it touches runs the MCP doctor. 🤖 Generated with Claude Code (Opus 5.5) 🦊 |
|
Compared this PR with main The normal MCP doctor full-output envelope is already delivered in 80de314. The distinct remaining behavior here is collecting output selectors after a validation error, such as --bogus --full-output --json; main's parser returns at the first error and drops that choice. Please narrow/rebase around the single argument-owner pass already described in the branch review: retain the first error, continue collecting valid format/full-output/help choices, and treat a token consumed as a --format value as a value. Keep ordering regressions and prove invalid invocations never start MCP. PR head reviewed: |
Signed-off-by: Jason Chen <[email protected]>
d4b0718 to
9816af2
Compare
Summary
The normal MCP doctor full-output path is already on main. This PR now only fixes output selection when argument validation fails, as requested in the maintainer review.
For example,
rea mcp doctor --bogus --full-output --jsonshould return a JSON error envelope and exit 1 without starting MCP. Previously, parsing stopped at the first error and dropped the later output options.Change and scope
The parser keeps the first error while continuing to collect valid output and help options. Tokens consumed by
--formatremain values, even when they look like flags. The last valid format wins.The diff is limited to the parser/error path and 35 regression cases. Tests cover option ordering and assert that neither MCP connect nor transport start is called. Normal diagnostic execution is unchanged.
Scope: an argument-parsing fix within the existing CLI. No new provider, target interaction, package change, or migration is introduced; a separate scope decision is not applicable. MCP/tool-catalog, evidence, authority, and cleanup contracts are unchanged.
Validation
On the unmodified base, 25 of the initial 33 regression cases failed; all passed after the fix. Two additional TOON/Markdown cases also pass.
Executed after the final rebase with Node 24.18.0 / npm 11.16.0:
npm run test:focused -- tests/process-global/mcpDoctorArguments.test.ts tests/boundary/mcp/mcpDoctor.test.ts tests/boundary/cli/mcpDoctorHelpCli.test.ts— 51 passed across 3 files.npm run check:fast— passed.npm run check— passed (typecheck, lint, formatting, knip, metadata, architecture guards).npm run verify:test-discovery— all 1,328 test files discovered exactly once.git diff --check— passed.The full suite and real Hopper/Ghidra/browser lanes were not run. Existing lint/build warnings remain.
Maintainer follow-up
Resolved the conflict with current main (
8a10fa9c00). One argument scan now retains the first error, consumes format values in their existing positions, and applies the last valid format and full-output option. Help and typed JSONL framing are preserved. Argument errors return before MCP startup.The compiled CLI returned TOON for
--bogus --jsonon main. The revised head passed all 43 focused tests, including compiled CLI and production stdio MCP coverage, plusnpm run check:fastand changed-file formatting.Author readiness
Human owner: @jasonchen505