Skip to content

Reasoning/thinking blocks leaking into iMessage channel delivery #18667

@pprwrk

Description

@pprwrk

Summary

When reasoning/thinking is enabled (e.g. reasoningLevel: "on"), internal reasoning text is sent as user-visible replies through channel delivery (iMessage, etc.). Users see the model's chain-of-thought as actual messages.

Root Cause

Two code paths in dist/reply-DptDUVRg.js explicitly inject reasoning text into outbound reply payloads:

  1. Streaming block-reply path (~line 54893-54900): onBlockReply (the channel delivery callback) is called with formatted reasoning text. The condition shouldEmitReasoning gates on onBlockReply being truthy — meaning reasoning is emitted specifically when a channel callback exists, which is backwards.

    // Before fix (line 54893):
    const shouldEmitReasoning = Boolean(ctx.state.includeReasoning && formattedReasoning && onBlockReply && ...)
    // onBlockReply is the channel delivery callback — this means reasoning only emits TO channels
  2. Final payload builder (~line 56715-56716): Unconditionally appends reasoning text to replyItems when reasoningLevel === "on":

    const reasoningText = params.lastAssistant && params.reasoningLevel === "on" ? formatReasoningMessage(...) : "";
    if (reasoningText) replyItems.push({ text: reasoningText });

    This replyItems array feeds directly into channel delivery.

Suggested Fix

  1. In the streaming path, emit reasoning through a separate onReasoningStream callback (for logging/UI) instead of onBlockReply (channel delivery). Invert the onBlockReply condition so reasoning is suppressed when a channel callback is present.

  2. Remove the unconditional reasoningText push from the final payload builder entirely — reasoning should not be appended to outbound reply items.

Environment

  • OpenClaw v2026.2.9
  • Any channel (iMessage confirmed, likely affects all channels)
  • Reasoning/thinking must be enabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions