fix: resolve 400 error due to missing thought_signature in Gemini 3 Pro tool calls #1202
+71
−19
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.
TLDR
This PR fixes a critical bug where using tools (function calls) with
Gemini 3 Pro Previewresulted in an API Error 400. The error was caused by the missingthought_signature, which is required by the Gemini API for tool verification in this model.Dive Deeper
Gemini 3 Pro Previewfailed to execute tool calls, returningUnable to submit request because function call ... is missing a thought_signature.OpenAIContentConverterto extract thethoughtSignaturefrom the streaming response chunks and attach it to the correspondingfunctionCallobject. This ensures the signature is passed back to the API in subsequent requests, satisfying the verification requirement.indexas the key to cachethoughtSignature. This approach ensures robustness becauseidmight not be present in every chunk during streaming or in certain model responses, whereasindexis a reliable identifier for correlating chunks within the stream.Reviewer Test Plan
gemini-3-pro-preview.read_file README.md).API Error 400is resolved.gemini-1.5-pro,gpt-4o) still function correctly with tool calls.Testing Matrix
Linked issues / bugs
Resolves #1187