Skip to content

message-tool send mid-turn writes 'delivery-mirror' side-branch into transcript → permanent HTTP 400 loop, session silently dead #100360

Description

@joehere1988-droid

Summary

When an agent sends media (image + caption) via the message tool mid-turn, the runtime records a mirrored assistant message (provider: "openclaw", model: "delivery-mirror") into the session transcript as a side-branch (leaf record, appendMode: "side") attached between an assistant tool_use turn and its toolResult entries. On every subsequent turn, the compiled Anthropic request is rejected with HTTP 400 (invalid request, ~0.5s, zero tokens). The session never recovers: every turn ends non_deliverable_terminal_turn, the user-facing channel receives nothing, and there is no operator alert. /status still works, so the bot appears healthy while being permanently mute.

Environment

  • OpenClaw 2026.6.11 (e085fa1), macOS arm64, node v25.6.0
  • Provider: anthropic (anthropic-messages API), model claude-opus-4-8
  • Channel: Telegram group session

Reproduction (observed, 2x in one week)

  1. Telegram group session; agent works normally.
  2. Agent calls message tool with an image attachment + caption targeting the same group, mid-turn (before its final reply).
  3. Transcript gains, in order: assistant msg with tool_use blocks → mirrored assistant msg {role:"assistant", content:[{type:"text", text:"<media filename>"}], provider:"openclaw", model:"delivery-mirror"}{type:"leaf", targetId:<assistant msg id>, appendParentId:<mirror id>, appendMode:"side"} → the toolResult entries.
  4. Next inbound message → provider POST returns 400 in <1s, lastCallUsage all zeros, transcript records assistant placeholder [assistant turn failed before producing content], turn ends non_deliverable_terminal_turn.
  5. Every subsequent turn repeats step 4 forever. No delivery, no alert.

Update — second occurrence, text-only trigger

Three minutes after the first repaired session came back online, the agent re-poisoned it with a plain text message send issued in parallel with other tool calls (edit + sessions_spawn + message in one assistant turn). The mirror entry landed between the tool_use block and its tool_result entries again. So the trigger is not media-specific: it is the delivery mirror being appended as a side-branch while sibling tool calls from the same assistant message are still pending.

Impact

Two production group sessions killed in one week; one stayed silently dead for 4 days. Humans in the group assume the agent is ignoring them.

Expected

  1. Media delivery mirroring must not create a transcript branch that compiles into an invalid provider message sequence (assistant text between tool_use and tool_result).
  2. Self-healing: after N consecutive instant 400s on an unchanged transcript, the runtime should repair/quarantine the offending branch (or at minimum surface a loud error to the channel/operator) instead of failing silently forever.

Evidence available

Sanitized transcript excerpts (entry ids, parent links, leaf record) and gateway log excerpts showing the 400 streak — happy to attach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.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:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.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