fix: preserve thought_signature on tool call parts for Gemini 3#811
Merged
fix: preserve thought_signature on tool call parts for Gemini 3#811
Conversation
The thinking signature was only preserved for Anthropic's namespace, causing Gemini 3 models to fail with "Function call is missing a thought_signature" on the second turn of tool-calling conversations. - Extract signature from google.thoughtSignature and vertex.thoughtSignature - Store signatureProvider to restore the correct namespace on output - Add tests for Google and Vertex signature extraction Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous fix only handled thought_signature on reasoning parts, but Gemini 3 also requires thought_signature on functionCall parts in the conversation history. This was the actual root cause of the "Function call is missing a thought_signature" error. - Add providerMetadata field to ToolCallPart schema - Preserve providerMetadata from AI SDK tool call results - Pass providerMetadata as providerOptions when converting back to AI SDK messages Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Follow-up to #809. The previous fix handled thought_signature on reasoning parts, but Gemini 3 also requires thought_signature on functionCall parts in the conversation history. This was the actual root cause.
providerMetadatafield toToolCallPartschema to store provider-specific metadata (e.g., Google'sthoughtSignature)providerMetadatafrom AI SDK tool call results when building tool call partsproviderMetadataasproviderOptionswhen converting back to AI SDK messagesTest plan
bun run typecheckpasses (24/24)bun run testpasses (all packages)🤖 Generated with Claude Code