When using Gemini models with thinkingConfig.includeThoughts: true, multi-turn conversations fail on the second request because thoughtSignature is not preserved from the response.
Google's API requires thought_signature to be sent back in subsequent requests when thinking is enabled. The response includes thoughtSignature in the part metadata, but this is lost when converting response parts to prompt parts for the next turn.
Error on second turn:
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.
https://ai.google.dev/gemini-api/docs/thought-signatures