Skip to content

fix(whatsapp): suppress reasoning/thinking content from WhatsApp delivery#24962

Merged
steipete merged 2 commits intoopenclaw:mainfrom
Sid-Qin:fix/whatsapp-reasoning-leak
Feb 24, 2026
Merged

fix(whatsapp): suppress reasoning/thinking content from WhatsApp delivery#24962
steipete merged 2 commits intoopenclaw:mainfrom
Sid-Qin:fix/whatsapp-reasoning-leak

Conversation

@Sid-Qin
Copy link
Contributor

@Sid-Qin Sid-Qin commented Feb 24, 2026

Summary

  • The WhatsApp deliver callback in process-message.ts forwarded all payload kinds (tool, block, final) to WhatsApp
  • block payloads contain the model's reasoning/thinking content, which should only be visible in the internal web UI
  • This caused chain-of-thought to leak to end users as separate WhatsApp messages

The fix adds an early return for non-final payloads, matching how Telegram already filters by info.kind === "final".

Changes

  • src/web/auto-reply/monitor/process-message.ts — skip delivery for info.kind !== "final"

Test plan

  • Enable reasoning (thinkingDefault: "low") and send a message via WhatsApp — only the final response should appear
  • Verify webchat/TUI still shows reasoning blocks as expected
  • Verify Telegram behavior is unchanged

Fixes #24954
Fixes #24605

Made with Cursor

Greptile Summary

Fixes a bug where the WhatsApp deliver callback in process-message.ts forwarded all payload kinds (tool, block, final) to WhatsApp, causing chain-of-thought/reasoning content to leak to end users as separate messages. The fix adds an early return for info.kind !== "final", consistent with the repository's policy that only final replies should be delivered to external messaging surfaces. Dead code paths for tool and block payloads are correctly cleaned up.

  • Added early return guard for non-final payloads in the WhatsApp deliver callback
  • Removed now-unreachable tool-kind early return and block-kind conditional branches
  • Simplified skipLog (hardcoded false) and shouldLog (no longer needs kind check) since only final payloads reach the delivery code
  • Aligns WhatsApp behavior with the established AGENTS.md rule: "Never send streaming/partial replies to external messaging surfaces"

Confidence Score: 5/5

  • This PR is safe to merge — it's a straightforward, well-scoped bug fix with correct dead code cleanup.
  • The change is minimal and focused: a single early-return guard that prevents non-final payloads from being delivered to WhatsApp. The subsequent dead code removal is logically consistent with the guard. The pattern matches how other channels (Telegram) already handle this. No new logic is introduced, no edge cases are missed, and the change aligns with the repository's explicit policy in AGENTS.md.
  • No files require special attention.

Last reviewed commit: d818f96

Context used:

  • Context from dashboard - CLAUDE.md (source)

@openclaw-barnacle openclaw-barnacle bot added channel: whatsapp-web Channel integration: whatsapp-web size: XS labels Feb 24, 2026
@steipete steipete force-pushed the fix/whatsapp-reasoning-leak branch from d818f96 to a2c0cb5 Compare February 24, 2026 03:46
steipete added a commit to Sid-Qin/openclaw that referenced this pull request Feb 24, 2026
…very

The deliver callback in process-message.ts was forwarding all payload
kinds (tool, block, final) to WhatsApp. Block payloads contain the
model's reasoning/thinking content, which should only be visible in
the internal web UI. This caused chain-of-thought to leak to end users
as separate WhatsApp messages.

Add an early return for non-final payloads so only the actual response
is delivered to the WhatsApp channel, matching how Telegram already
filters by info.kind === "final".

Fixes openclaw#24954
Fixes openclaw#24605

Co-authored-by: Cursor <cursoragent@cursor.com>
@steipete steipete force-pushed the fix/whatsapp-reasoning-leak branch from a2c0cb5 to 4603566 Compare February 24, 2026 03:47
@steipete steipete merged commit b5881d9 into openclaw:main Feb 24, 2026
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm check && pnpm build && pnpm test
  • Land commit: 4603566778f2b23db3fc8dc271093f9ff661de14
  • Merge commit: b5881d9

Thanks @SidQin-cyber!

@steipete
Copy link
Contributor

AI-assisted stale triage closure (fix-only duplicate sweep).

This PR overlaps with #24991 for #24954 (suppress reasoning/thinking leakage on WhatsApp/non-Telegram channels). #24991 is the active path for this fix scope.

Closing this duplicate as AI-closed.

Reopen guidance:

sagarsaija pushed a commit to sagarsaija/openclaw that referenced this pull request Feb 24, 2026
plgs2005 pushed a commit to plgs2005/openclaw that referenced this pull request Feb 24, 2026
xianfeng92 pushed a commit to xianfeng92/openclaw that referenced this pull request Feb 25, 2026
margulans pushed a commit to margulans/Neiron-AI-assistant that referenced this pull request Feb 25, 2026
brianleach pushed a commit to brianleach/openclaw that referenced this pull request Feb 26, 2026
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 26, 2026
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
…4962) (thanks @SidQin-cyber)

(cherry picked from commit b5881d9)

# Conflicts:
#	CHANGELOG.md
#	src/web/auto-reply/monitor/process-message.inbound-contract.test.ts
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
…4962) (thanks @SidQin-cyber)

(cherry picked from commit b5881d9)

# Conflicts:
#	CHANGELOG.md
#	src/web/auto-reply/monitor/process-message.inbound-contract.test.ts
#	src/web/auto-reply/monitor/process-message.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Reasoning/thinking content leaks to WhatsApp channel [Bug]: Reasoning metadata leaking to WhatsApp messages

2 participants