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:
- User sends a chat message.
- The agent handles it and sends a visible reply via the messaging tool.
- The visible assistant delivery mirror is appended to the session transcript immediately.
- The original inbound user message is flushed into the transcript later.
- 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:
- assistant visible delivery mirror
- user inbound message mirror
instead of:
- user inbound message mirror
- 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.
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:
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 at2026-05-18T07:55:24Z, after the visible assistant delivery mirror had already been appended.The resulting transcript ordering was effectively:
instead of:
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:
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
messagesends 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
parentIdfor a mirrored inbound user message never points to the assistant reply generated by that same inbound turn.