Fix screenshot eval assertion to match the tool's JPEG output - #3682
Merged
Conversation
Collaborator
📊 Performance Test ResultsComparing a907ccf vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
youknowriad
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
None.
How AI was used in this PR
The code change and this PR description were drafted with Claude Code; the diagnosis was confirmed by running the eval suite locally.
Proposed Changes
The
screenshot-all-timingagent eval has been failing because its assertion still expected PNG screenshots, whiletake_screenshotnow produces JPEG (screenshot-desktop.jpg/screenshot-mobile.jpg,image/jpeg). The agent behavior was correct all along — one fastviewport: "all"capture of desktop and mobile — but the check rejected the payload on the file name/format and parsed dimensions as PNG.This updates the assertion to validate the real invariant rather than the encoding:
desktop→ 1040,mobile→ 390) instead of the file extension, so it no longer breaks if the format changes again.The eval suite is green again, so the daily eval reports an accurate signal instead of a standing false failure.
Testing Instructions
eval/, run the screenshot case:npx promptfoo@0.121.4 eval -c promptfoo.config.yaml --no-cache --filter-pattern "screenshot verification"viewport: "all"screenshot and validates the desktop/mobile JPEG dimensions).Pre-merge Checklist