openclaw - 💡(How to fix) Fix Slack: native streaming gate excludes DMs even though chat.startStream accepts recipient_user_id [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#72340Fetched 2026-04-27 05:31:20
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
closed ×1commented ×1cross-referenced ×1

When channels.slack.streaming = { mode: "partial", nativeTransport: true } (default), DMs to the bot never use Slack's native streaming API (chat.startStream / chat.appendStream / chat.stopStream). They always hit the non-streaming fallback path, which posts each text-between-tools assistant block as a separate, growing Slack message.

Reproduced on 2026.4.24. The gate exists in earlier releases as well based on the surrounding code shape.

Root Cause

When channels.slack.streaming = { mode: "partial", nativeTransport: true } (default), DMs to the bot never use Slack's native streaming API (chat.startStream / chat.appendStream / chat.stopStream). They always hit the non-streaming fallback path, which posts each text-between-tools assistant block as a separate, growing Slack message.

Reproduced on 2026.4.24. The gate exists in earlier releases as well based on the surrounding code shape.

Code Example

const streamThreadTs = replyPlan.nextThreadTs();
plannedThreadTs = streamThreadTs;
if (!streamThreadTs) {
    logVerbose("slack-stream: no reply thread target for stream start, falling back to normal delivery");
    streamFailed = true;
    await deliverNormally({
        payload: params.payload,
        kind: params.kind
    });
    return;
}
// ...
streamSession = await startSlackStream({
    client: ctx.app.client,
    channel: message.channel,
    threadTs: streamThreadTs,
    text,
    teamId: await resolveSlackStreamRecipientTeamId({
        client: ctx.app.client,
        token: ctx.botToken,
        userId: message.user,
        fallbackTeamId: ctx.teamId
    }),
    userId: message.user
});

---

if (!streamThreadTs && !message.user) {
    // ...existing fallback...
}
RAW_BUFFERClick to expand / collapse

Summary

When channels.slack.streaming = { mode: "partial", nativeTransport: true } (default), DMs to the bot never use Slack's native streaming API (chat.startStream / chat.appendStream / chat.stopStream). They always hit the non-streaming fallback path, which posts each text-between-tools assistant block as a separate, growing Slack message.

Reproduced on 2026.4.24. The gate exists in earlier releases as well based on the surrounding code shape.

Where

dist/extensions/slack/pipeline.runtime-<hash>.js, in the streaming start branch:

const streamThreadTs = replyPlan.nextThreadTs();
plannedThreadTs = streamThreadTs;
if (!streamThreadTs) {
    logVerbose("slack-stream: no reply thread target for stream start, falling back to normal delivery");
    streamFailed = true;
    await deliverNormally({
        payload: params.payload,
        kind: params.kind
    });
    return;
}
// ...
streamSession = await startSlackStream({
    client: ctx.app.client,
    channel: message.channel,
    threadTs: streamThreadTs,
    text,
    teamId: await resolveSlackStreamRecipientTeamId({
        client: ctx.app.client,
        token: ctx.botToken,
        userId: message.user,
        fallbackTeamId: ctx.teamId
    }),
    userId: message.user
});

Why this is wrong

startSlackStream(...) already passes recipient_team_id and recipient_user_id through to client.chatStream({...}) (visible in the same bundle), and Slack's chat.startStream accepts those as the keying alternative to thread_ts for DM contexts.

The early-return on !streamThreadTs blocks every top-level DM from reaching that call, even though all required recipient context (message.user, resolved teamId) is in scope.

Reproduction

  1. Configure a Slack bot with channels.slack.streaming.mode = "partial" and channels.slack.streaming.nativeTransport = true (defaults).
  2. DM the bot a prompt that triggers a multi-tool agent loop (one that produces multiple text-between-tools narration blocks).
  3. Observe that each narration block lands as a new Slack message instead of editing the live draft.

Suggested fix

Loosen the precondition to also let DMs through when a recipient userId is available, and let the BENIGN_SLACK_FINALIZE_ERROR_CODES recovery path catch any Slack-side rejections:

if (!streamThreadTs && !message.user) {
    // ...existing fallback...
}

Plus a small follow-up: the deliveryTracker and rememberDeliveredThreadTs calls downstream key on threadTs for dedup. For DMs that key collapses to undefined. In practice it has been fine in single-turn DMs (each turn opens a fresh stream session), but a more correct dedup key for DMs would be the returned message ts from the stream start, plumbed back through streamSession.

Severity

Medium. The fallback path is functional but its UX is bad enough that operators turn streaming off entirely. The fix is essentially a one-line gate change since the underlying transport already supports it.

extent analysis

TL;DR

The issue can be fixed by loosening the precondition to allow DMs to use the native streaming API when a recipient userId is available.

Guidance

  • Update the condition to check for both streamThreadTs and message.user to allow DMs to use the native streaming API.
  • Verify that the fix works by testing DMs to the bot with channels.slack.streaming.mode = "partial" and channels.slack.streaming.nativeTransport = true.
  • Consider updating the dedup key for DMs to use the returned message ts from the stream start instead of threadTs.
  • Test the fix with multi-tool agent loops to ensure that narration blocks are edited in a single Slack message instead of creating new ones.

Example

if (!streamThreadTs && !message.user) {
    logVerbose("slack-stream: no reply thread target for stream start, falling back to normal delivery");
    streamFailed = true;
    await deliverNormally({
        payload: params.payload,
        kind: params.kind
    });
    return;
}

Notes

The fix is a one-line gate change, and the underlying transport already supports it. However, additional changes may be needed to update the dedup key for DMs.

Recommendation

Apply the suggested fix to loosen the precondition and allow DMs to use the native streaming API. This should improve the UX for operators and fix the issue with multiple narration blocks being posted as separate Slack messages.

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 Slack: native streaming gate excludes DMs even though chat.startStream accepts recipient_user_id [1 comments, 2 participants]