fix: accept Anthropic tool_reference blocks as text - #152
Merged
caigee-cmd merged 2 commits intoSep 14, 2026
Conversation
Claude Code's tool search returns tool_reference blocks inside tool_result content. The translator rejected unknown block types with a 400, which hard locks the session because the block stays in the conversation history. Render tool_reference as a "Tool available: <name>" text line instead.
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.
Summary
tool_referenceblocks insidetool_resultcontent, e.g.{"type":"tool_result","tool_use_id":"toolu_1","content":[{"type":"tool_reference","tool_name":"TaskStop"}]}.400 messages[N]: content[i].content: content[j] type "tool_reference" is not supported. Because the block stays in the conversation history, the session hard-locks: every subsequent request fails with the same 400.tool_referenceas aTool available: <name>text line (withunknownas the fallback whentool_nameis absent) instead of rejecting the request. The Qoder upstream has no equivalent block, so text is the lossless-enough representation.Test plan
go test ./...(translate + api packages run against this commit)go vet ./...cd worker && npm testcd frontend && npm run build && npm run lintVerified end to end against a live Claude Code session with
ENABLE_TOOL_SEARCH=true: the request that previously 400'd now returns200 end_turnand the model answers using the referenced tool name.