openclaw - 💡(How to fix) Fix [Request]: Backport fix for Gemma 4 reasoning_content replay bug (#68704) to v2026.5.x stable [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77275Fetched 2026-05-05 05:50:16
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
labeled ×2closed ×1commented ×1

Issue #68704 was fixed in commit 556c3e8 and merged to main, but has not been backported to stable. Users on v2026.5.2 (current stable) are still affected — after 3–5 turns with reasoning enabled, agent responses become incoherent due to prior-turn thinking blocks being re-sent to the LM Studio OpenAI-compat Gemma 4 endpoint.

Root Cause

Root cause (supported by commit diff): Commit 2fd1e7b added normalizeLmstudioTransportReasoningCompat() which enables reasoning_effort round-trip for all LM Studio models. For Gemma 4, this causes prior-turn thinking blocks to be included in replay messages. LM Studio's OpenAI-compat Gemma 4 endpoint silently rejects or mishandles these blocks, corrupting message history.

Fix Action

Fix / Workaround

Workaround: /reasoning off (with LM Studio Reasoning Parsing still ON) prevents corruption. Agent still reasons internally; OpenClaw simply does not manage the thinking blocks.

Affected: Users running OpenClaw with LM Studio + Gemma 4 models (any variant) on v2026.5.2. Severity: High — agent produces hallucinated or context-mismatched responses, making the model unusable for multi-turn conversations. Frequency: Always reproducible after 3–5 turns with reasoning enabled. Consequence: Effectively blocks use of Gemma 4 via LM Studio until workaround (/reasoning off) is applied or 556c3e8 is released in stable.

Request: Please backport 556c3e8 to a v2026.5.x patch release.

Code Example

Version comparison (cross-version control):
- v2026.4.26: Qwen 3.6 35B (LM Studio) — reasoning NOT displayed. Gemma 4 26B — reasoning NOT displayed. No context corruption on either.
- v2026.5.2: Qwen 3.6 35B — reasoning NOW displayed (new). Gemma 4 26B — reasoning still NOT displayed. Context corruption appears on Gemma 4.

The Qwen change confirms commit 2fd1e7b ("fix: normalize LM Studio binary reasoning efforts") introduced a universal normalize layer affecting all LM Studio local models — not Gemma-specific.

Related upstream fix (not yet in stable release):
- Commit 556c3e8 "fix(agents): strip Gemma reasoning from local replay" (v2026.5.4-beta.1) — adds dropReasoningFromHistory policy for isStrictOpenAiCompatible + isGemma4ModelRequiringReasoningStrip models.

Session snapshot:
- OpenClaw v2026.5.2 (8b2a6e5)
- Model: lmstudio/gemma-4-26b-a4b-it
- Think: high · elevated
- Context grew from 21%22% (55k–104k tokens) across observed sessions
- Compactions: 0
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Issue #68704 was fixed in commit 556c3e8 and merged to main, but has not been backported to stable. Users on v2026.5.2 (current stable) are still affected — after 3–5 turns with reasoning enabled, agent responses become incoherent due to prior-turn thinking blocks being re-sent to the LM Studio OpenAI-compat Gemma 4 endpoint.

Steps to reproduce

  1. Set up OpenClaw with LM Studio provider, model: google/gemma-4-26b-a4b-it (or similar Gemma 4 variant).
  2. Enable reasoning: /reasoning on (or leave at default with Think: high).
  3. Keep LM Studio's Reasoning Parsing enabled in Inference settings.
  4. Send 3–5 messages in a single session.
  5. Observe agent responses become incoherent — answers reference unrelated content from earlier turns instead of the current message.

Workaround: /reasoning off (with LM Studio Reasoning Parsing still ON) prevents corruption. Agent still reasons internally; OpenClaw simply does not manage the thinking blocks.

Expected behavior

Prior-turn thinking blocks should be stripped from replay history before being sent to the LM Studio Gemma 4 endpoint, as Gemma 4's OpenAI-compat API does not accept reasoning_content in conversation history. On v2026.4.26, Gemma 4 worked correctly (reasoning blocks were not injected). Commit 556c3e8 implements this stripping policy for main; backporting to v2026.5.x stable should restore correct behavior.

Actual behavior

After 3–5 turns with reasoning enabled, agent responses become incoherent — the model pattern-matches from stale earlier turns instead of responding to the current message. The context window grows normally (21%→22%), but response content references unrelated earlier conversation content. Disabling /reasoning off stops the corruption immediately.

OpenClaw version

v2026.5.2 (8b2a6e5)

Operating system

WSL2 Ubuntu on Windows 11

Install method

npm global

Model

lmstudio/gemma-4-26b-a4b-it

Provider / routing chain

openclaw -> LM Studio (OpenAI-compat local endpoint)

Additional provider/model setup details

Provider config: LM Studio local server at http://localhost:1234/v1, api: openai-responses, reasoning: true. Model entry: { id: "google/gemma-4-26b-a4b-it", reasoning: true, input: ["text", "image"] }

Logs, screenshots, and evidence

Version comparison (cross-version control):
- v2026.4.26: Qwen 3.6 35B (LM Studio) — reasoning NOT displayed. Gemma 4 26B — reasoning NOT displayed. No context corruption on either.
- v2026.5.2: Qwen 3.6 35B — reasoning NOW displayed (new). Gemma 4 26B — reasoning still NOT displayed. Context corruption appears on Gemma 4.

The Qwen change confirms commit 2fd1e7b ("fix: normalize LM Studio binary reasoning efforts") introduced a universal normalize layer affecting all LM Studio local models — not Gemma-specific.

Related upstream fix (not yet in stable release):
- Commit 556c3e8 "fix(agents): strip Gemma reasoning from local replay" (v2026.5.4-beta.1) — adds dropReasoningFromHistory policy for isStrictOpenAiCompatible + isGemma4ModelRequiringReasoningStrip models.

Session snapshot:
- OpenClaw v2026.5.2 (8b2a6e5)
- Model: lmstudio/gemma-4-26b-a4b-it
- Think: high · elevated
- Context grew from 21% → 22% (55k–104k tokens) across observed sessions
- Compactions: 0

Impact and severity

Affected: Users running OpenClaw with LM Studio + Gemma 4 models (any variant) on v2026.5.2. Severity: High — agent produces hallucinated or context-mismatched responses, making the model unusable for multi-turn conversations. Frequency: Always reproducible after 3–5 turns with reasoning enabled. Consequence: Effectively blocks use of Gemma 4 via LM Studio until workaround (/reasoning off) is applied or 556c3e8 is released in stable.

Additional information

Last known good version: v2026.4.26 (Gemma 4 worked without context corruption, reasoning simply not displayed). First known bad version: v2026.5.2.

Root cause (supported by commit diff): Commit 2fd1e7b added normalizeLmstudioTransportReasoningCompat() which enables reasoning_effort round-trip for all LM Studio models. For Gemma 4, this causes prior-turn thinking blocks to be included in replay messages. LM Studio's OpenAI-compat Gemma 4 endpoint silently rejects or mishandles these blocks, corrupting message history.

Commit 556c3e8 (already merged to main, not yet in stable) addresses this by stripping prior-turn reasoning from Gemma 4 replay via dropReasoningFromHistory policy.

Related: #68704 (locked as resolved — fix in main but not backported to stable).

Request: Please backport 556c3e8 to a v2026.5.x patch release.

extent analysis

TL;DR

The most likely fix is to backport commit 556c3e8 to the stable release v2026.5.x to strip prior-turn reasoning from Gemma 4 replay messages.

Guidance

  • The root cause is the introduction of normalizeLmstudioTransportReasoningCompat() in commit 2fd1e7b, which enables reasoning effort round-trip for all LM Studio models, causing prior-turn thinking blocks to be included in replay messages for Gemma 4.
  • To verify the issue, reproduce the steps provided, and observe the agent responses becoming incoherent after 3-5 turns with reasoning enabled.
  • A temporary workaround is to disable reasoning using /reasoning off, which prevents corruption but still allows the agent to reason internally.
  • To mitigate the issue, consider upgrading to a version that includes the fix (e.g., v2026.5.4-beta.1) or waiting for the backport of commit 556c3e8 to the stable release.

Notes

The fix is already merged to the main branch but not yet available in the stable release. The backport of commit 556c3e8 to v2026.5.x is requested to address the issue.

Recommendation

Apply the workaround by disabling reasoning using /reasoning off until the fix is backported to the stable release. This will prevent corruption and allow the agent to reason internally, although it may not be the ideal solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Prior-turn thinking blocks should be stripped from replay history before being sent to the LM Studio Gemma 4 endpoint, as Gemma 4's OpenAI-compat API does not accept reasoning_content in conversation history. On v2026.4.26, Gemma 4 worked correctly (reasoning blocks were not injected). Commit 556c3e8 implements this stripping policy for main; backporting to v2026.5.x stable should restore correct behavior.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Request]: Backport fix for Gemma 4 reasoning_content replay bug (#68704) to v2026.5.x stable [1 comments, 2 participants]