openclaw - ✅(Solved) Fix Mattermost: reasoning/thinking content leaks as blockquote prefix in channel posts (regression of #18667) [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

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#69830Fetched 2026-04-22 07:47:48
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Reasoning/thinking content is leaking into Mattermost channel output as a blockquote prefix before the actual assistant reply. This appears to be a regression of #18667 (which was closed Feb 22, 2026) on the Mattermost surface specifically.

Root Cause

Reasoning/thinking content is leaking into Mattermost channel output as a blockquote prefix before the actual assistant reply. This appears to be a regression of #18667 (which was closed Feb 22, 2026) on the Mattermost surface specifically.

Fix Action

Workaround

/reasoning off per session suppresses the leak.

PR fix notes

PR #69927: fix(mattermost): suppress reasoning-only replies [AI-assisted]

Description (problem / solution / changelog)

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: Mattermost delivers reasoning-only payloads as visible replies, and the draft-preview finalizer can also surface Reasoning:-prefixed text.
  • Why it matters: hidden reasoning leaks into user-facing channel posts when reasoning is enabled.
  • What changed: suppress reasoning-only payloads in the Mattermost reply-delivery and draft-preview finalization paths, with regression tests for both seams.
  • What did NOT change (scope boundary): no changes to reasoning generation, non-Mattermost channels, or reply chunking behavior.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #69830
  • Related #24991
  • This PR fixes a bug or regression

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause: Mattermost uses channel-specific delivery and draft-preview helpers that did not suppress reasoning-only payloads before send/edit, unlike the generic dispatch path fixed earlier.
  • Missing detection / guardrail: Mattermost had no regression tests covering reasoning-only payload delivery or preview finalization.
  • Contributing context (if known): #24991 fixed the generic path, but Mattermost kept its own delivery seams.

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • extensions/mattermost/src/mattermost/reply-delivery.test.ts
    • extensions/mattermost/src/mattermost/monitor.test.ts
  • Scenario the test should lock in: reasoning-only payloads, including plain Reasoning:-prefixed text, are suppressed before Mattermost sends or preview finalization; ordinary text that merely mentions Reasoning: mid-message still delivers.
  • Why this is the smallest reliable guardrail: the bug lives in Mattermost-specific delivery helpers, so unit tests hit the exact send/edit seams without requiring a live Mattermost instance.
  • Existing test that already covers this (if any): None.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

  • Mattermost no longer posts reasoning-only replies or finalizes draft previews with hidden reasoning text.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

Before:
[reasoning payload] -> [Mattermost reply delivery or preview finalizer] -> [user-visible reasoning post]

After:
[reasoning payload] -> [suppression check] -> [no user-visible post]

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS 15.5
  • Runtime/container: local source checkout via corepack pnpm
  • Model/provider: N/A (unit repro)
  • Integration/channel (if any): Mattermost
  • Relevant config (redacted): N/A (unit fixtures)

Steps

  1. On clean origin/main, add focused Mattermost tests for a reasoning-only payload and a Reasoning:-prefixed payload.
  2. Run corepack pnpm test extensions/mattermost/src/mattermost/reply-delivery.test.ts.
  3. Observe both tests fail because sendMessage is called with the reasoning text.

Expected

  • Reasoning-only payloads are suppressed before Mattermost send/edit paths.

Actual

  • Reasoning-only payloads were delivered to sendMessage, and the preview finalizer also lacked the same prefix-based suppression.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    • Clean-main failing repro for reply-delivery.test.ts
    • Passing targeted tests for reply-delivery.test.ts and monitor.test.ts
    • Passing Mattermost extension lane after the fix
  • Edge cases checked:
    • explicit isReasoning payloads
    • plain Reasoning: prefix without isReasoning
    • visible content that mentions Reasoning: mid-text
    • draft-preview finalization path
  • What you did not verify:
    • live Mattermost instance delivery against a real server

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: Over-suppressing legitimate Mattermost messages that start with Reasoning:.
    • Mitigation: added a regression test that content mentioning Reasoning: mid-message still delivers, and the suppression check is limited to reasoning-only prefix patterns already used on other channel surfaces.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/.generated/plugin-sdk-api-baseline.sha256 (modified, +2/-2)
  • extensions/mattermost/src/mattermost/monitor.test.ts (modified, +23/-0)
  • extensions/mattermost/src/mattermost/monitor.ts (modified, +2/-1)
  • extensions/mattermost/src/mattermost/reply-delivery.test.ts (modified, +93/-0)
  • extensions/mattermost/src/mattermost/reply-delivery.ts (modified, +4/-0)
  • extensions/whatsapp/src/auto-reply/deliver-reply.test.ts (modified, +4/-0)
  • extensions/whatsapp/src/auto-reply/deliver-reply.ts (modified, +2/-15)
  • src/plugin-sdk/reply-payload.test.ts (modified, +17/-0)
  • src/plugin-sdk/reply-payload.ts (modified, +33/-1)

Code Example

> Reasoning:
   > Setup for a joke. Let me play along with a groaner.
RAW_BUFFERClick to expand / collapse

Summary

Reasoning/thinking content is leaking into Mattermost channel output as a blockquote prefix before the actual assistant reply. This appears to be a regression of #18667 (which was closed Feb 22, 2026) on the Mattermost surface specifically.

Repro

  1. Mattermost channel, OpenClaw 2026.4.20 (also reproduced on 2026.4.15)
  2. Session-level /reasoning on (thinking enabled)
  3. User sends any message that triggers a non-trivial reply
  4. Bot's outbound post includes a Markdown blockquote like:
    > Reasoning:
    > Setup for a joke. Let me play along with a groaner.
    immediately followed by the actual reply in a separate post.

See attached screenshot — the first post (the Commented on ... reply) contains the reasoning as a blockquote; the second post is the real reply.

Expected

Reasoning content should never appear in channel-delivered messages, regardless of /reasoning state. Reasoning should only surface in local/agent UI contexts (or via an explicit reasoning=stream mode the user opts into).

Environment

  • OpenClaw 2026.4.20 (also 2026.4.15)
  • Channel: Mattermost (self-hosted, chat.alleoenergy.com)
  • Model: anthropic/claude-opus-4-7
  • Node v25.4.0
  • macOS 15.5 (Darwin 25.5.0, arm64)
  • Reasoning: enabled via /reasoning on

Related

  • #18667 — "Reasoning/thinking blocks leaking into iMessage channel delivery" (closed 2026-02-22). That fix described two code paths in dist/reply-DptDUVRg.js:

    1. Streaming block-reply path gated shouldEmitReasoning on onBlockReply (channel delivery callback) being truthy — backwards.
    2. Final payload builder unconditionally appended reasoningText to replyItems.

    The Mattermost surface looks like the same class of leak, possibly via a different/newer formatter that wraps reasoning in > blockquote syntax before concatenation.

Suggested fix

Audit the Mattermost plugin's outbound formatter (and the shared replyItems builder) for any path that concatenates reasoning/thinking content into the channel payload. Drop those paths unconditionally for channel surfaces; route reasoning to an internal stream callback only.

Workaround

/reasoning off per session suppresses the leak.

Screenshot

(attached)

extent analysis

TL;DR

Disable reasoning via /reasoning off to suppress the leak of reasoning content into Mattermost channel output.

Guidance

  • Review the Mattermost plugin's outbound formatter and replyItems builder to identify paths that concatenate reasoning content into the channel payload.
  • Verify that the shouldEmitReasoning check is correctly implemented for the Mattermost channel delivery callback.
  • Check for any newer formatters that may be wrapping reasoning in > blockquote syntax before concatenation.
  • Consider temporarily disabling reasoning for Mattermost channels until a permanent fix is implemented.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The suggested fix involves auditing the Mattermost plugin's code, which may require additional investigation and debugging to identify the root cause of the issue.

Recommendation

Apply workaround: Disable reasoning via /reasoning off per session to suppress the leak, as a permanent fix may require further investigation and code changes.

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