fix(matrix): recognize MiniMax mm: namespaced reasoning tags in monitor replies#94038
fix(matrix): recognize MiniMax mm: namespaced reasoning tags in monitor replies#94038zhangguiping-xydt wants to merge 7 commits into
Conversation
|
Codex review: needs changes before merge. Reviewed July 8, 2026, 4:09 AM ET / 08:09 UTC. Summary PR surface: Source +1, Tests +25. Total +26 across 2 files. Reproducibility: yes. source inspection gives a high-confidence reproduction: a Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Strip recognized reasoning tags from Matrix outbound text before chunking or media caption delivery, while preserving the existing drop behavior for replies that become empty after stripping. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction: a Is this the best way to solve the issue? No. Expanding the regex is a necessary narrow step, but the best Matrix fix also strips recognized reasoning blocks from mixed visible replies using the existing SDK helper or equivalent send-boundary sanitizer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ae8d735bf54. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1, Tests +25. Total +26 across 2 files. View PR surface stats
Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles)
|
…or replies Mirrors openclaw#93874 (slack monitor) for the matrix extension. The matrix reply delivery path checks shouldSuppressReasoningReplyText to drop reasoning-only payloads before they reach the Matrix room; the THINKING_TAG_RE / THINKING_BLOCK_RE patterns only matched bare, antml:, or antthinking variants, so MiniMax <mm:think>…</mm:think> payloads were treated as ordinary replies and the reasoning text was sent into the Matrix room (a reasoning leak, not just a missed preview). Align the regexes with src/shared/text/reasoning-tags.ts and openclaw#93767's precedent by adding an optional (?:antml:|mm:)? prefix on think/thinking/thought; antthinking is left unprefixed. Adds a regression test that streams three mm: namespaced reasoning-only replies and asserts only the visible answer reaches sendMessageMatrix.
339e6fc to
0317d3a
Compare
|
@clawsweeper re-review Updated this PR after syncing with current main:
Could you please refresh the proof/status labels and rerun the unrelated failed shard if needed? |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Related: #89473
What Problem This Solves
Fixes an issue where Matrix users could see hidden MiniMax reasoning text in monitor replies when a model reply used
mm:thinking tags such as<mm:think>,<mm:thinking>, or<mm:thought>.Without this patch, Matrix could suppress replies that were entirely reasoning, but mixed reasoning-plus-visible replies could still deliver the hidden reasoning block into the room along with the visible answer.
Why This Change Was Made
openclaw/plugin-sdk/text-chunkingreasoning-tag sanitizer so literal<mm:think>or<antml:think>examples inside inline/fenced code are preserved without importing core private files from the Matrix package.mm:/antml:reasoning blocks in text replies and locks the code-example preservation boundary.User Impact
Matrix users no longer receive hidden reasoning text when a monitor reply mixes visible answer text with MiniMax or Anthropic-style thinking blocks. Visible reply text still sends normally, and answers that discuss reasoning tags as literal code examples are not corrupted.
Evidence
Real Matrix room proof from the earlier synced head remains relevant for the original reasoning-only path: a disposable unencrypted Matrix room on matrix.org received exactly one visible Matrix event while three
mm:reasoning-only replies were suppressed at the Matrix monitor delivery boundary.Additional mixed-path delivery-boundary proof on this head used the real
deliverMatrixReplies -> sendMessageMatrix -> client.sendMessageMatrix send path with a fake Matrix client capturing final event content. It verified hiddenmm:andantml:reasoning blocks were removed before outbound Matrix payloads, while a literal code example was preserved:Focused Matrix regression test with the public SDK sanitizer import:
Whitespace/conflict-marker check:
Changed-file checks passed locally after refreshing dependencies with
pnpm install --frozen-lockfile --ignore-scriptsto avoid this host'snode-llama-cpppostinstall/CMake 3.19 issue:What was not rerun: an external Matrix homeserver room proof for the new mixed-block scenario. The previous disposable Matrix credentials and proof harness are not present in this workspace, so the new evidence is a local delivery-boundary run through the real Matrix send code with a fake client capturing the exact outbound event bodies.