Skip to content

WhatsApp: Gemini thinking tags (<think>/<final>) still leak after #6328 fix #87712

Description

@akdira

Bug Report

Description

After the Telegram reasoning tag fix in #6328, the WhatsApp channel still exposes raw <think>...</think> and <final>...</final> tags from Gemini 2.5 Pro to users, even on OpenClaw v2026.5.27.

Root Cause

The fix in #6328 was Telegram-only — it added splitTelegramReasoningText() as a streaming coordinator in the Telegram bot module. The WhatsApp delivery pipeline was not updated equivalently.

Additionally, the @openclaw/whatsapp plugin auto-installs at whatever version is available at install time, and can lag significantly behind the core. Users upgrading the core to v2026.5.27 may still be running @openclaw/[email protected] — a gap of ~3 weeks of fixes.

Technical Details

Gemini thinking tag flow:

  1. BUILTIN_REASONING_OUTPUT_MODES = { "google-generative-ai": "tagged" } -> system prompt injects <think>/<final> instructions
  2. Gemini 2.5 Pro ALSO returns native thinking via API (thinkingBudget -> thinkingConfig)
  3. promoteThinkingTagsToBlocks() skips if native thinking blocks already present -> inline tags remain in text blocks
  4. WhatsApp delivery (deliverWebReply) calls normalizeWhatsAppPayloadTextPreservingIndentation -> sanitizeAssistantVisibleTextWithProfile(text, "history") -> stripReasoningTagsFromText(text, { mode: "strict" })

Edge case during streaming: If a <think> block is unclosed and the result is empty, the fallback in stripReasoningTagsFromText returns the thinking content itself — the suspected leak path for streaming/incomplete responses.

Steps to Reproduce

  1. Configure OpenClaw with google/gemini-2.5-pro and reasoning: true, thinkingDefault: "medium"
  2. Pair a WhatsApp account
  3. Send a message that triggers reasoning
  4. Observe <think>...</think><final>...</final> tags appear in the WhatsApp reply

Fix

Short-term: Ensure @openclaw/whatsapp plugin version is kept in sync with core version:
openclaw plugins update @openclaw/whatsapp

Long-term: Apply the same reasoning tag interception to the WhatsApp delivery pipeline as was done for Telegram in #6328. The WhatsApp monitor should use a splitWhatsAppReasoningText() equivalent that:

  • Suppresses pure reasoning-only payloads (via isReasoningReplyPayload() — already present in v2026.5.27)
  • Ensures the text normalization pipeline strips all reasoning tags before sending

Environment

  • OpenClaw core: v2026.5.27
  • @openclaw/whatsapp plugin: was v2026.5.7, updated to v2026.5.27 as workaround
  • Model: google/gemini-2.5-pro with reasoning: true
  • Platform: Linux (Debian 12)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions