Repository navigation
Description
Summary
On Slack, a single inbound system event is rendered twice in one assembled turn. The notification header System: [timestamp] Slack DM from <user> appears both inside an OpenClaw runtime context for the immediately preceding user message wrapper and again standalone just before the raw user text, with the same timestamp and the same label. The user body itself is delivered once; it is the system-event header that is duplicated.
This is distinct from the preview fix in #94549 / #94589. That change removed the 160-character body preview from the enqueued system event, so each header is now notification-only. It did not change how many times the event is rendered. Before that fix each of the two copies carried the truncated preview (so a message appeared three times: two previews plus the raw body); after it, the two copies are label-only, but there are still two of them. Removing the duplicate rendering was out of scope for that PR.
Environment
OpenClaw 2026.6.1, Linux, Node 24. Channel: Slack (first-party @openclaw/slack), direct message.
Reproduction
- Send any inbound message from Slack.
- Capture the model-facing request (the provider payload).
- Observe the same
System:header in two separate messages of the same turn.
Evidence (redacted model-facing payload, one turn)
Two adjacent messages in the same request, identical timestamp:
Message A (a standalone runtime-context message immediately preceding the user turn):
OpenClaw runtime context for the immediately preceding user message.
This context is runtime-generated, not user-authored. Keep internal details private.
System: [2026-06-20 13:59:51] Slack DM from <user>
Message B (the user message itself, header prepended before the raw text):
Conversation info (untrusted metadata):
{ ...redacted... }
Sender (untrusted metadata):
{ ...redacted... }
System: [2026-06-20 13:59:51] Slack DM from <user>
<the actual user text>
Both System: lines carry the same timestamp, confirming this is one event rendered twice in a single turn, not conversation-history replay (which would differ in timestamp) and not a second model call.
Channel contrast
A Telegram direct message in the same setup produces no System: header at all: the Telegram inbound path does not enqueue an inbound system event, so the user message arrives bare (no header, no metadata wrapper). The duplication is specific to channels that enqueue an inbound system event, which Slack does.
Likely area (hypothesis, for maintainer confirmation)
The two render sites appear to be:
- The runtime-context split that extracts runtime-generated context into a separate
OpenClaw runtime context for the immediately preceding user messagemessage. - The reply-body assembly that prepends the drained system-event block into the user prompt body.
The drained inbound system event seems to be carried by both paths in the same turn, so the header is both extracted into the runtime-context message and left prepended in the body, rather than appearing once. Maintainers can confirm the exact flow.
Impact
Low severity, no data loss. The body is intact and the header is label-only since #94589, so this is a small amount of duplicated metadata per inbound turn: a redundant context block, a few wasted tokens, and a slightly inconsistent turn structure presented to the model. It is most visible on channels that enqueue inbound system events, and it compounds visually in busy multi-party Slack conversations.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 20, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 9:39 AM ET / 13:39 UTC.
Summary
Keep open. Current main still has the source shape that can render the same Slack inbound system-event label in both runtime context and the model-facing user body, and an open closing PR already owns the candidate fix.
Reproducibility: Do we have a high-confidence way to reproduce the issue? Medium source confidence: current main shows the Slack event entering the prompt pipeline and the runtime splitter can leave the same label in the model prompt, but I did not run a live Slack provider-payload capture.
Root-cause cluster
Relationship:
canonicalCanonical: #95323
Summary: This issue is the canonical report for the Slack duplicate system-event label; the main viable implementation path is the open runtime-context/modelPrompt fix PR.
Members:
fixed_by_candidate: fix(agents): strip system-event prefix from modelPrompt when before_prompt_build hooks add context #95349 - Open PR with closing syntax for this issue and a runtime-context/modelPrompt split fix with focused regression tests.partial_overlap: fix(slack): prevent duplicate system event rendering #95445 - Open PR for the same visible symptom, but the existing review says it changes the drain accumulator rather than the runtime-context/modelPrompt root path.partial_overlap: fix(channels): stop duplicating inbound previews in system events #94589 - Merged preview-removal PR fixed duplicated/truncated body previews, while this issue explicitly reports the remaining label-only double render.partial_overlap: Inbound System: event preview truncates body at 160 chars and fuses into the metadata block (still reproduces on 2026.6.1; re-file of #67503) #94549 - Earlier issue tracked the body-preview/truncation variant and is closed by the merged preview-removal PR; this issue is the remaining label-only duplicate.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Ways to help us reproduce this
Next step
This issue already has an open closing PR, so the next action is to review and land or close that PR rather than queue a second repair job.
Review details
Best possible solution:
Review and land or decline #95349; if it lands, this issue can close as implemented by that runtime-context/modelPrompt fix.
Do we have a high-confidence way to reproduce the issue?
Do we have a high-confidence way to reproduce the issue? Medium source confidence: current main shows the Slack event entering the prompt pipeline and the runtime splitter can leave the same label in the model prompt, but I did not run a live Slack provider-payload capture.
Is this the best way to solve the issue?
Is this the best way to solve the issue? Yes: the narrow maintainable path is the existing runtime-context/modelPrompt split fix or equivalent model-boundary repair, not removing Slack's label-only enqueue or losing drained events across refresh.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 11a2e03bd4de.
Label changes
Label changes:
clawsweeper:linked-pr-open: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.Label justifications:
P2: The report describes a normal-priority Slack prompt correctness bug with limited channel blast radius.impact:message-loss: The issue is about duplicated model-visible inbound channel metadata in Slack turns.Evidence reviewed
What I checked:
AGENTS.md:10, 11a2e03bd4de)VISION.md:14, 11a2e03bd4de)Slack DM from ...as a system event with a Slack message context key; the preview fix did not remove this event from the prompt pipeline. (extensions/slack/src/monitor/message-handler/prepare.ts:1134, 11a2e03bd4de)drainFormattedSystemEventsconsumes queued entries and formats them asSystem: [timestamp] ..., matching the duplicated header form in the report. (src/auto-reply/reply/session-system-events.ts:103, 11a2e03bd4de)buildReplyPromptBodiesjoinssystemEventBlocksand prepends them to the effective and queued body paths while keeping transcript text separate. (src/auto-reply/reply/prompt-prelude.ts:38, 11a2e03bd4de)get-reply-rundrains system events, stores them indrainedSystemEventBlocks, and passes them intobuildReplyPromptEnvelope, which keeps the event-prefixed body on the model path. (src/auto-reply/reply/get-reply-run.ts:803, 11a2e03bd4de)Likely related people:
src/agents/embedded-agent-runner/run/runtime-context-prompt.ts,src/agents/embedded-agent-runner/run/attempt.ts,src/auto-reply/reply/get-reply-run.ts)extensions/slack/src/monitor/message-handler/prepare.ts,src/auto-reply/reply/prompt-prelude.ts,src/auto-reply/reply/session-system-events.ts)extensions/slack/src/monitor/message-handler/prepare.ts,extensions/slack/src/monitor/message-handler/prepare.test.ts,extensions/msteams/src/monitor-handler/message-handler.ts)src/agents/embedded-agent-runner/run/runtime-context-prompt.ts,src/agents/embedded-agent-runner/run/runtime-context-prompt.test.ts,src/agents/embedded-agent-runner/run/attempt.llm-boundary.test.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.fix(slack): prevent duplicate system event rendering
gorkem2020 commentedon Jun 27, 2026
Live repro on 2026.6.10 (Slack DM). Posting for the
needs-live-reprolabel.For a single inbound Slack DM turn, the model-facing prompt contains the
System: [<ts>] Slack DM from <sender>wrapper line twice:<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>runtime-context block (next to theOpenClaw runtime context for the immediately preceding user message.header, which appears once), andExpected: the wrapper line appears once per turn.
Actual: it appears twice.
Confirmed on a clean 2026.6.10 build (core +
@openclaw/slack2026.6.10). The merged body-preview removal (#94589) stripped the body preview but not this wrapper-line duplication. Cosmetic in isolation, but it duplicates the inbound metadata line every Slack turn and compounds across agents sharing a channel.