Repository navigation
Description
Summary
google/gemini-3.1-pro-preview (thinkingLevel: high) reliably hangs after a few tool-call rounds in any flow where conversation history was authored by a different provider/model — e.g. subagents spawned from a Claude or GPT orchestrator. Failure mode: gateway logs LLM idle timeout (600s): no response from model and the run dies. Trivial single-turn calls to the same model with the same key work in 3 seconds.
This is the bug reported in #74244 and #72127 (and several earlier #58235, #63397). All were autoclosed by the clawsweeper bot citing a "no longer reproducible" or "already fixed" rationale. Original reporter @YouFoundJK pushed back in #74244 with a screenshot reproduction on gemini-3.1-pro-preview and posted a verified-working blueprint fix on 2026-04-29. No human maintainer ever responded; no PR was opened. The bug persists in 2026.5.3-1, which is the current latest stable release.
Status in shipped 2026.5.3-1
The exact code path @YouFoundJK identified as the problem is still present in the shipped dist:
// /app/dist/transport-stream-8H4N10uL.js:211, 231
...isSameProviderAndModel && block.textSignature ? { thoughtSignature: block.textSignature } : {}
...isSameProviderAndModel && block.thoughtSignature ? { thoughtSignature: block.thoughtSignature } : {}isSameProviderAndModel gates signature forwarding. For any conversation where assistant turns were authored by a different provider or model than the one currently being called (subagents, model switches, fallback chains), thoughtSignature is silently dropped from the outbound functionCall parts. Gemini 3.x then hangs (per Google docs, missing-signature should be a 400 INVALID_ARGUMENT, but in practice it manifests as a silent stall).
The recommended fallback string "skip_thought_signature_validator" (per Google's thought-signatures docs) is not present anywhere in /app/dist/ of 2026.5.3-1, so neither the original-signature path nor the fallback path covers cross-provider replay.
Reproduction fingerprint (5 captured runs)
Five subagent runs on google/gemini-3.1-pro-preview with thinkingLevel: high and a multi-step exec-tool task. All five hung identically. Captured directly from gateway-persisted JSONL transcripts:
| run | assistant turns | tool calls | thinking blocks | blocks with thoughtSignature |
<think> text tags |
terminal error |
|---|---|---|---|---|---|---|
| 1 | 3 | 3 | 2 | 0 | 0 | LLM idle timeout (600s) |
| 2 | 4 | 4 | 1 | 0 | 0 | LLM idle timeout (600s) |
| 3 | 3 | 2 | 2 | 0 | 0 | request timed out |
| 4 | 15 | 15 | 4 | 0 | 0 | LLM idle timeout (600s) |
| 5 | 5 | 5 | 2 | 0 | 0 | LLM idle timeout (600s) |
Persisted gateway error record from one run:
{
"type": "custom",
"customType": "openclaw:prompt-error",
"data": {
"provider": "google",
"model": "gemini-3.1-pro-preview",
"api": "google-generative-ai",
"error": "LLM idle timeout (600s): no response from model"
}
}Every persisted thinking content block in the failing transcripts has type: "thinking" (native, not text-tagged), 300–600 chars of text, and no signature / thoughtSignature / thinkingSignature field on the persisted block.
What was checked / ruled out
- No HTTP proxy.
HTTP_PROXY/HTTPS_PROXYare unset on both host and gateway, so [Bug]: CLI and WebUI silent failure/hang when calling Gemini via HTTP proxy (v2026.4.21) #70453 / commitca620fb(env-proxy provider routing, shipped in 2026.5.3-1) does not apply. - Not the
<think>text-tag bug from Gemini text-tag reasoning conflicts with native thinking — produces unclosed <think>, empty post-tool turn, payloads=0 #69220. No<think>/</think>/<final>tags appear anywhere in the failing transcripts; the model is emitting native thinking parts, not text-tagged ones. (Note:BUILTIN_REASONING_OUTPUT_MODES["google-generative-ai"] = "tagged"is still in/app/dist/provider-utils-*.js, so Gemini text-tag reasoning conflicts with native thinking — produces unclosed <think>, empty post-tool turn, payloads=0 #69220 may still bite other users on lower thinking levels.) - Not auth / quota / billing. A trivial single-turn probe to
gemini-3.1-pro-preview(one-word reply, no tools) returns in 3s. - Not the surrounding pipeline. The same orchestrator → subagent code path with
claude-opus-4-7instead of Gemini completes cleanly with similar tool-call counts. Two such transcripts captured (11 assistant turns, 18 tool calls, 6–8 thinking blocks each, no errors).
This narrows the failure to the Gemini transport's outbound serialization of cross-provider assistant history — exactly what @YouFoundJK identified.
Asks
- Re-open [Bug]: Gemini API error (400): missing
thought_signature#74244 (or supersede with this one). The clawsweeper autoclose was incorrect — code review missed theisSameProviderAndModelgate that strips signatures on cross-provider replay, and ignored the original reporter's request for human verification. Consider requiring a human re-check before autoclosing Gemini 3.x bug reports going forward. - Land @YouFoundJK's blueprint fix (or an equivalent maintainer-cleaned version) covering all three gaps:
transport-message-transform.ts— stop strippingthoughtSignaturefrom cross-provider history; let downstream transports decide.transport-stream.ts— always includethoughtSignatureonfunctionCallparts; use"skip_thought_signature_validator"fallback (per Google docs) when no captured signature is available.openai-transport-stream.ts— collect signatures from all history (not just same-model).
- Make the failure mode loud. A silent 600 s idle timeout with no diagnostic about a known protocol gap is very hard to root-cause downstream. Either surface Google's
400 INVALID_ARGUMENT: missing thought_signatureto the gateway log/error path, or fast-fail when an outbound Gemini call would emit afunctionCallpart with no signature.
Environment
- OpenClaw
2026.5.3-1(release tag, latest stable as of 2026-05-04) google/gemini-3.1-pro-previewvia Google AI Studio API key (no Vertex, no proxy)- Linux container, Node
24.14.0 thinkingDefault: mediumglobally; the affected reviewer agents run withthinkingLevel: high
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 4, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Summary
Keep open: current main still has source-level paths that drop or omit Gemini
thoughtSignatureduring cross-provider/native replay, and the overlapping open PR #75713 is not merged and appears to cover only part of the gap reported here.Reproducibility: yes. by source inspection rather than live execution: current main can carry a Gemini-targeted assistant
toolCallto native or OpenAI-compatible Google replay without athoughtSignature, matching Google's documented 400 path and the reporter's timeout transcripts.Next step
An overlapping open PR exists, but this issue identifies cross-provider transport gaps that may need maintainer-directed extension or replacement rather than a second uncoordinated repair PR.
Review details
Best possible solution:
Land one focused repair that preserves real Gemini signatures through replay boundaries, uses Google's sentinel only for unsigned transferred function-call history, and adds regression coverage for native Google plus OpenAI-compatible cross-provider replay.
Do we have a high-confidence way to reproduce the issue?
Yes, by source inspection rather than live execution: current main can carry a Gemini-targeted assistant
toolCallto native or OpenAI-compatible Google replay without athoughtSignature, matching Google's documented 400 path and the reporter's timeout transcripts.Is this the best way to solve the issue?
Yes on direction: fixing the replay serialization/sanitization boundary is the narrow maintainable solution, but the open PR should be reviewed against this issue because it appears incomplete for the cross-provider gates.
Acceptance criteria:
What I checked:
transformTransportMessagescomputes same-provider/API/model identity, converts foreign thinking/text to plain text, and deletestoolCall.thoughtSignaturefrom non-matching assistant history before transport replay. (src/agents/transport-message-transform.ts:67, f042b53782d9)buildGoogleGenerativeAiParamsattachesthoughtSignaturetofunctionCallparts only whenisSameProviderAndModelis true, so a transferred or model-switched assistant tool call can serialize without a signature. (extensions/google/transport-stream.ts:412, f042b53782d9)injectToolCallThoughtSignaturesonly collects signatures from assistant history whose API, provider, and model all match the current model; tests also assert no cross-API replay and noextra_contentwhen no signature was captured. (src/agents/openai-transport-stream.ts:1784, f042b53782d9)sanitizeSessionHistoryreturns provider-sanitized history directly or after Google turn ordering; the current Google helper only exposes API/model helpers and turn ordering, with noskip_thought_signature_validatorsentinel repair on main. (src/agents/pi-embedded-runner/replay-history.ts:713, f042b53782d9)skip_thought_signature_validatoras a last-resort dummy signature.thought_signature#74244 discussion includes YouFoundJK's follow-up after the bot close plus a blueprint naming the same three gaps: transform stripping, native Google transport gating/fallback, and OpenAI-compatible same-model collection.Likely related people:
src/agents/pi-embedded-runner/replay-history.ts,src/agents/transcript-policy.ts,extensions/google/transport-stream.ts)src/agents/transcript-policy.ts)extensions/google/transport-stream.ts,extensions/google/transport-stream.test.ts)extensions/google/transport-stream.ts,extensions/google/transport-stream.test.ts)Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against f042b53782d9.
Re-review progress:
jrex-jooni commentedon May 5, 2026
Did a deeper code dive. The gap clawsweeper noted between this issue and PR #75713 is real — three separate cross-provider drop points strip real signatures before #75713's sanitizer runs:
src/agents/transport-message-transform.ts:97-99(explicitdelete normalizedToolCall.thoughtSignature)extensions/google/transport-stream.ts:449-451(isSameProviderAndModelgate)src/agents/openai-transport-stream.ts:1784(injectToolCallThoughtSignaturesskips non-exact-match)Confirmed in shipped 2026.5.3-1. Posted full source-cited analysis with suggested layering on top of @YouFoundJK's #74244 blueprint over on PR #75713. Glad to send a follow-up PR once a maintainer signals which path they prefer.
bo-blue commentedon May 5, 2026
Confirming this affects
google/gemini-3-flash-previewas well as thegemini-3.1-pro-previewalready discussed — same failure mode, sameLLM idle timeout (120s): no response from model, same recovery path via/new. Worth tightening the title's "Gemini 3.x" scope statement to make the flash-preview branch explicit.Reproduction on shipped 2026.5.3-1 in a Telegram channel session today (2026-05-04, US/Pacific): bare text calls to⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session." That generic Telegram error is tracked separately as #74822 — same root cause, two issue surfaces. Likely a single fix closes both.
gemini-3-flash-previewreturn cleanly in ~1s, but multi-turn flows with image inputs and mixed-provider conversation history hang at exactly 120s on repeat, eventually surfacing to the user as "steipete commentedon May 7, 2026
Fixed on current main in 85b914a.
Proof:
extensions/google/transport-stream.tsnow emits Google’s documentedskip_thought_signature_validatorfallback for Gemini 3 cross-provider tool-call replay when no reusable same-route signature exists.src/agents/openai-transport-stream.tsapplies the same fallback for Google OpenAI-compatible Gemini 3 tool-call replay.extensions/google/transport-stream.test.tsandsrc/agents/openai-transport-stream.test.ts.Closing as fixed.