-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Gemini text-tag reasoning conflicts with native thinking — produces unclosed <think>, empty post-tool turn, payloads=0 #69220
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
OpenClaw 2026.4.14 (and prior 2026.4.x) hardcodes
google-generative-aito tagged reasoning output mode indist/provider-utils-CWYcvxhN.js:taggedmode injects this directive into the system prompt (viadist/system-prompt-mHpoeHEN.js:358-367):But Gemini
2.5-pro/2.5-flashalso receivethinkingConfig: { includeThoughts: true, thinkingBudget|thinkingLevel: ... }fromresolveGoogleThinkingConfigindist/anthropic-vertex-stream-YyrYtvts.js:5385, which enables native thought parts in the response.Failure mode
When prompts are long/persona-heavy (PM cron loops, devsecops loops), the model:
thought:truepart (3000+ chars)<think>text block per the directive</think>and never emits<final>content: []Gateway then logs:
The user sees an error message, but the model has already burned ~140K input tokens for nothing. In our environment this added up to ~$20 USD of wasted spend in a few hours on Gemini 2.5 Pro before we caught it.
Reproduction
google/gemini-2.5-proorgoogle/gemini-2.5-flashwiththinkingDefault: mediumWe have several reproducible session jsonls if helpful — pattern is consistent: one
thinkingcontent block, then atextblock beginning<think>(no closing tag, no<final>), then atoolCall, then an empty assistant turn.Proposed fix
Drop
google-generative-aifromBUILTIN_REASONING_OUTPUT_MODES. Gemini already exposes native thinking viathoughtSignature/thought:trueparts and thethinkingConfigrequest field — there is no need for tagged reasoning, and combining both confuses the model.We've patched the dist file locally (
{"google-generative-ai": "native"}) and confirmed:Happy to send a PR if useful.
Workaround for others hit by this
If you can't patch the dist file:
Related code