From 90ebd51d70fa3353045836e69f7712ca2f5901e1 Mon Sep 17 00:00:00 2001 From: Ayush Ojha Date: Fri, 30 Jan 2026 00:20:47 -0800 Subject: [PATCH] fix(queue): use null checks for thread ID instead of typeof number The queue drain logic used typeof threadId === "number" to detect thread IDs, but Slack thread timestamps are strings (e.g. "1769742846.264069"). This caused queued replies to lose thread context and post as top-level channel messages. Replace all three typeof === "number" checks with != null so both string and numeric thread IDs are handled correctly. Fixes #4380 --- 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({