From d941b6f67065ac770072bca85f06a978fd7e6489 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sat, 22 Nov 2025 10:36:32 +0000 Subject: [PATCH] fix: include thought signatures for gemini-3-pro native tool calls Gemini 3.0-pro requires thought_signature field in functionCall parts even when reasoning is not enabled. This fix ensures that thought signatures are always included for gemini-3-pro models when using native tool calls to prevent "Function call is missing a thought_signature" errors. Fixes #9499 --- src/api/providers/gemini.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/providers/gemini.ts b/src/api/providers/gemini.ts index 89c816e815..1629d7c115 100644 --- a/src/api/providers/gemini.ts +++ b/src/api/providers/gemini.ts @@ -86,7 +86,11 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl // Only forward encrypted reasoning continuations (thoughtSignature) when we are // using reasoning (thinkingConfig is present). Both effort-based (thinkingLevel) // and budget-based (thinkingBudget) models require this for active loops. - const includeThoughtSignatures = Boolean(thinkingConfig) + // EXCEPTION: Gemini 3.0-pro requires thought signatures for ALL native tool calls, + // even when reasoning is not enabled. + const isGemini3Pro = model.includes("gemini-3-pro") + const hasNativeTools = metadata?.tools && metadata.tools.length > 0 + const includeThoughtSignatures = Boolean(thinkingConfig) || (isGemini3Pro && hasNativeTools) // The message list can include provider-specific meta entries such as // `{ type: "reasoning", ... }` that are intended only for providers like