From 24399137ae78d2db82729d3e16c397d3a1aae6b8 Mon Sep 17 00:00:00 2001 From: Mac Bennett Date: Mon, 26 Jan 2026 17:24:23 -0500 Subject: [PATCH] fix(slack): route DM replies to original channel, not App Home MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When @mentioned in a DM between two other users, replies were going to the sender's App Home instead of the original DM channel. Root cause: `user:${message.user}` target triggers `conversations.open()` in send.ts, which opens a new bot↔user DM rather than using the original channel ID. Fix: Always use `channel:${message.channel}` for the reply target. The Slack API accepts channel IDs for all conversation types. Note: lastRoute tracking (line 538) intentionally still uses user:X for identity/session purposes. Fixes #2412 Co-Authored-By: Warp --- src/slack/monitor/message-handler/prepare.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slack/monitor/message-handler/prepare.ts b/src/slack/monitor/message-handler/prepare.ts index 8a2a9e111..d8f587afb 100644 --- a/src/slack/monitor/message-handler/prepare.ts +++ b/src/slack/monitor/message-handler/prepare.ts @@ -437,7 +437,10 @@ export async function prepareSlackMessage(params: { }); } - const slackTo = isDirectMessage ? `user:${message.user}` : `channel:${message.channel}`; + // Always use channel ID for replies - user:X triggers conversations.open which + // creates a bot↔user DM (App Home) instead of posting to the original channel. + // This broke @mentions in DMs between two other users. See #2412. + const slackTo = `channel:${message.channel}`; const channelDescription = [channelInfo?.topic, channelInfo?.purpose] .map((entry) => entry?.trim())