From 2d5ce3e29c71386f3ab72a7f11571d6eefe8d03c Mon Sep 17 00:00:00 2001 From: Chloe-VP Date: Thu, 29 Jan 2026 21:14:17 -0800 Subject: [PATCH] fix: handle string thread_ts from Slack properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #4380: The queue drain logic was using typeof === 'number' to check for thread IDs, which fails for Slack where thread_ts is a string like '1737766124.329349'. Changed three occurrences: - Line 43: typeof threadId !== 'number' → threadId == null - Line 49: typeof threadId === 'number' → threadId != null - Line 75: typeof originatingThreadId === 'number' → originatingThreadId != null This allows Slack string thread IDs to be properly recognized while still filtering out undefined/null values. --- src/auto-reply/reply/queue/drain.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/auto-reply/reply/queue/drain.ts b/src/auto-reply/reply/queue/drain.ts index 01361a1ec..aca9cc275 100644 --- a/src/auto-reply/reply/queue/drain.ts +++ b/src/auto-reply/reply/queue/drain.ts @@ -40,13 +40,13 @@ export function scheduleFollowupDrain( const to = item.originatingTo; const accountId = item.originatingAccountId; const threadId = item.originatingThreadId; - if (!channel && !to && !accountId && typeof threadId !== "number") { + if (!channel && !to && !accountId && threadId == null) { return {}; } if (!isRoutableChannel(channel) || !to) { return { cross: true }; } - const threadKey = typeof threadId === "number" ? String(threadId) : ""; + const threadKey = threadId != null ? String(threadId) : ""; return { key: [channel, to, accountId || "", threadKey].join("|"), }; @@ -72,7 +72,7 @@ export function scheduleFollowupDrain( (i) => i.originatingAccountId, )?.originatingAccountId; const originatingThreadId = items.find( - (i) => typeof i.originatingThreadId === "number", + (i) => i.originatingThreadId != null, )?.originatingThreadId; const prompt = buildCollectPrompt({