openclaw - 💡(How to fix) Fix Bug: Xiaomi MiMo reasoning_content stripped from assistant history on replay (blocks all multi-turn tool calls)

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…

When OpenClaw sends a conversation history to MiMo models via the Anthropic-compatible endpoint, assistant messages that previously contained tool_calls are stripped of their reasoning_content field during transcript normalization. MiMo requires this field to be echoed back unchanged on replay, and returns:

400 {"error":{"code":"400","message":"Param Incorrect","param":"The reasoning_content in the thinking mode must be passed back to the API."}}

This causes immediate fallback to the backup model, making the primary MiMo model unusable for any multi-turn conversation involving tools.


Error Message

400 {"error":{"code":"400","message":"Param Incorrect","param":"The reasoning_content in the thinking mode must be passed back to the API."}}

  • Without reasoning_content on replay → 400 error

Root Cause

Issue A (thinking=off path): When thinking=off, OpenClaw does not send the standard Anthropic thinking: {"type": "disabled"} format. MiMo ignores the non-standard disable method and still returns thinking blocks. On replay, Gateway stores thinkingSignature but drops reasoning_content, causing 400 on turn 2.

Issue B (thinking=on path, more common): In @earendil-works/pi-ai, the detectCompat() function sets requiresReasoningContentOnAssistantMessages = true only for DeepSeek. MiMo uses the same thinking protocol as DeepSeek but is not recognized. As a result, reasoning_content is never preserved when assistant messages are serialized for storage or replay.

Key code location (per #81419): @earendil-works/pi-ai detectCompat() — needs to add MiMo detection (match provider xiaomi/xiaomicoding or baseUrl containing xiaomimimo.com).

Additionally, tool-result-middleware only drops thinking blocks for model IDs containing "claude" (line 130), so MiMo thinking blocks are stored but with missing fields on replay.


Code Example

400 {"error":{"code":"400","message":"Param Incorrect","param":"The reasoning_content in the thinking mode must be passed back to the API."}}

---

User: What files are in the current directory?
MiMo: [calls tool] → thinking block present, reasoning_content present

---

User: Sort them by date
MiMo: 400 Param Incorrect — reasoning_content missing from assistant history

---

User: Sort them by date
MiMo: [calls tool] → reasoning_content echoed from Turn 1 assistant message

---

// Detect MiMo models (same thinking protocol as DeepSeek)
const isMiMo = provider === 'xiaomi'
  || provider === 'xiaomi-coding'
  || /mimo/i.test(model)
  || baseUrl?.includes('xiaomimimo.com')

if (isMiMo) {
  compat.requiresReasoningContentOnAssistantMessages = true
  compat.thinkingFormat = 'deepseek'  // MiMo uses DeepSeek-compatible thinking blocks
}
RAW_BUFFERClick to expand / collapse

Bug: Xiaomi MiMo reasoning_content missing in multi-turn tool calls (Anthropic-compatible provider)

Environment

  • OpenClaw version: 2026.5.14-beta.1 (and all prior versions)
  • Provider: xiaomicoding (custom) with anthropic-messages API
  • Base URL: https://token-plan-cn.xiaomimimo.com/anthropic
  • Models affected: mimo-v2.5-pro, mimo-v2.5, mimo-v2-pro, mimo-v2-omni, mimo-v2-flash
  • Thinking: on (issue also affects thinking=off — MiMo ignores non-standard disable)
  • Channel: openclaw-weixin (reproducible on any channel)

Summary

When OpenClaw sends a conversation history to MiMo models via the Anthropic-compatible endpoint, assistant messages that previously contained tool_calls are stripped of their reasoning_content field during transcript normalization. MiMo requires this field to be echoed back unchanged on replay, and returns:

400 {"error":{"code":"400","message":"Param Incorrect","param":"The reasoning_content in the thinking mode must be passed back to the API."}}

This causes immediate fallback to the backup model, making the primary MiMo model unusable for any multi-turn conversation involving tools.


Root Cause

Issue A (thinking=off path): When thinking=off, OpenClaw does not send the standard Anthropic thinking: {"type": "disabled"} format. MiMo ignores the non-standard disable method and still returns thinking blocks. On replay, Gateway stores thinkingSignature but drops reasoning_content, causing 400 on turn 2.

Issue B (thinking=on path, more common): In @earendil-works/pi-ai, the detectCompat() function sets requiresReasoningContentOnAssistantMessages = true only for DeepSeek. MiMo uses the same thinking protocol as DeepSeek but is not recognized. As a result, reasoning_content is never preserved when assistant messages are serialized for storage or replay.

Key code location (per #81419): @earendil-works/pi-ai detectCompat() — needs to add MiMo detection (match provider xiaomi/xiaomicoding or baseUrl containing xiaomimimo.com).

Additionally, tool-result-middleware only drops thinking blocks for model IDs containing "claude" (line 130), so MiMo thinking blocks are stored but with missing fields on replay.


Reproduction Steps

Turn 1 — Works:

User: What files are in the current directory?
MiMo: [calls tool] → thinking block present, reasoning_content present

Turn 2 — Fails:

User: Sort them by date
MiMo: 400 Param Incorrect — reasoning_content missing from assistant history

Expected (Turn 2):

User: Sort them by date
MiMo: [calls tool] → reasoning_content echoed from Turn 1 assistant message

Verification

  • Direct curl tests confirm MiMo API is healthy
  • Standard thinking: {"type": "disabled"} correctly suppresses thinking blocks
  • Replay with reasoning_content included works correctly
  • Without reasoning_content on replay → 400 error

MiMo official docs: https://platform.xiaomimimo.com/docs/zh-CN/usage-guide/passing-back-reasoning_content


Suggested Fix

1. In @earendil-works/pi-ai detectCompat(): Add MiMo to providers requiring reasoning_content passthrough:

// Detect MiMo models (same thinking protocol as DeepSeek)
const isMiMo = provider === 'xiaomi'
  || provider === 'xiaomi-coding'
  || /mimo/i.test(model)
  || baseUrl?.includes('xiaomimimo.com')

if (isMiMo) {
  compat.requiresReasoningContentOnAssistantMessages = true
  compat.thinkingFormat = 'deepseek'  // MiMo uses DeepSeek-compatible thinking blocks
}

2. In tool-result-middleware (or equivalent replay normalization): Preserve reasoning_content for non-Claude models that return thinking blocks, or extend dropThinkingBlocks to apply to all models' stored thinking blocks only when the target provider is known to not require replay passthrough.

3. For thinking=off path: Use standard Anthropic thinking: {"type": "disabled"} so MiMo does not return thinking blocks at all when thinking is disabled.

4. Regression tests needed:

  • thinking=on + multi-turn tool calls → Turn 2+ should not 400
  • thinking=off + multi-turn tool calls → same
  • Claude models → unaffected

Impact

Primary model becomes unusable for any conversation requiring tool calls (which is most non-trivial conversations). Every multi-turn interaction silently falls back to the backup model. Users may not immediately understand why their primary model is being bypassed.


References

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING