Skip to content

Slack: Tool notifications leak to main channel when replyToMode=all #1388

@0xble

Description

@0xble

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

  1. Configure Slack channel with replyToMode: "all"
  2. Post a top-level message requesting an operation that triggers tool notifications (e.g., file edits, cron updates, git commits)
  3. 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"

Metadata

Metadata

Assignees

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