openclaw - 💡(How to fix) Fix Bug: webchat 发送消息显示 4 次,sender 为 openclaw-control-ui [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#72742Fetched 2026-04-28 06:32:41
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
closed ×1commented ×1
RAW_BUFFERClick to expand / collapse

Bug: webchat 消息重复显示 — 同一消息显示 4 次,sender 为 openclaw-control-ui

版本: OpenClaw v2026.4.24 环境: macOS,Chrome,localhost:18789 复现: webchat 发送消息,按一次,消息显示 4 次(2 次真实身份,2 次 openclaw-control-ui)

现象

  • 用户消息在 UI 上显示 4 次(2 次发送人为真实身份,2 次发送人为 openclaw-control-ui
  • 助手回复显示 2 次
  • 每条消息内容完全相同
  • 稳定复现,100% 触发
  • 文字消息也会触发,不限于图片

日志证据

sender metadata = {\"label\": \"openclaw-control-ui\", \"id\": \"openclaw-control-ui\"}

Gateway 只收到 1 条消息(无重复入站),问题出在 control-ui 的 webchat 渲染层。

根因(供 maintainer 参考)

control-ui/assets/index-ckUmEo1l.js 第 2353 行 mc() 函数用于合并 chat.history 和本地消息,有两个逻辑问题:

  1. if (r < 0) return e; — 当本地消息为空时应返回 [...e, ...t],而非 e
  2. 循环中遇到重复就 return(应 continue),导致后续新消息被漏掉

复现步骤

  1. 打开 Chrome,访问 http://localhost:18789
  2. 进入 webchat 会话
  3. 发送任意文字消息(按一次发送)
  4. 观察:消息显示 4 次,2 次发送人为 openclaw-control-ui

extent analysis

TL;DR

Fix the mc() function in control-ui/assets/index-ckUmEo1l.js to correctly merge chat.history and local messages.

Guidance

  • Review the mc() function at line 2353 in control-ui/assets/index-ckUmEo1l.js to address the two logical issues:
    • Return [...e, ...t] when local messages are empty.
    • Use continue instead of return when encountering duplicates to prevent skipping new messages.
  • Verify the fix by sending a message in the webchat and checking if the message is displayed only once.
  • Test with different message types (e.g., text, images) to ensure the fix is not specific to a particular type.

Example

// Example of corrected mc() function
function mc(e, t) {
  // ...
  if (r < 0) return [...e, ...t]; // Return merged array when local messages are empty
  // ...
  for (/* loop variables */) {
    // ...
    if (/* duplicate condition */) {
      continue; // Skip to next iteration instead of returning
    }
    // ...
  }
  // ...
}

Notes

The provided fix assumes that the mc() function is the root cause of the issue. If the problem persists after applying the fix, further investigation may be necessary.

Recommendation

Apply the workaround by fixing the mc() function, as it directly addresses the identified logical issues in the code.

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: webchat 发送消息显示 4 次,sender 为 openclaw-control-ui [1 comments, 2 participants]