openclaw - 💡(How to fix) Fix [Bug]: Chat messages duplicated in Control UI — both user and assistant messages appear twice [1 comments, 2 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#72578Fetched 2026-04-28 06:34:13
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Participants
Timeline (top)
commented ×1cross-referenced ×1subscribed ×1

All messages in the Control UI chat view appear exactly twice, consecutively. Both user and assistant messages are duplicated. This persists across hard browser refresh and occurs immediately in new sessions.

Root Cause

All messages in the Control UI chat view appear exactly twice, consecutively. Both user and assistant messages are duplicated. This persists across hard browser refresh and occurs immediately in new sessions.

RAW_BUFFERClick to expand / collapse

Summary

All messages in the Control UI chat view appear exactly twice, consecutively. Both user and assistant messages are duplicated. This persists across hard browser refresh and occurs immediately in new sessions.

Environment

  • OpenClaw Version: 2026.4.26
  • OS: macOS
  • Primary Model: google/gemini-3-flash-preview
  • Browser: Chrome
  • Gateway Mode: Local (loopback)

Steps to Reproduce

  1. Hard refresh Control UI in browser (Cmd+Shift+R)
  2. Create new session via /new or /reset
  3. Send any message
  4. Observe: message and response both appear twice, back-to-back

Expected Behavior

Each message appears once in chronological order.

Actual Behavior

  • Every message (user + assistant) is rendered twice consecutively
  • Duplicates appear immediately, not after refresh or scroll
  • Scrolling has no effect — duplicates persist
  • Hard refresh and new session don't resolve it
  • Both user and assistant messages affected equally

Investigation Notes

  • Checked DevTools Network tab: WebSocket shows localhost IP only
  • No separate chat.history HTTP requests visible
  • Suggests duplication happens at data layer (Gateway API response) or state management

Affected Code Paths

  • ui/src/ui/controllers/chat.tsloadChatHistory() and preserveOptimisticTailMessages()
  • ui/src/ui/chat/build-chat-items.tsbuildChatItems()
  • Message array could have overlaps from multiple sources

Related

  • Commit Apr 15, 2026: "fix(ui): skip chat history reload during active sends to prevent mess…"
  • Possible regression introduced by recent chat history work

extent analysis

TL;DR

The issue can likely be resolved by reviewing and adjusting the preserveOptimisticTailMessages() function in ui/src/ui/controllers/chat.ts to prevent duplicate message rendering.

Guidance

  • Investigate the loadChatHistory() function to ensure it's not inadvertently loading duplicate messages.
  • Check the buildChatItems() function in ui/src/ui/chat/build-chat-items.ts for any logic that might be causing messages to be added twice to the chat history.
  • Verify that the recent commit "fix(ui): skip chat history reload during active sends to prevent mess…" did not introduce a regression that's causing this issue.
  • Review the message array handling in ui/src/ui/controllers/chat.ts and ui/src/ui/chat/build-chat-items.ts to identify any potential overlaps or duplicates.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The root cause of the issue is likely related to the recent changes in chat history handling, and resolving this will require a careful review of the affected code paths.

Recommendation

Apply a workaround by temporarily reverting the recent commit "fix(ui): skip chat history reload during active sends to prevent mess…" to see if it resolves the issue, and then reapply the fix with additional logging or debugging to identify the root cause.

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 [Bug]: Chat messages duplicated in Control UI — both user and assistant messages appear twice [1 comments, 2 participants]