fix(openclaw): prevent duplicate replies from late chat events#1844
fix(openclaw): prevent duplicate replies from late chat events#1844
Conversation
After handleEndTurn() resets currentStreamMsgId to null, late-arriving chat.event delta/final events would create a new msg_id and re-emit the same content, causing users to see duplicate replies in the OpenClaw gateway channel. Add a turnActive flag that is set to true when sendMessage() starts a new turn and reset to false in handleEndTurn(). handleChatEvent() now returns early when turnActive is false, preventing any late events from generating duplicate content messages.
Code Review:fix(openclaw): prevent duplicate replies from late chat events (#1844)变更概述本 PR 在 方案评估结论:✅ 方案合理 标志位生命周期清晰( 问题清单未发现需报告的问题。代码逻辑正确,边界情况覆盖完整,测试充分,lint baseline 中唯一警告(第 285 行 汇总无问题。 结论✅ 批准合并 — 修复方案简洁正确,5 个针对性测试覆盖了所有关键边界情况,无阻塞性问题。 本报告由本地 CONCLUSION: APPROVED |
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
Summary
handleEndTurn()resetscurrentStreamMsgIdto null, late-arrivingchat.eventdelta/final events would create a newmsg_idand re-emit the same content as a "new" messageturnActiveflag toOpenClawAgentthat blocks chat event processing after turn completiontrueinsendMessage()andfalseinhandleEndTurn()Related Issues
Closes #1281
Test Plan
tsc --noEmit)