fix: repair Anthropic native tool traces bug#42
Merged
Merged
Conversation
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
Fix native web search protocol handling so Anthropic server-side tools are not confused with local MCP tools, and tool traces keep request and response details consistently.
Anthropic native tools are now classified separately from MCP tools. If an Anthropic-compatible upstream returns a native tool such as
web_searchas a client-sidetool_use, the run now fails with a clear protocol error instead of trying to execute it through MCP. Anthropic server-side tool result blocks are also merged into the same trace entry, with opaque encrypted result fields removed. OpenAI Responses web search now requestsweb_search_call.action.sourcesby default, and the frontend trace renderer shows web search request and response sections consistently.Change type
Affected areas
Verification
cd backend && go test ./internal/infra/llmcd backend && go test ./internal/application/conversationcd backend && go test ./...cd frontend && pnpm lint features/chat/components/message/message-process-trace.tsxcd frontend && pnpm buildgit diff --checkScreenshots, API examples, or logs
Reported failure before the fix:
tool web_search is not enabled for this runThe failure was caused by an Anthropic-compatible upstream returning a Claude native server-side tool as a client-side
tool_use.Configuration, migration, and compatibility notes
Configuration changes: None.
API changes: No public API contract changes. Internal provider protocol handling and trace payloads were improved.
Database migrations: None.
Deployment changes: None.
Backward compatibility: Existing conversations remain readable. New runs now separate native provider tools from local MCP tools more strictly and produce clearer errors for invalid upstream protocol behavior.
Documentation
Security and privacy
Checklist
.pycfiles,.envfiles, and local storage data are not committed.