fix(gemini): prevent 400 by filtering proxy-generated IDs from thought_signature
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled

- Only restore thought_signature if the tool call ID doesn't start with 'call_'.
- This ensures proxy-generated UUIDs are never sent back to Gemini as signatures, which was causing base64 decoding failures.
This commit is contained in:
2026-03-05 16:49:56 +00:00
parent 8a33b147f1
commit 5bbd5f77b9

View File

@@ -309,8 +309,10 @@ impl GeminiProvider {
let args = serde_json::from_str::<Value>(&tc.function.arguments)
.unwrap_or_else(|_| serde_json::json!({}));
// RESTORE: Use tc.id as thought_signature if it was originally one
let thought_signature = if tc.id.starts_with("sig_") || !tc.id.contains('-') {
// RESTORE: Use tc.id as thought_signature if it was originally one.
// We skip our own generated IDs (which start with 'call_')
// because they are not valid base64-encoded Gemini signatures.
let thought_signature = if !tc.id.starts_with("call_") {
Some(tc.id.clone())
} else {
None