openclaw - 💡(How to fix) Fix Stream parser duplicates <think> content into both text and thinking parts (CoT leaks to chat channels with minimax/MiniMax-M2.7)

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 a model streams inline <think>...</think> reasoning, the assistant message ends up with two parallel content parts containing the same text:

  • { type: "text", text: "<think>...</think>..." }
  • { type: "thinking", text: "...same..." }

Channels render the text part, so users see the entire chain-of-thought verbatim before the final answer.

Root Cause

When a model streams inline <think>...</think> reasoning, the assistant message ends up with two parallel content parts containing the same text:

  • { type: "text", text: "<think>...</think>..." }
  • { type: "thinking", text: "...same..." }

Channels render the text part, so users see the entire chain-of-thought verbatim before the final answer.

Fix Action

Workaround

None at the workspace level — system-prompt rules forbidding <think> are ignored by minimax/MiniMax-M2.7. Operators must avoid the model on chat surfaces, or switch to a model that doesn't emit inline reasoning (e.g., moonshot/kimi-k2.6).

Code Example

{
     "plugins": { "entries": { "minimax": { "enabled": true } } },
     "agents": {
       "list": [
         { "id": "movie-night", "model": "minimax/MiniMax-M2.7" }
       ]
     }
   }
RAW_BUFFERClick to expand / collapse

Summary

When a model streams inline <think>...</think> reasoning, the assistant message ends up with two parallel content parts containing the same text:

  • { type: "text", text: "<think>...</think>..." }
  • { type: "thinking", text: "...same..." }

Channels render the text part, so users see the entire chain-of-thought verbatim before the final answer.

Affected

  • Version: 2026.5.7 (likely also on main)
  • Channels affected: Telegram, Discord (any channel renderer that consumes text parts)
  • Models affected: minimax/MiniMax-M2.7 confirmed; any model emitting inline <think> tags over the OpenAI-compatible streaming path is likely affected.

Reproduction

  1. ~/.openclaw/openclaw.json:
    {
      "plugins": { "entries": { "minimax": { "enabled": true } } },
      "agents": {
        "list": [
          { "id": "movie-night", "model": "minimax/MiniMax-M2.7" }
        ]
      }
    }
  2. Bind the agent to Telegram.
  3. DM any non-trivial prompt (e.g., "Best thriller movies right now").
  4. Observe <think>...</think> reasoning streamed verbatim into the chat before the actual answer arrives.

Evidence

In ~/.openclaw/sessions/<id>.jsonl, every assistant chunk during the reasoning phase contains a matched pair of parts — [assistant/text] and [assistant/thinking] — with byte-identical content. The parser is duplicating the chunk into both streams rather than routing it exclusively into the thinking stream.

Expected behavior

When the stream parser sees an opening <think> (or <reasoning>) tag mid-text:

  1. Flush prior text into the text part.
  2. Route subsequent chunks only to the thinking part until the closing tag.
  3. Resume routing to text after the closing tag.

The <think> body must never appear in any text content part.

Suggested area to fix

Likely in the OpenAI-compatible streaming adapter / content-part normalizer (under src/ or extensions/minimax). The minimax adapter appears to emit each delta to both a text part and a thinking part; it should be exclusive based on tag state.

Workaround

None at the workspace level — system-prompt rules forbidding <think> are ignored by minimax/MiniMax-M2.7. Operators must avoid the model on chat surfaces, or switch to a model that doesn't emit inline reasoning (e.g., moonshot/kimi-k2.6).

Impact

  • Major UX regression on chat channels — the user sees a long monologue of raw reasoning before every answer.
  • Privacy/safety concern: raw deliberation (including any sensitive reasoning about tool use, secrets, etc.) is exposed directly to end users.

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

When the stream parser sees an opening <think> (or <reasoning>) tag mid-text:

  1. Flush prior text into the text part.
  2. Route subsequent chunks only to the thinking part until the closing tag.
  3. Resume routing to text after the closing tag.

The <think> body must never appear in any text content part.

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 Stream parser duplicates <think> content into both text and thinking parts (CoT leaks to chat channels with minimax/MiniMax-M2.7)