Skip to content

Tool call result delivery fails after session compaction — error leaks to user chat #16948

@andytzxiao

Description

@andytzxiao

Description

When a long-running tool call completes (or multiple system messages queue up) and the session context has been compacted in the meantime, the agent receives an error:

No tool call found for function call output with call_id toolu01QevQjBAp63b1ujgzW6SqjR.

This error message then gets delivered to the user's chat surface (e.g., Telegram) as if it were a normal reply.

Steps to Reproduce

  1. Start a long-running exec command (e.g., a Python script that takes 10+ minutes)
  2. While it's running, multiple heartbeat messages arrive and queue up
  3. Session gets compacted due to context length
  4. When the exec completes, the tool result tries to deliver to a context where the original tool_call ID no longer exists
  5. The framework error message leaks as a user-visible reply

Expected Behavior

  • Tool results for orphaned call IDs should be silently discarded (or logged internally) rather than forwarded as user-visible messages
  • Alternatively, the result could be injected as a system message with the output content rather than as a tool_result

Observed Frequency

Happens multiple times per session during heavy async work (background processes + heartbeats).

Environment

  • OpenClaw 2026.2.12
  • Model: claude-opus-4-6
  • Channel: Telegram
  • Heartbeat interval: 30 min
  • Trigger: long-running exec processes completing after compaction

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    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