Skip to content

fix(reasoning-tags): strip MiniMax mm: tags on silent-reply and streaming paths missed by #93767#93806

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
Alix-007:fix/minimax-mm-reasoning-tag-siblings
Jun 17, 2026
Merged

fix(reasoning-tags): strip MiniMax mm: tags on silent-reply and streaming paths missed by #93767#93806
vincentkoc merged 2 commits into
openclaw:mainfrom
Alix-007:fix/minimax-mm-reasoning-tag-siblings

Conversation

@Alix-007

Copy link
Copy Markdown
Contributor

Summary

#93767 added MiniMax mm: namespace support to reasoning-tag handling across 9 files (so <mm:think> etc. are treated like the existing antml:/bare reasoning tags). Two production-path reasoning-tag regexes were missed and still only match antml:/bare tags:

  • src/auto-reply/tokens.ts:88-91taggedReasoningPrefixRe / openReasoningPrefixRe, which feed stripLeadingReasoningBlocks and isReasoningPrefixedSilentReplyText → the exported isSilentReplyPayloadText (used at 14+ production call sites: normalize-reply, reply-directives, pending-final-delivery, replay-history, subagent-announce-delivery, qqbot, …).
  • src/agents/embedded-agent-subscribe.handlers.messages.ts:216REASONING_TAG_RE, the gate at line 737 that decides whether a streaming chunk is recomputed to strip thinking.

Result: a MiniMax model's <mm:think>…</mm:think> reasoning leaks past silent-reply detection and into the visible stream, the exact thing #93767 set out to prevent.

Changes

Real behavior proof

Behavior addressed: MiniMax mm:-namespaced reasoning tags are now stripped/detected on both the silent-reply path and the streaming-recompute path, matching antml: behavior.

Real environment: local, Node v22, node --import tsx, driving the real exported isSilentReplyPayloadText and handleMessageUpdate (+ the real mm-aware stream sanitizer) — no mocks.

Evidence (real functions):

[silent]  isSilentReplyPayloadText("<mm:think>silent</mm:think>NO_REPLY")  -> silent (after)
          <think>/bare reasoning unchanged; "<mm:think>x</mm:think>Here is the answer: 42." NOT misclassified silent
[stream]  handleMessageUpdate(text_delta "<mm:think>secret</mm:think>Visible answer.") -> emits "Visible answer." (no "secret")

