Skip to content

fix(playground): respect screenshotIncluded request param for dump/report#2726

Open
zhsj0089944 wants to merge 1 commit into
web-infra-dev:mainfrom
zhsj0089944:fix/playground-inline-screenshots
Open

fix(playground): respect screenshotIncluded request param for dump/report#2726
zhsj0089944 wants to merge 1 commit into
web-infra-dev:mainfrom
zhsj0089944:fix/playground-inline-screenshots

Conversation

@zhsj0089944

Copy link
Copy Markdown

Problem

The /execute endpoint hardcodes inlineScreenshots: true when generating dump and reportHTML response fields. After multiple actions, the response can exceed 50MB, causing JSON.stringify to throw RangeError: Invalid string length.

The screenshotIncluded field is already destructured from the request body and respected during action execution, but ignored when building the response.

Fix

Respect the screenshotIncluded parameter from the request body when generating dump and reportHTML:

  • When screenshotIncluded: false is sent, 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).

Related Issue

Fixes #2539

…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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +2793 to +2795
const inlineScreenshots = screenshotIncluded !== false;
const dumpString = agent.dumpDataString({
inlineScreenshots: true,
inlineScreenshots,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

[Bug]: Playground /execute endpoint returns oversized response causing RangeError: Invalid string length

1 participant