Skip to content

fix(cli): parse explicit desktop capture limits - #9161

Closed
ShuaixinHuang wants to merge 2 commits into
morluto:mainfrom
ShuaixinHuang:codex/fix-desktop-capture-limit-arguments
Closed

ShuaixinHuang wants to merge 2 commits into
morluto:mainfrom
ShuaixinHuang:codex/fix-desktop-capture-limit-arguments

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Allow explicit positive integer limits on capture-desktop-application. For example:

rea capture-desktop-application --executable notes --output capture --max-duration-seconds 60

Previously every explicitly supplied capture limit was rejected as “expected number, received string”. Omitting the flags worked because numeric defaults bypassed argv coercion.

Change and scope

The command registered z.int() fields, whose ZodNumberFormat constructor is not coerced by the pinned Incur parser. Use the existing cliIntegerArgument(1) owner for all four limits: duration, entries, per-file bytes and total content bytes. Keep existing defaults and positive safe-integer bounds, and reject non-decimal spellings before coercion.

This is an existing CLI admission fix, with no new capture capability, target authority or lifecycle behavior. No maintainer scope decision is applicable. The sibling CLI registrations were checked; no other direct z.int() registration remained. #9061 addresses the separate inspect-desktop-application limits, not this capture command. Issue and open/closed PR searches found no equivalent capture-limit fix; no issue is linked.

Evidence and validation

Against current main cfa7ebb0206aaf3cf5aeaf583f9b9336d2f9fea4, the registered CLI regression failed both explicit-limit cases, while its default and invalid-input controls passed (2 failed, 8 passed). After the fix, all 10 passed.

Tests serve the actual registered command and use a scoped spy only at the capture backend. They verify all four forwarded numeric values using spaced kebab-case and equals-form camelCase flags, unchanged defaults, and refusal of zero, negative, fractional, hexadecimal, exponent, empty and unsafe-integer input before backend invocation.

Executed on Windows with the existing Node 22.20.0/dependency set:

  • node node_modules/vitest/vitest.mjs run --config .cache/vitest-existing-saxes.mts tests/boundary/cli/desktopCaptureOptions.test.ts — 10 passed; the same command with main's original numeric field reproduced the two failures.
  • Targeted oxfmt --check, oxlint and git diff --check — passed.

The checkout's dependency set lacks saxes; the ignored local Vitest config resolves the already-existing [email protected] from another checkout. No dependencies were installed or modified. Full typecheck, compiled launcher and real Linux/X11 capture were not run locally; remote CI is pending. The test does not launch an application or create capture output.

Contract and compatibility

The owning boundary is CLI argv interpretation; the existing application request remains numeric. No MCP schema, Evidence, package, dependency or generated metadata changes. The capture backend's authority and cleanup are unchanged.

Author readiness

Human owner: @ShuaixinHuang

  • 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.

Review cleanup update

Each CLI case now saves process.exitCode before execution and restores it in afterEach before restoring spies, including after failed assertions. The 10 registered-command tests, targeted formatter/lint and whitespace checks passed after this change. New HEAD CI remains pending.

@ShuaixinHuang
ShuaixinHuang marked this pull request as ready for review November 6, 2026 14:33
@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-06T14:33:39.994444Z
We couldn’t complete this review. Comment @codex review to try again.
cda908f Draft marked ready
ℹ️ 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

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge, with no blocking issue found.

Summary

The capture command uses cliIntegerArgument(1) for all four limits, preserving defaults and positive safe-integer bounds.

  • The capture command now accepts explicit positive limits.

Reviews (3) · Last reviewed commit: "test(cli): restore desktop capture test ..." · Reviewed by Greptile

@morluto morluto closed this Nov 7, 2026
@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