Skip to content

Reasoning/thinking content leaked into assistant reply as visible output (heartbeat loop) #66888

Description

@JanPlessow

Bug Description

During a heartbeat check, the agent's internal reasoning process leaked entirely into the user-visible reply instead of being kept internal. The result was hundreds of lines of repeated, incoherent output sent to the user's Telegram chat.

What happened

The heartbeat asked the agent to reply with HEARTBEAT_OK if all checks passed. All checks did pass. Instead of outputting the single word, the agent:

  1. Began outputting its internal reasoning chain verbatim into the reply
  2. Got stuck in a loop trying (and failing) to produce the word HEARTBEAT_OK — repeatedly generating HEARTHEART_OK (with HEART duplicated) instead
  3. Continued looping for what appears to be hundreds of tokens of visible output
  4. Never successfully produced the correct word

Observed output (excerpt)

Done. Goodbye. Final. The end. Truly done. Absolutely done. 100% done. No more thoughts. No more attempts. Sending now.

HEARTHEART_OK

Actually, wait. I just had one more thought...

HEARTHEART_OK

...

The full output was several hundred lines of this loop delivered directly to the user via Telegram.

Environment

  • OpenClaw version: 2026.4.14 (323493f)
  • Model: openrouter/anthropic/claude-sonnet-4-6
  • Channel: Telegram (direct)
  • Session: agent:main:telegram:direct:1960998089
  • Reasoning mode: adaptive (enabled)
  • Time: 2026-04-14 ~18:34 CST

Expected behavior

Agent outputs exactly: HEARTBEAT_OK — nothing else.

Actual behavior

Agent reasoning process became visible output. Model appeared unable to produce the token sequence HEARTBEAT_OK and looped on a corrupted variant (HEARTHEART_OK) for hundreds of lines.

Hypothesis

  1. Reasoning/thinking content leaked — the adaptive thinking mode may have caused internal chain-of-thought to bleed into the final assistant message content, especially during a very short/simple task where the reasoning context dominated.
  2. Token generation corruption — something in the model's token sampling caused HEARTBEAT to consistently decode as HEARTHEART, possibly a context contamination or sampling issue at the OpenRouter layer.

Impact

High — user received hundreds of lines of garbage output to their Telegram chat. Unacceptable UX for a production assistant.

Suggested investigation

  • Check if adaptive thinking mode has a guard preventing reasoning from leaking into message content
  • Check if there is a max-output-length guard on heartbeat/short responses
  • Investigate the HEARTHEART token corruption — may be reproducible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions