diff --git a/src/api/transform/__tests__/gemini-format.spec.ts b/src/api/transform/__tests__/gemini-format.spec.ts index 14ab6f8d8f..cb62729391 100644 --- a/src/api/transform/__tests__/gemini-format.spec.ts +++ b/src/api/transform/__tests__/gemini-format.spec.ts @@ -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", }, ], }, diff --git a/src/api/transform/gemini-format.ts b/src/api/transform/gemini-format.ts index bc4dc4aa54..a123226012 100644 --- a/src/api/transform/gemini-format.ts +++ b/src/api/transform/gemini-format.ts @@ -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") {