Skip to content

fix(server): prevent preview_snapshot from bricking sessions with oversized images - #11624

Open
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/preview-snapshot-image-size
Open

fix(server): prevent preview_snapshot from bricking sessions with oversized images#11624
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/preview-snapshot-image-size

Conversation

@Exotic209093

@Exotic209093 Exotic209093 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

The preview_snapshot MCP tool embedded full-resolution base64 PNGs directly into tool history as inline image content blocks. When providers reject inline images, this permanently bricks the session because the oversized payload cannot be removed from history. Removed the inline image content block from snapshot results; structured metadata (dimensions, mime type) is still returned for reference while the client renders the actual image from its own copy.

Fixes #11295

Summary by CodeRabbit

  • Bug Fixes
    • Snapshot previews no longer include inline image data, reducing failures caused by rejected images.
    • Snapshot results now provide textual JSON metadata and structured screenshot metadata.

@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T19:12:38.053928Z 431dcc9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 13, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 431dcc9

Macroscope's review found this PR approvable — This is a small, self-contained regression fix that removes oversized inline PNG payloads from MCP history while preserving snapshot metadata and existing preview behavior. The focused test covers the changed response shape.

You can add or adjust custom eligibility rules. Learn more.

@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: 431dcc93cc

ℹ️ 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".

mimeType: screenshot.mimeType,
},
],
content: [{ type: "text", text: JSON.stringify(metadata) }],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Return a bounded screenshot to image-capable providers

For providers/models that accept MCP image blocks, every preview_snapshot now returns only page metadata, so pages whose relevant state is visual-only (canvas output, layout defects, video frames, or other non-semantic content) can no longer be inspected by the agent even though PreviewSnapshotTool still promises a PNG screenshot. The client preview's copy is visible to the user, not to the provider consuming this MCP response; preserve a size-bounded/downscaled image for compatible providers, or omit it only for adapters that cannot accept one.

AGENTS.md reference: AGENTS.md:L69-L72

Useful? React with 👍 / 👎.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 7428f56e-bb7e-4cd4-be1a-0333e7a17683

📥 Commits

Reviewing files that changed from the base of the PR and between 77bca8b and 431dcc9.

📒 Files selected for processing (2)
  • apps/server/src/mcp/McpHttpServer.test.ts
  • apps/server/src/mcp/McpHttpServer.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The preview snapshot MCP tool no longer returns inline base64 PNG content. It returns textual metadata and structured screenshot metadata. The test now verifies that the response contains one text entry and no image entry.

Changes

Preview snapshot response

Layer / File(s) Summary
Text-only snapshot result
apps/server/src/mcp/McpHttpServer.ts, apps/server/src/mcp/McpHttpServer.test.ts
The snapshot result removes inline image content while retaining screenshot dimensions and MIME type. The test verifies one text entry and no image content.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 431dc

The snapshot response no longer embeds inline image data that can break provider sessions, while clients retain the metadata needed to render their own image copy.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains what changed, why the change was needed, and references issue #11295. It omits the template headings and checklist, but it contains the core required information.
Title check ✅ Passed The title clearly identifies the server fix and its purpose: preventing oversized images in preview_snapshot from bricking sessions.
Linked Issues check ✅ Passed The implementation satisfies #11295. McpHttpServer.ts removes screenshot.data before creating CallToolResult. The result contains only text JSON and structured screenshot metadata with `mimeType…
Out of Scope Changes check ✅ Passed The reviewed changes are limited to McpHttpServer.ts and its MCP regression test. They remove inline snapshot image data and verify the required metadata behavior. These changes directly implement #…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches 💡 2
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch fix/preview-snapshot-image-size
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

preview_snapshot includeImage embeds full-res base64 PNGs into tool history; providers that reject inline images brick the session permanently

1 participant