fix(slack): ack reactions not executing due to early return on empty text

The ack reaction logic was placed after a check that returns null
if the message has no text content. This prevented ack reactions
from working when users mention the bot without additional text.

Moved ack reaction handling before the text content check so that
acknowledgment reactions work regardless of message content.

Fixes issue where ack reactions were configured correctly but never
appeared in Slack channels or DMs.
This commit is contained in:
Ryan Nelson 2026-01-28 15:07:50 -08:00
parent 109ac1c549
commit 377c40378d

View File

@ -337,8 +337,9 @@ export async function prepareSlackMessage(params: {
maxBytes: ctx.mediaMaxBytes, maxBytes: ctx.mediaMaxBytes,
}); });
const rawBody = (message.text ?? "").trim() || media?.placeholder || ""; const rawBody = (message.text ?? "").trim() || media?.placeholder || "";
if (!rawBody) return null;
// Handle ack reactions BEFORE checking for message content
// This ensures reactions work even for messages with no text body
const ackReaction = resolveAckReaction(cfg, route.agentId); const ackReaction = resolveAckReaction(cfg, route.agentId);
const ackReactionValue = ackReaction ?? ""; const ackReactionValue = ackReaction ?? "";
@ -372,6 +373,8 @@ export async function prepareSlackMessage(params: {
) )
: null; : null;
if (!rawBody) return null;
const roomLabel = channelName ? `#${channelName}` : `#${message.channel}`; const roomLabel = channelName ? `#${channelName}` : `#${message.channel}`;
const preview = rawBody.replace(/\s+/g, " ").slice(0, 160); const preview = rawBody.replace(/\s+/g, " ").slice(0, 160);
const inboundLabel = isDirectMessage const inboundLabel = isDirectMessage