Skip to content

fix(cli): reject non-decimal native UI and command deadline options - #8601

Closed
Plastic-time wants to merge 3 commits into
morluto:mainfrom
Plastic-time:rrfz/decimal-utility-options
Closed

Plastic-time wants to merge 3 commits into
morluto:mainfrom
Plastic-time:rrfz/decimal-utility-options

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #8042, which was closed without review. This is the same change rebased onto d3ab0faf5. Greptile's earlier review (5/5) is on #8042. After Greptile's review here, fab7287a7 replaces the option-by-spelling test matrix with representative cases; the source is unchanged.

Problem and outcome

Native UI scope and native-command deadline options used numeric coercion, so values such as --pid=0x10 and --native-command-timeout-ms=1e3 passed argument validation. The compiled CLI reached target/capability lookup instead of refusing the token.

Use the existing decimal-token parser for pid, windowId, maxNodes and the native UI/command deadlines in utilityCommands.ts. Non-decimal tokens now return VALIDATION_ERROR on the corresponding field. Decimal controls still reach the downstream target/capability checks. No issue is linked; this was found while reviewing remaining numeric options after #7376/#7493.

Evidence and validation

Updated with upstream 9bea563e3 on 2026-11-02 (merge commit 393f6e588). Windows, Node 24.22.1, npm 11.19.1: npm run test:focused -- tests/boundary/cli/utilityIntegerOptions.test.ts 12/12 passed; npm run check:fast and npm run docs:check passed. The upstream update includes 00c4f44a1, which repairs the old formatting/verifier failures. Earlier evidence below is historical; see the checks on the current head for hosted CI status.

Local environment: Windows 11 x64 (10.0.26200), Node 24.22.1, npm 11.19.1, head fab7287a7 on d3ab0faf5 (main, 2026-11-01).

  • npm run test:focused -- tests/boundary/cli/utilityIntegerOptions.test.ts: 12/12 passed.
  • Same command with only src/cli/utilityCommands.ts reset to d3ab0faf5: 10 failed / 2 passed. The defect still reproduces on current main.
  • --pid runs all six non-decimal spellings. --window-id, --max-nodes, --native-ui-deadline-ms and --native-command-timeout-ms share the parser and run 0x10 each. Deadline/PID bounds and decimal controls are covered once.
  • npm run check:fast passed.

Earlier hosted CI (before the 2026-11-02 upstream merge): Static checks, one test shard and Portable tests fail the same way on maintainer PRs opened on d3ab0faf5 (#8602, #8605). The causes are format:check on files on main, providerVerifierCleanup and javascriptRuntimeObservationMcp.

Earlier local checks of the same source change

These ran on base bf115be2c; utilityCommands.ts has not changed since.

Remaining limits: Local runs were Windows-only; the native UI helper did not run. capture-native-ui-scenario shares the option object but the regression drives observe-native-ui. Seven related-suite failures were reproduced with the production file reset to base. The overlap checks above describe the branches at implementation time, not a fresh compatibility guarantee for other PRs.

Contract and boundary impact

The shared deadline schemas retain their descriptions and 1–2147483647 bounds; maxNodes retains its default of 500. MCP number schemas, native helper behavior and cliIntegerArgument itself are unchanged. Browser observation-duration options are outside this change. No new dependency, target-execution capability or authority; ordinary correction within existing scope.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Prepared with AI assistance.

Author readiness

Human owner: @Plastic-time

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

The native UI scope options (--pid, --window-id, --max-nodes,
--native-ui-deadline-ms) and --native-command-timeout-ms were numeric
Zod fields, so Incur converted argv text with Number() before
validation. Tokens such as "0x10", "0b10000", "1e1", "+16", "16.0" and
" 16" were accepted as integers instead of being refused.

Parse these options as decimal integer text with cliIntegerArgument, as
other CLI integer arguments already do. The deadline options keep the
bounds of their shared native deadline fields. MCP
request schemas are unchanged.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T21:20:28.164027Z 393f6e5 New commits
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; no new actionable issue was found.

Summary

Uses cliIntegerArgument to reject non-decimal native UI selectors, node limits, and native deadlines.

  • Native utility commands accept only decimal text for integer options.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

The native UI and command deadline options share cliIntegerArgument, so run
every malformed spelling against --pid and one hexadecimal token against each
other option instead of the full option-by-spelling matrix.
@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants