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
This commit is contained in:
Roo Code 2025-11-22 10:36:32 +00:00
parent 2ca9eac9e0
commit d941b6f670

View file

@ -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