Skip to content

fix(engine): attach native browser_screenshot as an image, not base64 text - #4414

Merged
LHagfoss merged 1 commit into
mainfrom
fix/engine-browser-screenshot-image
Nov 25, 2026
Merged

LHagfoss merged 1 commit into
mainfrom
fix/engine-browser-screenshot-image

Conversation

@LHagfoss

Copy link
Copy Markdown
Owner

What

On the built-in harness, browser_screenshot returned the CDP result as tool text: a JSON object with the whole PNG in base64. The model never saw an image and its context filled with base64. The MCP path already turned it into an image block.

Now the native turn decodes the result with the preview's decode_screenshot (PNG/JPEG check, 8 MiB cap), saves it as an image attachment, and returns a short note. The image follows the tool batch through the same pending_preview_images → screenshot_attachment_message path as preview and Smart UI screenshots, so models without image input get the vision_model description. Malformed or unsaveable data is an error result. MCP behavior is unchanged.

Changelog

Fixed: on the built-in harness, browser screenshots reach the model as an image instead of base64 text.

Testing

  • Unit tests in computer_use.rs (screenshot_tests): a PNG becomes a short success note plus the saved image; malformed JSON, missing data, bad base64, a non-PNG/JPEG and a failing save are errors. CI runs them.
  • cargo fmt --all -- --check, scripts/check-comments.py, scripts/check-rust-size.py.

Closes #4362

@github-actions github-actions Bot added the fix A bug fix label Nov 25, 2026
@LHagfoss
LHagfoss merged commit b0cdd8b into main Nov 25, 2026
7 checks passed
@LHagfoss
LHagfoss deleted the fix/engine-browser-screenshot-image branch November 25, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(engine): attach native browser_screenshot as an image, not base64 text

2 participants