Skip to content

fix(computer-use): reject nonpositive image dimensions and limits - #480

Open
00200200 wants to merge 1 commit into
anthropics:mainfrom
00200200:codex/quickstart-positive-image-limits
Open

00200200 wants to merge 1 commit into
anthropics:mainfrom
00200200:codex/quickstart-positive-image-limits

Conversation

@00200200

Copy link
Copy Markdown

The image-size search assumes a valid one-pixel lower bound. Nonpositive limits violate that assumption: a one-pixel image with max_tokens=0 never terminates, and larger inputs can return dimensions that exceed the requested cap. Reject nonpositive dimensions and sizing limits before the search. The hang regression runs in a child process with a timeout; ordinary valid sizing cases remain covered.

Validation: PYTHONPATH=computer-use-best-practices/ python -m pytest computer-use-best-practices/tests/test_image.py -q (18 passed in 0.54s). The regression tests fail on the unchanged main branch. Tests use local fixtures; no paid API calls.

Additional checks: ruff check computer-use-best-practices/tests/test_image.py computer-use-best-practices/computer_use/image.py, ruff format --check computer-use-best-practices/tests/test_image.py computer-use-best-practices/computer_use/image.py.

Prepared with Codex assistance; the final diff and regression behavior were checked locally.

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.

1 participant