Repository navigation
fix(providers/anthropic): keep metadata on web searches with no results - #65
Merged
Merged
Conversation
Defer synthetic user media until all contiguous tool-result messages have been emitted. OpenAI rejects media inserted between replies to parallel tool calls. Preserve accompanying text and the order of media payloads. Cover both Chat Completions serializers with separate and grouped tool results, two media results, and following conversation messages. > Xum acted on Mike's behalf.
A web_search_tool_result whose content is an empty list carried no WebSearchResultMetadata in Generate or Stream, so consumers could not tell a search that found nothing from a result that cannot be replayed. Coder's chat sanitizer drops provider tool results without that metadata, so these searches vanished from saved history after clients had seen them stream. Attach empty metadata instead. It replays as an empty result list, as the encoder's missing-metadata fallback already did, without the warning. > Xum acted on Mike's behalf.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 9, 2026
fix: fold web searches, answer reasoning, and OpenAI narration into working blocks
coder/coder#30529
Merged
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.
Problem
When an Anthropic web search finds nothing, its
web_search_tool_resultcontent is an empty list, andGenerateandStreamattached noWebSearchResultMetadatato it. Consumers could not tell a search that found nothing from a result that cannot be replayed. coder/coder's chat sanitizer drops provider tool results without that metadata, so these searches vanished from saved chat history after clients had seen them stream.Fix
Attach empty
WebSearchResultMetadatawhen the result list is empty, in bothGenerateandStream. It replays as an empty result list, which is what the encoder's missing-metadata fallback already sent, without the fallback's warning.Validation
TestGenerate_WebSearchNoResultsKeepsMetadataandTestStream_WebSearchNoResultsKeepsMetadatafail with thecoder_2_33anthropic.gooverlaid viago test -overlayand pass with the fix.TestToPrompt_WebSearchNoResultsRoundTripchecks that the empty result replays as an empty list.go build ./...,go test ./..., andgolangci-lint run ./providers/anthropic/...pass.coder_2_33; none are introduced here.The branch merges
coder_2_33in after #64, so a squash merge leaves the single fix.