Bug Report: Google Generative AI API Error (400) - Missing thought_signature on Tool Calls with Gemini models
Description:
When using Gemini models through AI Studio API keys (like google/gemini-flash-latest) with thinking mode enabled (even on low), subsequent tool executions fail with a HTTP 400 error. The API rejects the turn transition because the function call payload returned to the model or processed by the gateway is missing the required thought_signature.
Error Message:
Google Generative AI API error (400): Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `...` [code=INVALID_ARGUMENT]
Steps to Reproduce:
- Configure session to use a Google/Gemini model with thinking enabled (e.g.,
thinking=lowormedium). - Trigger any tool call.
- The tool executes successfully on the host/node, but when the gateway passes the
toolResultback to the Google API to generate the final response, the API returns a 400 error complaining about the missingthought_signaturein thefunctionCallparts.
Expected Behavior:
The gateway should correctly preserve, validate, or bridge the thought_signature returned by Gemini during the initial assistant turn containing the functionCall, and include it when submitting the tool response back to the Google API, or automatically disable/fallback gracefully if the API strict mode is violated.
Version:
Current dev, main branch (2026.5.19, a134683)