From d3b5e28a5409d948a7e5b4c78d1646c75ad47f57 Mon Sep 17 00:00:00 2001 From: Clawd Date: Fri, 30 Jan 2026 11:04:22 -0500 Subject: [PATCH] fix: handle string thread IDs in queue drain for Slack Slack thread timestamps are strings (e.g., '1769015989.090599'), not numbers. The type check `typeof threadId === 'number'` caused thread IDs to be dropped when collecting queued messages, resulting in replies going to the main channel instead of the thread. Changed to use null checks (`!= null`) which correctly handles both string and number thread IDs across different providers. --- 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({