mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #819] [CLOSED] frontend: images inside Anthropic tool_result blocks reach the model #2851
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2851
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/819
Author: @christopherrobertbrooks-tech
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:fix/tool-result-images📝 Commits (1)
15baa7afrontend: images inside Anthropic tool_result blocks reach the model📊 Changes
2 files changed (+24 additions, -1 deletions)
View changed files
📝
serve/frontend.py(+7 -1)📝
serve/test_server.py(+17 -0)📄 Description
What happens
Claude Code (and other clients of the Anthropic Messages API) return a Read of an image file as an image block
inside a
tool_result. Strata drops that image, so the model answers about a picture it never saw.Measured on engine 0.1.39, Qwen3.8-Flash-Next Coder IQ1_M, vision on (
--vision gpu), a Tesla V100-PCIE-32GB, through/v1/messageswith thinking disabled. Same screenshot of a dashboard, same question ("list the bar rows in the leftpanel, top to bottom"):
tool_result(how Claude Code sends it)In a real coding-agent session this showed up as the model saying a correct screenshot "came back black", and in another
run as "the window looks right" written without having seen it.
Why
In
serve/frontend.py,anthropic_to_messages()sends a user message to the image path only when it contains notool_result, and thetool_resultbranch builds the tool message with_text_of(block.get("content")), which keepstext and drops image blocks.
The change
After the tool message, the result's image parts follow as a user turn — the chat template shows images in user turns —
with a one-line text marker, "(image returned by the tool above)". Text-only tool results are unchanged.
With the change, the
tool_resultcase answers "Swap, Net, Disk, Data", and in a real agent session the model read itsscreenshot and described the window correctly.
Tests
ClientShapes.test_anthropic_image_inside_a_tool_result_reaches_the_model— fails on 0.1.39, passes with the change.python serve/test_server.py: all tests OK.Not checked: the OpenAI path's
toolmessages with image content (might have the same gap; happy to look if useful).Found while running Strata as the builder of a local coding agent on a V100. The change and this description were drafted
with an AI assistant (Claude), tested on our machine, and reviewed by me.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.