Skip to content

view_image test: start the pixel budget check from an empty PNG memo - #18373

Merged
danielhanchen merged 1 commit into
mainfrom
ci/view-image-test-isolate-png-memo
Nov 18, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/view-image-test-isolate-png-memo

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

studio/backend/tests/test_view_image_tool.py::test_invalid_large_and_pixel_bomb_files fails on main when it runs after the other tests in its file:

assert 'megapixel limit' in 'Opened image.\n__MCP_IMAGES__:[...]'

Seen in "(Python 3.13, rest)" on the staging run for #17742, which is on current main. Run alone, it passes.

Cause

#18256 memoizes the normalized PNG data URL per payload, so a replayed screenshot is not re-decoded on every message. Only images that passed the size checks are stored. MAX_IMAGE_PIXELS is a constant in production, so a memo hit is always within budget. That code is correct.

The test lowers mcp_images.MAX_IMAGE_PIXELS at runtime, for the same image.png that earlier tests in the file had already viewed. The memo returned the earlier result without reaching the pixel check.

Fix

Test-only: give the budget check an empty memo (_PNG_MEMO and _png_memo_chars, restored by monkeypatch), so it exercises the check rather than the cache.

Verification

Tree test_view_image_tool.py in file order
main 1 failed, 30 passed
this branch 31 passed

The test also passes on its own on this branch. ruff is clean.

#18256 memoizes normalized PNG data URLs. MAX_IMAGE_PIXELS is fixed in
production, so a memo hit is always within budget, but
test_invalid_large_and_pixel_bomb_files lowers the budget at runtime for
an image.png earlier tests already normalized, and the memo answered it.
Give the check an empty memo.
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T18:00:26.560726Z 0288001 Manual request
ℹ️ 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 0288001bea

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit ec303bc into main Nov 18, 2026
@danielhanchen
danielhanchen deleted the ci/view-image-test-isolate-png-memo branch November 18, 2026 18:01
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