openclaw - 💡(How to fix) Fix Transcript mirror can append inbound chat turn after visible assistant delivery, inverting message order and parentId

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

This causes context confusion in later turns. The agent may resolve "above / previous bug / this issue" against the wrong visible item because the transcript says the order was different from the actual chat order.

RAW_BUFFERClick to expand / collapse

Problem

For chat-backed sessions, the transcript mirror can write the visible assistant delivery before it appends the inbound user turn that triggered the rollout. This inverts the apparent conversation order in the main session transcript.

Observed effect:

  1. User sends a chat message.
  2. The agent handles it and sends a visible reply via the messaging tool.
  3. The visible assistant delivery mirror is appended to the session transcript immediately.
  4. The original inbound user message is flushed into the transcript later.
  5. The later user message is appended after the assistant reply, and its parentId can point to the assistant message instead of the previous real turn.

This makes the transcript look like the assistant answered before the user asked, and can corrupt follow-up context selection.

Observed case

In one iMessage-backed OpenClaw session, a user turn started at approximately 2026-05-18T07:52Z, but the mirrored user message appeared in the main session transcript at 2026-05-18T07:55:24Z, after the visible assistant delivery mirror had already been appended.

The resulting transcript ordering was effectively:

  1. assistant visible delivery mirror
  2. user inbound message mirror

instead of:

  1. user inbound message mirror
  2. assistant visible delivery mirror

The later user mirror also appeared to attach to the assistant reply as parent, which inverted causality.

Expected behavior

The transcript mirror should preserve source turn order, not write-time order.

For a chat-sourced rollout:

  • The inbound user message should be inserted/anchored before any assistant messages produced by that rollout.
  • Visible delivery mirrors should not become the parent of the triggering user message.
  • If the user message mirror is delayed, it should still be inserted with the correct causal parent/order metadata, or the assistant delivery mirror should wait until the source turn is anchored.

Why it matters

This causes context confusion in later turns. The agent may resolve "above / previous bug / this issue" against the wrong visible item because the transcript says the order was different from the actual chat order.

It also makes debugging very hard because the local transcript no longer represents the real conversation chronology.

Possible cause

The delivery mirror for message sends appears to append immediately, while the app-server/user-turn transcript mirror may flush the rollout later and append to the tail using current write time / last parent rather than preserving the original source turn order.

Acceptance criteria

  • Inbound chat messages keep their original causal position even if mirrored late.
  • Assistant delivery mirrors from the same rollout appear after the triggering inbound user message.
  • parentId for a mirrored inbound user message never points to the assistant reply generated by that same inbound turn.
  • A regression test covers delayed inbound mirror + immediate visible delivery mirror ordering.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The transcript mirror should preserve source turn order, not write-time order.

For a chat-sourced rollout:

  • The inbound user message should be inserted/anchored before any assistant messages produced by that rollout.
  • Visible delivery mirrors should not become the parent of the triggering user message.
  • If the user message mirror is delayed, it should still be inserted with the correct causal parent/order metadata, or the assistant delivery mirror should wait until the source turn is anchored.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Transcript mirror can append inbound chat turn after visible assistant delivery, inverting message order and parentId