Skip to content

Text-only preview snapshots capture and encode a full-frame PNG that is then discarded #24174

Closed as not planned

Description

@bompus

What happened

preview_snapshot captures a full-frame screenshot on every call, even when the caller asked for neither the inline image nor a saved file. Agents snapshot before nearly every browser interaction, almost always text-only, so this cost is paid constantly.

Diagnosis

The MCP handler strips includeImage/save before invoking the snapshot operation, so ServerBrowserPage.capture always runs Page.captureScreenshot + PNG encode, the base64 travels through the broker, and McpHttpServer base64-decodes it before dropping the bytes.

Note this changes one visible behavior: when no screenshot is captured, the result's screenshot field (and its dimensions) would be null instead of carrying dimensions of a discarded image; preview_status still reports viewport sizes. Adjacent: #21494 (text-only snapshots hanging on hidden tabs) — skipping the capture also removes that capture from text-only calls, but this does not fix hidden-tab captures when a screenshot is requested.

Steps to reproduce

  1. Open a preview tab and call preview_snapshot with no includeImage and no save.
  2. Count Page.captureScreenshot CDP calls (real Chromium, ServerBrowserPage.test.ts): one per text-only snapshot, though the resulting bytes are dropped.
    No wall-time figure is claimed; the cost is one full-frame capture and encode per snapshot.

Version

0.1.3-nightly.20261023 (upstream main 807319c)

Environment

Linux 7.2.9 (WSL2), Node 26.12.1, Chromium via the server browser

Evidence

Page.captureScreenshot calls per text-only preview_snapshot: 1 before, 0 after (branch; 39/39 preview tests pass)

Related issues

#21494 (text-only snapshots hanging on hidden tabs): adjacent, not the same defect

Fix applied or workaround

None applied. I can open a pull request for this once triage confirms the direction. A measured branch exists (perf/preview-snapshot-skip-screenshot on my fork, fork review PR bompus#17): thread includeScreenshot (includeImage || save) through the snapshot operation, skip captureViewport when false, and make the contract's screenshot field nullable; hosts that ignore the new input field keep returning a screenshot.

Filed by

Muse Wonder Full 1.0 (Muse Code) investigated and measured; Claude Sonnet 5.5 (Claude Code) filed it, via T3 Code

Activity

  1. bompus commented on Oct 23, 2026

    @bompus
    ContributorAuthor

    Closing as a duplicate of #21494, which already makes the screenshot optional and skips Page.captureScreenshot for text-only snapshots. I should have found that PR before filing. My count (one Page.captureScreenshot per text-only snapshot) matches its diagnosis, so there's nothing to add here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions