fix: handle string thread_ts from Slack properly

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.
This commit is contained in:
Chloe-VP 2026-01-29 21:14:17 -08:00
parent 4de0bae45a
commit 2d5ce3e29c

View File

@ -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({