From 38f61564ac1ddcbbde7436988c28c72f2ee2b705 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 15 Mar 2026 18:51:09 -0700 Subject: [PATCH] Reply: keep shared interactive payloads during normalization --- src/auto-reply/reply/normalize-reply.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/auto-reply/reply/normalize-reply.ts b/src/auto-reply/reply/normalize-reply.ts index 793cbcc326f..9ef5a7a9d90 100644 --- a/src/auto-reply/reply/normalize-reply.ts +++ b/src/auto-reply/reply/normalize-reply.ts @@ -32,11 +32,12 @@ export function normalizeReplyPayload( opts: NormalizeReplyOptions = {}, ): ReplyPayload | null { const hasMedia = Boolean(payload.mediaUrl || (payload.mediaUrls?.length ?? 0) > 0); + const hasInteractive = (payload.interactive?.blocks.length ?? 0) > 0; const hasChannelData = Boolean( payload.channelData && Object.keys(payload.channelData).length > 0, ); const trimmed = payload.text?.trim() ?? ""; - if (!trimmed && !hasMedia && !hasChannelData) { + if (!trimmed && !hasMedia && !hasInteractive && !hasChannelData) { opts.onSkip?.("empty"); return null; } @@ -44,7 +45,7 @@ export function normalizeReplyPayload( const silentToken = opts.silentToken ?? SILENT_REPLY_TOKEN; let text = payload.text ?? undefined; if (text && isSilentReplyText(text, silentToken)) { - if (!hasMedia && !hasChannelData) { + if (!hasMedia && !hasInteractive && !hasChannelData) { opts.onSkip?.("silent"); return null; } @@ -55,7 +56,7 @@ export function normalizeReplyPayload( // silent just like the exact-match path above. (#30916, #30955) if (text && text.includes(silentToken) && !isSilentReplyText(text, silentToken)) { text = stripSilentToken(text, silentToken); - if (!text && !hasMedia && !hasChannelData) { + if (!text && !hasMedia && !hasInteractive && !hasChannelData) { opts.onSkip?.("silent"); return null; } @@ -71,7 +72,7 @@ export function normalizeReplyPayload( if (stripped.didStrip) { opts.onHeartbeatStrip?.(); } - if (stripped.shouldSkip && !hasMedia && !hasChannelData) { + if (stripped.shouldSkip && !hasMedia && !hasInteractive && !hasChannelData) { opts.onSkip?.("heartbeat"); return null; } @@ -81,7 +82,7 @@ export function normalizeReplyPayload( if (text) { text = sanitizeUserFacingText(text, { errorContext: Boolean(payload.isError) }); } - if (!text?.trim() && !hasMedia && !hasChannelData) { + if (!text?.trim() && !hasMedia && !hasInteractive && !hasChannelData) { opts.onSkip?.("empty"); return null; }