Skip to content

fix(mcpx): adapter import catch-all takes a non-colliding name (#9558) - #9567

Merged
dezren39 merged 1 commit into
mainfrom
queue/16112-9558-catchall-collision
Nov 13, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/16112-9558-catchall-collision

Conversation

@dezren39

@dezren39 dezren39 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Closes #9558. Queue task 16112 (triage packet, triaged + fixed inline by lane any-b).

Root cause

shapeToSpec in pkgs/mcpx/internal/cli/adapter_import.go appended the positional catch-all Param{Name: "args", Type: "array"} unconditionally in both generation branches (subcommand tools and the single-tool branch), after the parsed flag params and positionals. When the imported help itself declares a positional named args or a flag --args, the generated declaration carried two args parameters: Spec.Validate() accepts duplicate names, Schema() overwrites the earlier schema, and buildArgs() renders both entries from the same input — positional operands passed twice, or a flag value also becoming an unintended trailing operand. Finding: Codex P2 on merged PR #9161, never addressed. (Per the filing job's rules, this PR does not reply to or resolve the source review thread.)

Fix

New catchAllParam(params) helper: it builds the catch-all under the first name not already used by that tool's declared params — args, else args_extra, args_extra_extra, … — the same suffix discipline flagParams already applies to duplicate flags (_flag). The parsed parameter always keeps its own name; only the catch-all moves. Both branches now append catchAllParam(params).

Tests (oracle: the mcpx test suite)

New regression test TestShapeToSpecCatchAllNameNeverCollides covers, in both branches:

  • single-tool shape with a positional named args;
  • single-tool shape with a --args flag;
  • subcommand shape whose subcommand declares a positional named args;
  • a no-collision control (catch-all keeps the name args).

Each asserts every generated parameter name is unique, the parsed args param survives exactly once, and the array catch-all is present under a non-colliding name. Full go test -count=1 ./internal/cli/ passes (17.5s, laptop) — the only package consuming shapeToSpec; gofmt clean.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 13, 2026 14:37
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T14:37:26.642664Z
We couldn’t complete this review. Comment @codex review to try again.
4c26eab PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@dezren39

Copy link
Copy Markdown
Member Author

Review disposition before merge (task 16112, lane any-b): Codex's review run on head 4c26eab failed to execute — the connector states Codex usage limits for code reviews are reached, and no Codex findings (inline or summary) were produced, so there is nothing undispositioned to fix or rebut; the failure is reviewer capacity, not a finding. Merging under the standing criteria on the targeted evidence in the PR body (full go test -count=1 ./internal/cli/ pass, including the new collision regression test).

@dezren39
dezren39 merged commit fc61197 into main Nov 13, 2026
@dezren39
dezren39 deleted the queue/16112-9558-catchall-collision branch November 13, 2026 14:37
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpx(adapter import): positional catch-all 'args' can collide with a parsed args parameter, duplicating operands (from PR #9161)

1 participant