Repository navigation
fix(slack): preserve thread_ts in queue drain and deliveryContext - #11934
Closed
sandieman2 wants to merge 1 commit into
Closed
sandieman2 wants to merge 1 commit into
sandieman2 wants to merge 1 commit into
Conversation
Two related fixes for Slack thread reply routing: 1. Queue drain drops string thread_ts (openclaw#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 (openclaw#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 openclaw#10837, closes openclaw#11195
thewilloftheshadow
force-pushed
the
main
branch
from
February 15, 2026 18:46
bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
This was referenced Feb 22, 2026
Member
|
Thanks for the detailed Slack thread-context fix. I’m closing this in favor of #23804, which rebases this change cleanly on current Your contribution is preserved in the replacement branch. If any behavior drifted, point me to it and I can reopen immediately. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related fixes for Slack thread reply routing that cause replies meant for threads to leak to the main channel.
Bug 1: Queue drain drops string thread_ts (#11195)
typeof threadId === "number"indrain.tsonly matches Telegram numeric topic IDs. Slackthread_tsis a string like"1770474140.187459"which fails the check, causingthreadKeyto become empty. Queued replies then lose their thread context and land in the main channel.Fix: Changed to
threadId != null && threadId !== ""to accept both number and string thread IDs. Applied to all 3 occurrences in drain.ts:originatingThreadIdextractionBug 2: DM deliveryContext missing thread_ts (#10837)
updateLastRoutecalls for Slack DMs in bothprepare.tsanddispatch.tsbuilt thedeliveryContextwithoutthreadId, so the session's delivery context never includedthread_tsfor DM threads.Fix: Added
threadIdfromthreadContext.messageThreadId/ctxPayload.MessageThreadIdto bothupdateLastRoutecall sites.Files Changed
src/auto-reply/reply/queue/drain.tssrc/slack/monitor/message-handler/prepare.tssrc/slack/monitor/message-handler/dispatch.tssrc/auto-reply/reply/queue.collect-routing.test.tsTests
3 new cases in
queue.collect-routing.test.ts:thread_ts(same Slack thread)thread_ts(different threads)Prior Art
Behavior Changes
thread_ts) now preserved during queue drain""treated as absent (prevents spurious thread grouping)Closes #10837, closes #11195
Greptile Overview
Greptile Summary
This PR fixes Slack thread reply routing in two places:
thread_ts(string) is preserved when building the collect-grouping key and when extractingoriginatingThreadIdfor the collected run.prepareSlackMessageanddispatchPreparedSlackMessagenow includethreadIdin theupdateLastRoutedeliveryContext so DM thread sessions retainthread_ts.Tests were expanded in
queue.collect-routing.test.tsto cover collecting/separating runs by string thread IDs and treating empty string as absent.Confidence Score: 5/5
(2/5) Greptile learns from your feedback when you react with thumbs up/down!