Skip to content

[Bug]: Slack outbound adapter ignores threadId from delivery context — subagent announces land in main DM #22483

@dorukardahan

Description

@dorukardahan

Summary

Subagent completion announcements (via sessions_spawn) always land in the main Slack DM instead of the originating thread. The threadId is correctly passed through the entire announce pipeline (sendSubagentAnnounceDirectlycallGateway({method: "send"})deliverOutboundPayloads) but the Slack channel extension's outbound sendText and sendMedia functions do not destructure threadId from the delivery context.

Root Cause

In extensions/slack/src/channel.ts, the outbound sendText function:

sendText: async ({ to, text, accountId, deps, replyToId, cfg }) => {
  // ...
  const result = await send(to, text, {
    threadTs: replyToId ?? undefined,  // ❌ only uses replyToId, ignores threadId
  });
}

The delivery context carries threadId (set from deliveryContext.threadId of the requester session), but it is never destructured or used. Only replyToId is mapped to threadTs.

Fix

sendText: async ({ to, text, accountId, deps, replyToId, threadId, cfg }) => {
  // ...
  const result = await send(to, text, {
    threadTs: replyToId ?? threadId ?? undefined,  // ✅ falls back to threadId
  });
}

Same fix needed for sendMedia.

Steps to Reproduce

  1. Open a Slack DM with OpenClaw bot
  2. Start a thread on any message
  3. From within the thread, have the agent call sessions_spawn(task="test")
  4. Wait for subagent completion
  5. Expected: Announce appears in the thread
  6. Actual: Announce appears in the main DM (top-level)

Debug Evidence

Added logging to sendMessageSlack — confirmed threadTs=NONE despite threadId being present throughout the announce flow:

[ANNOUNCE-FLOW-START] threadId="1771478217.865789" ✅
[COMPLETION-PATH] threadId="1771478217.865789" ✅  
[SLACK-SEND] threadTs=NONE ❌

After fix:

[SLACK-SEND] threadTs=1771478217.865789 ✅

Environment

  • OpenClaw 2026.2.19-2
  • Slack channel (non-assistant-app, regular DM threads)
  • Linux x64

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions