fix(slack): queue drain drops string thread_ts — replies leak to main channel instead of thread#11194
Closed
Lukavyi wants to merge 1 commit intoopenclaw:mainfrom
Closed
Conversation
…d reply leaks The queue drain logic used `typeof threadId === 'number'` to check for thread IDs, which silently dropped Slack's string-based thread_ts values (e.g. '1770474140.187459'). This caused queued thread replies to lose their thread context and leak into the main channel. Replace type-narrowing checks with `threadId != null && threadId !== ''` to support both numeric (Telegram topic IDs) and string (Slack thread_ts) thread identifiers. Also treats empty string threadId as absent to prevent incorrect grouping when providers normalize missing values to ''. Fixes openclaw#4380
This was referenced Feb 7, 2026
Lukavyi
added a commit
to Lukavyi/openclaw
that referenced
this pull request
Feb 7, 2026
bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
Member
|
Thanks for digging into this queue-drain bug. Closing as superseded by merged #23804, which already carries the string If you still see leakage after latest |
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
Queue drain uses
typeof threadId === "number"which silently drops Slack's stringthread_ts, causing queued replies to leak to the main channel instead of the thread.lobster-biscuit
Repro Steps
replyToMode: allRoot Cause
src/auto-reply/reply/queue/drain.tsusestypeof threadId === "number"in 3 places. Telegram uses numeric topic IDs (passes check), Slack uses stringthread_tslike"1770474140.187459"(fails check). The type inqueue/types.tswas updated tostring | numberwhen Slack threading was added, butdrain.tswas not updated.Behavior Changes
thread_ts) now preserved during queue drain""treated as absent (prevents spurious thread grouping if any provider normalizes missing values to"")Codebase and GitHub Search
originatingThreadId,typeof.*number.*threadId,thread_ts.*queueTests
3 new cases in
queue.collect-routing.test.ts:thread_ts(same Slack thread)thread_ts(different threads)Sign-Off
typeof === "number"checks on threadId exist in codebase.Fixes #11195
Related PRs (same fix, but without empty-string edge case protection):
threadId == nullwithout!== ""check. Greptile flagged this gap at Confidence 4/5.!= nullwithout empty-string guard.This PR adds
\&\& threadId !== ""to all 3 locations, addressing the edge case Greptile identified. Also includes 3 new tests (string thread_ts collection, different threads separation, empty-string handling) which the other PRs lack.Related issues: #4380, #4424, #5615
Greptile Overview
Greptile Summary
This PR fixes follow-up queue drain routing so Slack thread replies don't lose their
thread_tscontext during "collect" drains.The drain logic previously treated
originatingThreadIdas present only when it was anumber, which works for Telegram topic IDs but drops Slack's stringthread_tsvalues. The change updates the routing key computation and the collected-batchoriginatingThreadIdselection to treat any non-emptystring | numberas a valid thread id, while treating""as absent to avoid creating spurious thread groups. New tests inqueue.collect-routing.test.tscover same-thread collection, different-thread separation, and empty-string behavior.Confidence Score: 5/5
FollowupRun.originatingThreadId: string | numbertyping, and are covered by targeted unit tests for Slack thread_ts string handling and empty-string edge cases.Greptile review restored manually after accidental body overwrite.