Render images in agent threads - #46167
Merged
Merged
Conversation
Contributor
rtfeldman
force-pushed
the
agent-panel-images
branch
from
January 6, 2026 16:16
cd7f0e8 to
02056a5
Compare
rtfeldman
force-pushed
the
agent-panel-images
branch
from
January 6, 2026 16:38
670a561 to
b95401c
Compare
- Use AgentPanel instead of bare AcpThreadView for full UI chrome - Add test-only methods to AgentPanel for injecting stub server - Add StubModelSelector to show model dropdown in tests - Load assets so icons render properly - Dismiss onboarding banner before screenshots - Update docs to clarify baselines are gitignored
- Use include_bytes! for test image instead of reading from disk at runtime - Extract create_test_png_base64 to acp_thread's test_support module for reuse - Make StubModelSelector private (only exposed via Rc<dyn AgentModelSelector>) - Add doc comments to AgentPanel test helpers explaining they're test-only - Add explicit error if tool_call_id is None instead of silently skipping - Add module-level docs for test_support explaining its purpose and gating Amp-Thread-ID: https://ampcode.com/threads/T-019b945e-1dd3-734d-97ea-a28c49446512 Co-authored-by: Amp <amp@ampcode.com>
The visual test already covers this functionality with better end-to-end coverage.
- Add db/test-support to visual-tests feature so KEY_VALUE_STORE uses an in-memory database instead of the real user database - Remove the workaround that was writing to a non-existent key
The visual test works because it uses stubbed data, but in production: 1. The read_file tool description doesn't mention image support 2. Image output is shown as JSON instead of rendered because the tool only sends acp content for text results, not images
- Add agent/test-support, language_model/test-support, fs/test-support to visual-tests feature - Rewrite run_agent_thread_view_test() to actually run the real ReadFileTool - Capture tool events via ToolCallEventStream::test() and use real output - Test now fails if tool code is broken (verified by temporarily commenting out event_stream.update_fields) - Remove unused base64 dependency from visual-tests feature
…l tests - Images in tool calls are no longer auto-expanded (collapsed by default like other tool calls) - Remove collapsed_image_tool_calls field since it's no longer needed - Add two visual tests: agent_thread_with_image_collapsed and agent_thread_with_image_expanded - Both tests verify the real ReadFileTool output is used
Replace multiple if-let statements with one big match on (self, block) tuple. Also make block_string_contents a static method since it doesn't use self.
rtfeldman
marked this pull request as ready for review
January 7, 2026 00:48
pull Bot
pushed a commit
to sipsuru/zed-winbuild
that referenced
this pull request
May 19, 2026
Turns out we were creating an ImageDecoder on every frame (added in zed-industries#46167) when a tool returned an image as output, because we were trying to get its dimensions. That is now cached on `ContentBlock::Image`. Release Notes: - N/A
TomPlanche
pushed a commit
to TomPlanche/zed
that referenced
this pull request
May 20, 2026
Turns out we were creating an ImageDecoder on every frame (added in zed-industries#46167) when a tool returned an image as output, because we were trying to get its dimensions. That is now cached on `ContentBlock::Image`. Release Notes: - N/A
TomPlanche
pushed a commit
to TomPlanche/zed
that referenced
this pull request
Jun 2, 2026
Turns out we were creating an ImageDecoder on every frame (added in zed-industries#46167) when a tool returned an image as output, because we were trying to get its dimensions. That is now cached on `ContentBlock::Image`. Release Notes: - N/A
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
Now when the agent reads images (which the tool now explicitly advertises to agents that it is capable of; previously the tool said it could only read text even though it can actually read images), we see them in the thread, and also they are auto-expanded by default so you can see them when scrolling through: <img width="725" height="1019" alt="Screenshot 2026-01-06 at 2 57 11 PM" src="https://github.com/user-attachments/assets/5c908bad-48f2-46c2-afaa-7f189a178e05" /> This also adds a visual regression test that verifies images render correctly in the agent thread view. Unlike our previous visual tests, this one only renders the agent panel, not the entire Zed window. The "screenshot" it generates (rendered to a Metal texture) is from completely mocked/simulated data structures, and looks like this: <img width="546" height="984" alt="Screenshot 2026-01-06 at 2 54 41 PM" src="https://github.com/user-attachments/assets/89a0921f-59e9-4dfe-94b2-4c3b625a851b" /> ## Changes - **New visual test**: `agent_thread_with_image` renders an `AcpThreadView` containing a tool call with image content (the Zed app icon) - **Test infrastructure**: Added `StubAgentServer` helper and required feature flags for visual testing - **Test-support API**: Added `expand_tool_call()` method to `AcpThreadView` to allow expanding tool calls for visual testing - **Baseline screenshot**: Included baseline image showing the Zed logo rendered in a tool call output ## How to run ```bash # Run the visual tests cargo run -p zed --bin visual_test_runner --features visual-tests # Update baselines if UI intentionally changed UPDATE_BASELINE=1 cargo run -p zed --bin visual_test_runner --features visual-tests ``` Release Notes: - N/A --------- Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com>
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
Turns out we were creating an ImageDecoder on every frame (added in zed-industries#46167) when a tool returned an image as output, because we were trying to get its dimensions. That is now cached on `ContentBlock::Image`. Release Notes: - N/A
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
Now when the agent reads images (which the tool now explicitly advertises to agents that it is capable of; previously the tool said it could only read text even though it can actually read images), we see them in the thread, and also they are auto-expanded by default so you can see them when scrolling through: <img width="725" height="1019" alt="Screenshot 2026-01-06 at 2 57 11 PM" src="https://github.com/user-attachments/assets/5c908bad-48f2-46c2-afaa-7f189a178e05" /> This also adds a visual regression test that verifies images render correctly in the agent thread view. Unlike our previous visual tests, this one only renders the agent panel, not the entire Zed window. The "screenshot" it generates (rendered to a Metal texture) is from completely mocked/simulated data structures, and looks like this: <img width="546" height="984" alt="Screenshot 2026-01-06 at 2 54 41 PM" src="https://github.com/user-attachments/assets/89a0921f-59e9-4dfe-94b2-4c3b625a851b" /> ## Changes - **New visual test**: `agent_thread_with_image` renders an `AcpThreadView` containing a tool call with image content (the Zed app icon) - **Test infrastructure**: Added `StubAgentServer` helper and required feature flags for visual testing - **Test-support API**: Added `expand_tool_call()` method to `AcpThreadView` to allow expanding tool calls for visual testing - **Baseline screenshot**: Included baseline image showing the Zed logo rendered in a tool call output ## How to run ```bash # Run the visual tests cargo run -p zed --bin visual_test_runner --features visual-tests # Update baselines if UI intentionally changed UPDATE_BASELINE=1 cargo run -p zed --bin visual_test_runner --features visual-tests ``` Release Notes: - N/A --------- Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com>
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
Turns out we were creating an ImageDecoder on every frame (added in zed-industries#46167) when a tool returned an image as output, because we were trying to get its dimensions. That is now cached on `ContentBlock::Image`. Release Notes: - N/A
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now when the agent reads images (which the tool now explicitly advertises to agents that it is capable of; previously the tool said it could only read text even though it can actually read images), we see them in the thread, and also they are auto-expanded by default so you can see them when scrolling through:
This also adds a visual regression test that verifies images render correctly in the agent thread view.
Unlike our previous visual tests, this one only renders the agent panel, not the entire Zed window.
The "screenshot" it generates (rendered to a Metal texture) is from completely mocked/simulated data structures, and looks like this:
Changes
agent_thread_with_imagerenders anAcpThreadViewcontaining a tool call with image content (the Zed app icon)StubAgentServerhelper and required feature flags for visual testingexpand_tool_call()method toAcpThreadViewto allow expanding tool calls for visual testingHow to run
Release Notes: