Skip to content

fix(server): images that ACP agents read show a preview - #37468

Open
matthewcosier wants to merge 1 commit into
pingdotgg:mainfrom
matthewcosier:fix/acp-read-image-preview
Open

matthewcosier wants to merge 1 commit into
pingdotgg:mainfrom
matthewcosier:fix/acp-read-image-preview

Conversation

@matthewcosier

@matthewcosier matthewcosier commented Nov 16, 2026 •

Copy link
Copy Markdown

Problem

When an ACP agent reads an image, the Read row in the work log shows no thumbnail. Expanding it shows only the path and the agent's text result (for Antigravity, View front.png), and the group has no viewed-image strip. The same read in a Claude or Codex thread shows the image and opens the full-size preview on click.

The ACP adapter builds Read items without viewedImagePath. Claude (ClaudeAdapterV2.ts) and Codex (CodexAdapterV2.ts) set it, and everything downstream (projection, wire, both clients) keys only on that field. Antigravity also never returns the image bytes, only a line of text, so the field is the only way the client can find the image.

Found in a real Antigravity thread. The projected Read items for the same file in an Antigravity thread and a Claude thread (paths shortened):

Antigravity: { toolName: "Read", input: { file_path: "/…/front.png", start_line: 0, end_line: 799 }, output: "View front.png" }
Claude:      { toolName: "Read", viewedImagePath: "/…/front.png", input: { file_path: "/…/front.png" }, output: { content: [ { type: "image", … } ] } }

Change

The ACP adapter's read case sets viewedImagePath when the read path has an image extension, with the same guards as the Claude adapter (at most 4096 characters, no newline). That covers every ACP-based provider: Antigravity, Kiro, Grok, fx and the ACP Registry agents.

The fidelity test's mock agent gains an image read in the shape Antigravity sends (file_path plus line range, text-only result). The test asserts that the image read carries viewedImagePath and that the existing .ts read does not.

Not changed: ACP subagent child threads project their tools generically (no Read title or label at all). That is a separate gap.

Scope

A small fix for an obvious bug: image previews work for Claude and Codex reads but not for ACP reads, and the field that drives them was never set on the ACP path. No issue filed.

Verification

  • Red with the adapter change reverted, in projects ACP v2 fidelity updates into first-class orchestration items:

    AssertionError: expected { …(3) } to deeply equal { …(3) }
    -   "viewedImagePath": "/workspace/mockup.png",
    +   "viewedImagePath": undefined,
    

    Title and input already matched. Only the missing field failed.

  • Green: AcpAdapterV2.test.ts and AntigravityAdapterV2.test.ts, 148 of 148 pass.

  • vp run check:changed passes (format, lint, knip, typecheck of 14 packages, tests).

  • Checked by reading the code that nothing downstream depends on the provider: ProjectionStore treats any payload with viewedImagePath as inline work output, and client-runtime toolPresentation reads it with no driver check. formatToolValue hides only image-block outputs, so Antigravity's text result still shows beneath the thumbnail.

  • Real Antigravity turns (Gemini 3.8 Flash) against vp run dev, same prompt each time ("Open dashboard-mockup.png and describe its layout in one sentence."). The first ran with the adapter change reverted, the second with it applied. The projected Read items:

    base: viewedImagePath = <none>
    fix:  viewedImagePath = /Users/Shared/t3-acp-preview-demo/dashboard-mockup.png
    

Evidence

Before: the expanded Read row shows only the path and Antigravity's text result. No thumbnail, and no viewed-image strip under the group.

Before: Antigravity Read row with only the path and 'View dashboard mockup', no thumbnail

After: the image Antigravity read shows as a thumbnail below the tool group.

After: thumbnail of the mockup below the Antigravity tool group

Clicking the thumbnail opens the existing full-size preview:

After: full-size image preview opened from the thumbnail

Made with Claude Opus 5.5 in Claude Code, running in T3 Code.

The ACP adapter built Read items without viewedImagePath, so an image read by
Antigravity, Kiro, Grok, fx or an ACP Registry agent showed only its path and
the agent's text result, with no thumbnail. Set it on image reads, as the
Claude and Codex adapters already do.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 16, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 5bac638

Macroscope's review found this PR approvable — ACP image reads now use the existing image-preview presentation, including when agents return only text. The change is narrowly scoped and retains path-length, newline, and image-extension guards.

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

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The ACP fidelity scenario now emits an image-read update. The adapter conditionally projects an eligible image path as viewedImagePath, and the fidelity test checks the text-file and image-read projections.

Changes: ACP image-read projection

Layer / File(s) Summary
Project and verify image-read paths
apps/server/scripts/acp-mock-agent.ts, packages/provider-acp/src/server/adapter.ts, apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
The fidelity scenario emits a completed image read. The adapter adds viewedImagePath when the path meets its validation checks. The test checks the text-file and image-read items, including their inputs and viewed-image paths.

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

Change: Bug fix

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · up to 5bac6

ACP agents that read images now get a preview, matching the Claude and Codex behavior. No concrete risk remains, and the change is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: ACP agent image reads now get a preview. It follows the conventional commit form (fix(server)) and matches the adapter change that sets viewedImagePath for image reads…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the problem, the change, the scope, and the verification in detail. It shows a red-then-green test run, live Antigravity before/after data, and screenshots. It uses the template…
Full details: Title check

Explanation

The title names the main change: ACP agent image reads now get a preview. It follows the conventional commit form (fix(server)) and matches the adapter change that sets viewedImagePath for image reads. The title is short and specific.

Full details: Description check

Explanation

The description states the problem, the change, the scope, and the verification in detail. It shows a red-then-green test run, live Antigravity before/after data, and screenshots. It uses the template's section headings. The template asks for a model and harness attribution at the end, and the author gives one (Claude Opus 5.5 in Claude Code, running in T3 Code). The title is not part of this check. The description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0813f49 and 5bac638.

Files selected for processing: 3

  • apps/server/scripts/acp-mock-agent.ts
  • apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
  • packages/provider-acp/src/server/adapter.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
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 Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant