fix(playground): respect screenshotIncluded request param for dump/report#2726
fix(playground): respect screenshotIncluded request param for dump/report#2726zhsj0089944 wants to merge 1 commit into
Conversation
…port The /execute endpoint hardcoded inlineScreenshots: true when generating dump and reportHTML response fields. After multiple actions, the response could exceed 50MB, causing JSON.stringify to throw RangeError: Invalid string length. Now respects the screenshotIncluded parameter from the request body: - When screenshotIncluded is false, dump and reportHTML are generated without inline base64 screenshots, keeping the response size manageable. - When screenshotIncluded is not provided or true, the existing behavior is preserved (default true for backward compatibility). Fixes web-infra-dev#2539
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccb01f631e
ℹ️ 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".
| const inlineScreenshots = screenshotIncluded !== false; | ||
| const dumpString = agent.dumpDataString({ | ||
| inlineScreenshots: true, | ||
| inlineScreenshots, |
There was a problem hiding this comment.
Keep playground response screenshots inline
When the Playground UI turns off “Include screenshot in request” it sends screenshotIncluded: false, but execution still captures screenshots into task.uiContext/recorder for reports. This /execute response is consumed directly by the browser; with inlineScreenshots set to false it contains only midscene_screenshot_ref objects and no screenshot files or image script tags are returned. The visualizer builds replay frames from result.dump and reads screenshot.base64, so replay/report previews for these runs become blank. Keep response serialization inline, or return separately accessible screenshot assets, independently of the model request option.
Useful? React with 👍 / 👎.
Problem
The
/executeendpoint hardcodesinlineScreenshots: truewhen generatingdumpandreportHTMLresponse fields. After multiple actions, the response can exceed 50MB, causingJSON.stringifyto throwRangeError: Invalid string length.The
screenshotIncludedfield is already destructured from the request body and respected during action execution, but ignored when building the response.Fix
Respect the
screenshotIncludedparameter from the request body when generating dump and reportHTML:screenshotIncluded: falseis sent, dump and reportHTML are generated without inline base64 screenshots, keeping the response size manageable.screenshotIncludedis not provided (ortrue), the existing behavior is preserved (defaulttruefor backward compatibility).Related Issue
Fixes #2539