-
-
Notifications
You must be signed in to change notification settings - Fork 54.8k
Description
Description
When replyToMode: "all" is configured for Slack, tool notifications (exec:, edit:, cron:, etc.) leak to the main channel instead of staying in the thread where the conversation originated.
Root Cause
Two issues in the Slack message handler:
1. prepare.js - MessageThreadId not set for top-level messages
When a user posts a top-level message (not a thread reply) and replyToMode=all is configured, MessageThreadId should be set to the message's own timestamp so that all subsequent replies and notifications go to that thread.
Current behavior (around line 382):
const messageThreadId = isThreadReply ? threadTs : undefined;Expected behavior:
const messageThreadId = isThreadReply ? threadTs : (ctx.replyToMode === "all" ? message.ts : undefined);2. dock.js - Slack's buildToolContext ignores MessageThreadId
The Slack dock's buildToolContext uses context.ReplyToId for currentThreadTs, but it should prefer MessageThreadId when available (like Telegram does).
Current behavior (around line 167):
currentThreadTs: context.ReplyToId,Expected behavior (matching Telegram's pattern):
currentThreadTs: context.MessageThreadId ?? context.ReplyToId,Steps to Reproduce
- Configure Slack channel with
replyToMode: "all" - Post a top-level message requesting an operation that triggers tool notifications (e.g., file edits, cron updates, git commits)
- Observe that tool notifications appear in the main channel instead of the thread
Expected Behavior
All tool notifications should appear in the thread, not the main channel.
Environment
- Clawdbot version: 2026.1.20
- Channel: Slack with socket mode
- Config:
replyToMode: "all"