mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #529] [CLOSED] serve: an image in an Anthropic tool_result reaches the encoder (Claude Code's Read of a picture) #2678
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#2678
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/529
Author: @sergqwer
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:pr/tool-result-images📝 Commits (2)
8a9b474serve: an image in an Anthropic tool_result reaches the encoder (Claude Code's Read of a picture)8ef230bserve: a tool's picture the server cannot read becomes a note, not a 400📊 Changes
3 files changed (+91 additions, -4 deletions)
View changed files
📝
serve/frontend.py(+10 -4)📝
serve/server.py(+24 -0)📝
serve/test_server.py(+57 -0)📄 Description
Claude Code returns a picture it opens with
Read(a screenshot, a diagram) as an image block inside atool_result.anthropic_to_messagesturned everytool_resultinto its text (_text_of), so the image never reached the encoder and the model described a picture it had not seen. A user's own pasted image (an image block at the top level of a user message) already worked; only the tool path lost it.Fix (
serve/frontend.py,anthropic_to_messages):tool_result's content goes through_parts_of, as the OpenAI path'stoolmessages already do; the chat template renders the image item inside<tool_response>(itsrender_contenthandles images in any role);Test:
ImageMarkers.test_anthropic_tool_result_image: an image alone, after text, beside a text tool result, and in both places; it counts the image tokens and checks where they land. It fails on main (0 image tokens instead of 3) and passes here. All serve tests: 159 OK (7 skipped), on 0.1.36.End to end (Windows, RTX 5090, Flash-Next with the CPU encoder, Claude Code asked to
Reada PNG with known text and shapes):🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.