Negative controls (pre-#93767 antml-only regex, real): <mm:think> block survives .replace (leaks); stream gate .test("<mm:think>…") === false (not stripped → leaks).

What was not tested: no live MiniMax provider call; the change is in the deterministic reasoning-tag recognition path, driven via the real exported functions.

Tests and validation

  • tokens.test.ts + reasoning-tags.test.ts + reasoning-tag-text-partitioner.test.ts + embedded-agent-subscribe.handlers.messages.test.ts: 199 pass.
  • Negative control reproduces the leak without the fix.
  • oxlint + oxfmt --check clean on both files.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 16, 2026
@clawsweeper

clawsweeper Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 16, 2026, 8:18 PM ET / 00:18 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source 0. Total 0 across 2 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Not assessed.
Failure reason: timeout.

This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict.
Keep any merge decision on the normal maintainer review path until ClawSweeper can complete a fresh review.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

Do we have a high-confidence way to reproduce the issue?

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 7c97c6da9bfa.

Evidence reviewed

PR surface:

Source 0. Total 0 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 3 3 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 3 3 0

What I checked:

  • failure reason: timeout.
  • codex failure detail: Codex review failed for this PR: Codex process timed out after 1199999ms.
  • codex stderr: No stderr captured.
  • codex stdout: {"type":"thread.started","thread_id":"019ed2de-f902-7882-846e-3678be49dde1"}.
  • process error code: ETIMEDOUT.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc vincentkoc self-assigned this Jun 17, 2026
@Alix-007
Alix-007 force-pushed the fix/minimax-mm-reasoning-tag-siblings branch from c27b26d to b7de462 Compare June 17, 2026 01:26
…d stream gates

PR openclaw#93767 added MiniMax `mm:`-namespaced reasoning-tag support across the
shared sanitizer and Telegram lane coordinator, but two production reasoning-tag
recognizers were missed and still only matched the `antml:` namespace:

- src/auto-reply/tokens.ts: `taggedReasoningPrefixRe` / `openReasoningPrefixRe`
  drive `stripLeadingReasoningBlocks` and `isSilentReplyPayloadText`, which 14+
  call sites use to detect NO_REPLY silent payloads. A `<mm:think>…</mm:think>NO_REPLY`
  reply was not recognized as silent, leaking the wrapper into delivery.
- src/agents/embedded-agent-subscribe.handlers.messages.ts: `REASONING_TAG_RE`
  gates `shouldRecomputeFullStream`. A `<mm:think>` streaming chunk failed the
  test, so the visible stream was not recomputed and the hidden reasoning leaked.

Add the `mm:` alternative alongside `antml:` in all three regexes, matching the
exact `(?:antml:|mm:)?` form used by openclaw#93767. Identification-only change, no other
regex logic touched.
@Alix-007
Alix-007 force-pushed the fix/minimax-mm-reasoning-tag-siblings branch from b7de462 to 94dd15d Compare June 17, 2026 01:33
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer repair and verification complete.

Added focused regressions for MiniMax mm:think handling on both silent-reply detection and the streaming replacement path, including split orphan closing tags and unterminated reasoning wrappers before NO_REPLY.

Verification:

  • node scripts/run-vitest.mjs src/auto-reply/tokens.test.ts src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts — 96 focused tests passed
  • final Codex autoreview on the current rebased head — clean
  • prior changed-gate run passed the real changed checks and stopped only on the delegated checkout's warning-only no-merge-base temp report

@vincentkoc
vincentkoc merged commit f8e7d66 into openclaw:main Jun 17, 2026
162 of 165 checks passed
@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks for the quick reviews and merges across this recent batch of fixes, @vincentkoc — much appreciated! 🙏

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 17, 2026
…ming paths missed by openclaw#93767 (openclaw#93806)

* fix(reasoning-tags): accept MiniMax mm: prefix in silent-detection and stream gates

PR openclaw#93767 added MiniMax `mm:`-namespaced reasoning-tag support across the
shared sanitizer and Telegram lane coordinator, but two production reasoning-tag
recognizers were missed and still only matched the `antml:` namespace:

- src/auto-reply/tokens.ts: `taggedReasoningPrefixRe` / `openReasoningPrefixRe`
  drive `stripLeadingReasoningBlocks` and `isSilentReplyPayloadText`, which 14+
  call sites use to detect NO_REPLY silent payloads. A `<mm:think>…</mm:think>NO_REPLY`
  reply was not recognized as silent, leaking the wrapper into delivery.
- src/agents/embedded-agent-subscribe.handlers.messages.ts: `REASONING_TAG_RE`
  gates `shouldRecomputeFullStream`. A `<mm:think>` streaming chunk failed the
  test, so the visible stream was not recomputed and the hidden reasoning leaked.

Add the `mm:` alternative alongside `antml:` in all three regexes, matching the
exact `(?:antml:|mm:)?` form used by openclaw#93767. Identification-only change, no other
regex logic touched.

* test(agents): cover MiniMax reasoning regressions

---------

Co-authored-by: Vincent Koc <[email protected]>
crh-code pushed a commit to crh-code/openclaw that referenced this pull request Jun 18, 2026
…ming paths missed by openclaw#93767 (openclaw#93806)

* fix(reasoning-tags): accept MiniMax mm: prefix in silent-detection and stream gates

PR openclaw#93767 added MiniMax `mm:`-namespaced reasoning-tag support across the
shared sanitizer and Telegram lane coordinator, but two production reasoning-tag
recognizers were missed and still only matched the `antml:` namespace:

- src/auto-reply/tokens.ts: `taggedReasoningPrefixRe` / `openReasoningPrefixRe`
  drive `stripLeadingReasoningBlocks` and `isSilentReplyPayloadText`, which 14+
  call sites use to detect NO_REPLY silent payloads. A `<mm:think>…</mm:think>NO_REPLY`
  reply was not recognized as silent, leaking the wrapper into delivery.
- src/agents/embedded-agent-subscribe.handlers.messages.ts: `REASONING_TAG_RE`
  gates `shouldRecomputeFullStream`. A `<mm:think>` streaming chunk failed the
  test, so the visible stream was not recomputed and the hidden reasoning leaked.

Add the `mm:` alternative alongside `antml:` in all three regexes, matching the
exact `(?:antml:|mm:)?` form used by openclaw#93767. Identification-only change, no other
regex logic touched.

* test(agents): cover MiniMax reasoning regressions

---------

Co-authored-by: Vincent Koc <[email protected]>
sheyanmin added a commit to sheyanmin/openclaw that referenced this pull request Jul 8, 2026
…eplies

The THINKING_TAG_RE and THINKING_BLOCK_RE regex patterns in the Matrix
monitor replies module were missing the mm: namespace prefix for detecting
MiniMax reasoning tags. This caused mm:think/mm:thought reasoning content
to leak into Matrix room messages.

Add (?:antml:|mm:)? prefix to think(?:ing)?|thought alternatives in both
regexes, consistent with the pattern already applied in reasoning-tags.ts
and other channel modules (see openclaw#93767, openclaw#93806, openclaw#93820).

Fixes openclaw#99412
sheyanmin added a commit to sheyanmin/openclaw that referenced this pull request Jul 8, 2026
…eplies

The THINKING_TAG_RE and THINKING_BLOCK_RE regex patterns in the Matrix
monitor replies module were missing the mm: namespace prefix for detecting
MiniMax reasoning tags. This caused mm:think/mm:thought reasoning content
to leak into Matrix room messages.

Add (?:antml:|mm:)? prefix to think(?:ing)?|thought alternatives in both
regexes, consistent with the pattern already applied in reasoning-tags.ts
and other channel modules (see openclaw#93767, openclaw#93806, openclaw#93820).

Fixes openclaw#99412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants