-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Slack draft cleanup can delete visible final replies after late same-turn payloads #87363
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Slack draft-preview cleanup can still run after a final reply is already visible in the Slack thread. If a late same-turn payload arrives afterward, for example a tool/recovery error after the assistant already produced a final answer, the late fallback path can reuse the draft finalizer and call
draftStream.clear(). In Slack,clear()deletes the draft message, so a user-visible answer can disappear or be replaced by a later cleanup/error payload.This is adjacent to, but narrower than, #83165. That issue is about durable delivery queue recovery and partial media failure. This report is about in-turn Slack draft cleanup after final-visible delivery.
Observed evidence
From a local Slack Socket Mode run, with gateway and Slack connectivity otherwise healthy:
2026-05-28 00:45:22 +08:00.Sensitive details are intentionally omitted: no token, account, full channel id, user id, raw session id, or full Responses item id is included here.
Source-level cause
The Slack dispatch path already protects drafts after an in-place preview finalization by setting
draftPreviewCommitted. However, a visible final reply can also be delivered through normal delivery paths. After that happens, later same-turn payloads can still receive a live draft adapter whendraftPreviewCommittedis false.The relevant behavior is:
extensions/slack/src/draft-stream.ts:clear()calls Slack message delete for the draft message.extensions/slack/src/monitor/message-handler/dispatch.ts: late final/error payloads can still pass the draft into the finalizable live preview adapter unless the draft was finalized in place.src/channels/message/live.ts: fallback normal delivery cleans up the draft after delivery by callingdraft.clear().That fallback cleanup is correct for the first replacement of a transient draft preview, but it should not be reused after the same turn has already produced a visible final reply.
Expected behavior
Once a final reply is visibly delivered for a Slack turn, that turn's final content should be terminal for draft cleanup purposes:
draftStream.clear()on an already visible final/draft message.Proposed fix shape
Track that a visible final reply has already been delivered in Slack dispatch, regardless of whether it was delivered by preview finalization, normal delivery, or native stream delivery. After that flag is set, do not pass the draft stream into later finalizable-preview handling for the same turn.
This keeps the generic live-preview lifecycle unchanged and makes the Slack-specific deletion guard explicit.