openclaw - 💡(How to fix) Fix WebChat / Control UI can duplicate assistant replies in new sessions [2 comments, 3 participants]

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…
GitHub stats
openclaw/openclaw#72073Fetched 2026-04-27 05:35:19
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
0
Timeline (top)
commented ×2closed ×1

In webchat / OpenClaw Control UI, starting a new chat can cause assistant messages to appear twice. The duplication also affected subsequent normal replies in the same session.

Based on logs + session history, this does not look like the model generated two different replies. It looks more like the same assistant message was written/applied twice during new-session initialization, history replay, or state restore.

Root Cause

Notes

This does not look like a pure UI-only duplicate rendering bug, because sessions_history itself already contains the duplicate records.

Code Example

2026-04-26T16:39:33.565+08:00 [ws] ⇄ res ✓ chat.send 66ms runId=6b2ca02e-43d4-4601-a6be-e6f6d87031d1 conn=1d5c9dbd…7664 id=9d3334c1…06ab
RAW_BUFFERClick to expand / collapse

Summary

In webchat / OpenClaw Control UI, starting a new chat can cause assistant messages to appear twice. The duplication also affected subsequent normal replies in the same session.

Based on logs + session history, this does not look like the model generated two different replies. It looks more like the same assistant message was written/applied twice during new-session initialization, history replay, or state restore.

Environment

  • OpenClaw: 2026.4.24
  • Surface: webchat
  • Client label: openclaw-control-ui
  • Session type: direct
  • Observed on: 2026-04-26 16:35-16:40 Asia/Shanghai

What happened

After opening a new session, the first assistant reply appeared twice. Then later replies in the same session also appeared duplicated in pairs.

Key evidence

1) sessions_history contains duplicated records

In agent:main:main, duplicated assistant replies appear as pairs. The same is true for the corresponding user messages.

For each duplicated assistant pair:

  • text is identical
  • timestamp is identical
  • responseId is identical

That strongly suggests this was not two separate model generations.

2) Gateway logs show only a single chat.send

For the relevant window (2026-04-26 16:34:00 to 16:41:30 Asia/Shanghai), logs show only a single chat.send for the duplicated reply window, for example:

2026-04-26T16:39:33.565+08:00 [ws] ⇄ res ✓ chat.send 66ms runId=6b2ca02e-43d4-4601-a6be-e6f6d87031d1 conn=1d5c9dbd…7664 id=9d3334c1…06ab

At the same time, there are many chat.history and sessions.list requests around new-session initialization.

3) Timing lines up with new-session bootstrap / history replay

In the 16:34:58 to 16:35:34 window, there are repeated:

  • chat.history
  • sessions.list
  • models / commands / node list initialization requests

This looks consistent with Control UI bootstrap behavior after opening a fresh session.

Expected

A message should be persisted/applied exactly once.

Actual

The same message seems to be duplicated into session history / applied twice.

Likely area

One of these seems likely:

  1. The first assistant message is applied once from the live event stream and again from chat.history
  2. WebSocket reconnect / state restore re-applies the same message event
  3. Session store append path lacks idempotency for the same stable message / responseId
  4. History merge logic appends without deduping by stable id

Notes

This does not look like a pure UI-only duplicate rendering bug, because sessions_history itself already contains the duplicate records.

If helpful

I can provide a fuller local evidence bundle, but the most important discriminator is:

  • single chat.send in logs
  • duplicated sessions_history records with identical responseId + identical timestamp

extent analysis

TL;DR

The most likely fix involves ensuring idempotency in the session store append path to prevent duplicate messages with the same responseId from being applied.

Guidance

  • Investigate the session store append logic to identify why it lacks idempotency for messages with the same responseId.
  • Verify if the chat.history requests are causing the first assistant message to be applied twice, once from the live event stream and again from history.
  • Check the WebSocket reconnect/state restore mechanism to ensure it does not re-apply the same message event.
  • Review the history merge logic to ensure it dedupes messages by stable id (responseId).

Example

No specific code snippet can be provided without more context, but the fix might involve modifying the session store append logic to check for existing messages with the same responseId before applying a new message.

Notes

The issue seems to be related to the backend logic rather than a UI-only rendering bug, given that sessions_history contains duplicate records. The single chat.send log entry and duplicated sessions_history records with identical responseId and timestamp suggest a problem with message application or storage rather than generation.

Recommendation

Apply a workaround to ensure idempotency in the session store append path, such as checking for existing messages with the same responseId before applying a new message, to prevent duplicate messages from being applied.

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…

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 WebChat / Control UI can duplicate assistant replies in new sessions [2 comments, 3 participants]