fix(slack): prevent duplicate system event rendering#95445
fix(slack): prevent duplicate system event rendering#95445moguangyu5-design wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the linked Slack duplicate-render issue is already owned by a viable runtime-context/modelPrompt fix, while this branch targets the drain accumulator and can drop one-shot system-event context during prompt refresh. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this branch in favor of reviewing and landing or declining #95349, then let the linked Slack duplicate-render issue close from that runtime-context/modelPrompt fix if it lands. So I’m closing this here and keeping the remaining discussion on #95349. Review detailsBest possible solution: Close this branch in favor of reviewing and landing or declining #95349, then let the linked Slack duplicate-render issue close from that runtime-context/modelPrompt fix if it lands. Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Medium: the linked issue now includes a live 2026.6.10 Slack DM repro, and source inspection maps the duplicate render path, but I did not run a live Slack provider-payload capture in this read-only review. Is this the best way to solve the issue? Is this the best way to solve the issue? No. This PR changes the one-shot drain accumulator, while the narrow maintainable fix belongs at the runtime-context/modelPrompt split where the extracted event remains in the model-facing prompt. Security review: Security review cleared: The diff only changes prompt assembly variable scope and adds a comment-only test file; it does not touch secrets, dependencies, workflows, package metadata, or code-execution surfaces. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 78f7de01c1aa. |
Move drainedSystemEventBlocks declaration inside rebuildPromptBodies to ensure each call creates an independent array. Previously the array was declared in the outer scope, causing system events to accumulate across multiple rebuildPromptBodies calls within the same turn, leading to duplicate system event rendering in prompts. Fixes openclaw#95323 Co-Authored-By: Claude Sonnet 4.6 <noreply.anthropic.com>
cba0a80 to
0c749d9
Compare
What Problem This Solves
系统事件块在prompt中出现重复,导致Slack会话上下文膨胀和token浪费。同一turn内多次调用
rebuildPromptBodies时,闭包外部的drainedSystemEventBlocks数组会累积之前的内容,造成重复渲染。Evidence
Verifiable Behavior
session.test.ts(114 tests) 和get-reply-run.media-only.test.ts(82 tests)Technical Evidence
drainedSystemEventBlocks在闭包外部声明,跨调用累积src/auto-reply/reply/get-reply-run.ts(2 line moves)Regression Risk
Why This Change Was Made
修复闭包作用域错误,确保每次prompt重建时系统事件列表是新鲜的,不携带历史累积。
User Impact