Repository navigation
fix(mcpx): preserve optionality of parsed positionals in adapter import (#9559) - #9566
Conversation
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
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. |
Fixes #9559 — the unaddressed Codex P2 finding from PR #9161:
mcpx adapter importmarked every parsed positional as required, sobuildArgsrejected valid calls that omit an optional operand (e.g. argparseadd_argument('item', nargs='?', default=...), shown as[item]in usage).Change
importFlaggains anOptionalfield (positionals only).parseHelpTextnow derives optionality from the source usage:optionalPositionalNamesscans the usage block (theusage:line plus continuation lines up to the first blank line) for bracketed[name]groups — a leading dash inside a group makes it an optional flag group, not a positional — and a bracketed positional row also counts. A positional with no bracket evidence stays required.shapeToSpecemitsRequired: !pos.Optionalin both branches (subcommand tools and the single-tool branch).Tests (oracle: the finding's own scenario)
TestParseHelpTextOptionalPositionalFromUsage—src [item]:srcstays required,[item]is optional.TestHelpImportOptionalPositionalMayBeOmitted— imported optional positional is not required; a call omitting it validates viaSpec.Calland runs with no operand rendered.TestHelpImportSubcommandOptionalPositional— the subcommand branch preserves optionality too.TestHelpImportPreservesSubcommandPositionalsstill passes (unbracketed positional stays required).go test ./internal/cli/ ./internal/adapter/in pkgs/mcpx: PASS.go veton both packages: clean.Queue: task 16113, lane code-d.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.