fix(slack): preserve string thread context in queue + DM route (#23804)
* fix(slack): preserve thread_ts in queue drain and deliveryContext Two related fixes for Slack thread reply routing: 1. Queue drain drops string thread_ts (#11195) - `typeof threadId === "number"` in drain.ts only matches Telegram numeric topic IDs. Slack thread_ts is a string like "1770474140.187459" which fails the check, causing threadKey to become empty. - Changed to `threadId != null && threadId !== ""` to accept both number and string thread IDs. - Applies to all 3 occurrences in drain.ts: cross-channel detection, thread key building, and collected originatingThreadId extraction. 2. DM deliveryContext missing thread_ts (#10837) - updateLastRoute calls for Slack DMs in both prepare.ts and dispatch.ts built deliveryContext without threadId, so the session's delivery context never included thread_ts for DM threads. - Added threadId from threadContext.messageThreadId / ctxPayload.MessageThreadId to both updateLastRoute call sites. Tests: 3 new cases in queue.collect-routing.test.ts - Collects messages with matching string thread_ts (same Slack thread) - Separates messages with different string thread_ts (different threads) - Treats empty string threadId same as absent Closes #10837, closes #11195 * fix(slack): preserve string thread context in queue + DM route updates --------- Co-authored-by: RobClawd <clawd@RobClawds-Mac-mini.local>
This commit is contained in:
@@ -80,6 +80,7 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
|
||||
channel: "slack",
|
||||
to: `user:${message.user}`,
|
||||
accountId: route.accountId,
|
||||
threadId: prepared.ctxPayload.MessageThreadId,
|
||||
},
|
||||
ctx: prepared.ctxPayload,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user