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.
This commit is contained in:
Clawd 2026-01-30 11:04:22 -05:00
parent 09be5d45d5
commit d3b5e28a54

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