-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
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 (sendSubagentAnnounceDirectly → callGateway({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
- Open a Slack DM with OpenClaw bot
- Start a thread on any message
- From within the thread, have the agent call
sessions_spawn(task="test") - Wait for subagent completion
- Expected: Announce appears in the thread
- 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
- [Bug]: Subagent announce doesn't preserve Slack assistant app thread context #17731 — Similar symptom but different root cause (assistant app thread sessions)
- Sub-agent announce drops threadId for depth≥1 requesters — completions post to channel instead of thread #22118 — Different: depth≥1 sub-agent chain threadId loss