fix: Remove fallback thoughtSignature to prevent 400 errors with Gemini 3 models

This commit is contained in:
Roo Code 2025-12-24 19:57:45 +00:00
parent 1e71015e54
commit be8ac86165
2 changed files with 5 additions and 5 deletions

View file

@ -107,7 +107,7 @@ describe("convertAnthropicMessageToGemini", () => {
expect(() => convertAnthropicMessageToGemini(anthropicMessage)).toThrow("Unsupported image source type")
})
it("should convert a message with tool use", () => {
it("should convert a message with tool use without thoughtSignature when none exists", () => {
const anthropicMessage: Anthropic.Messages.MessageParam = {
role: "assistant",
content: [
@ -133,7 +133,6 @@ describe("convertAnthropicMessageToGemini", () => {
name: "calculator",
args: { operation: "add", numbers: [2, 3] },
},
thoughtSignature: "skip_thought_signature_validator",
},
],
},

View file

@ -42,10 +42,11 @@ export function convertAnthropicContentToGemini(
// Determine the signature to attach to function calls.
// If we're in a mode that expects signatures (includeThoughtSignatures is true):
// 1. Use the actual signature if we found one in the history/content.
// 2. Fallback to "skip_thought_signature_validator" if missing (e.g. cross-model history).
// 2. Don't use a fallback - only include thoughtSignature if we have a real one.
// The fallback "skip_thought_signature_validator" causes 400 errors with Gemini 3 models.
let functionCallSignature: string | undefined
if (includeThoughtSignatures) {
functionCallSignature = activeThoughtSignature || "skip_thought_signature_validator"
if (includeThoughtSignatures && activeThoughtSignature) {
functionCallSignature = activeThoughtSignature
}
if (typeof content === "string") {