fix(llm): stabilize Gemini 3/2.5 tool calls and thought signature handling - fixes #210#230
Merged
everettjf merged 3 commits intomicroclaw:mainfrom Mar 10, 2026
Merged
fix(llm): stabilize Gemini 3/2.5 tool calls and thought signature handling - fixes #210#230everettjf merged 3 commits intomicroclaw:mainfrom
everettjf merged 3 commits intomicroclaw:mainfrom
Conversation
Contributor
|
Thank you |
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.
This PR addresses several critical issues with the Google OpenAI-compatible Tier, specifically
targeting Gemini 3 models which require strict "thought signature" handling and exhibit
non-standard termination behaviors.
Key Changes:
Forced tool_use Stop Reason:
present in the response.
"tool_use" whenever the tool call map is non-empty. This ensures the agent_engine
correctly triggers the execution turn.
Corrected Thought Signature Handling:
extra_content.google (where Google places it) rather than incorrectly looking inside
the function object.
back in the subsequent turn using the exact nested structure Google requires:
tool_calls[].extra_content.google.thought_signature. Failing to do this results in 400
Bad Request errors on Turn 2.
Improved Stream Chunk Indexing:
id or assigning a new unique index. This prevents tool call chunks from overwriting
each other and ensures all signatures are captured.
Serialization Stability:
non-streaming responses.
ContentBlock types.
Verified using an automated test suite across multiple scenarios that did not work with #211