Skip to content

Bug: heartbeat transcript repair artifacts can pollute later context #85687

Description

@nierclaw-sudo

Summary

Heartbeat turns can become polluted when a tool result is missing and the transcript is repaired with synthetic error text such as:

[openclaw] missing tool result in session history; inserted synthetic error result for transcript repair

Please make heartbeat/tool-result transcript repair observable and prevent the repair text from contaminating later heartbeat context.

Observed symptoms

During lightweight heartbeat polling, a simple file read such as reading HEARTBEAT.md intermittently returned one of:

  • no result;
  • a synthetic transcript repair message;
  • tool output ordering that appeared shifted into later heartbeat context.

Impact:

  • heartbeat no-op messages can become noisy;
  • later turns may see repair text as if it were normal context;
  • automated memory capture can become uncertain when save/read tools return no concrete result;
  • debugging is difficult because the visible transcript does not clearly link the missing tool result to a specific tool call id.

Expected behavior

When a tool result is missing during heartbeat or any lightweight background turn:

  • the repair should be recorded in structured diagnostics with tool call id, tool name, session key, and turn id;
  • the user/model-visible transcript should receive a bounded neutral placeholder, or no placeholder, rather than raw repair text;
  • heartbeat should be able to fail that poll cleanly without carrying the repair artifact into future context;
  • openclaw status --deep or a related diagnostic command should expose recent transcript repairs.

Minimal repro shape

  1. Enable heartbeat for one agent.
  2. Heartbeat prompt reads a small workspace file.
  3. Simulate or trigger a missing tool result for that read.
  4. Inspect the next heartbeat/session context.

The bug is not that a tool can fail. The issue is that transcript repair artifacts can become part of operational context and confuse later background turns.

Why this matters

Heartbeat is often used for quiet background checks. It needs especially clean failure semantics because there may be no human watching the exact failed poll.

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-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm 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:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions