[Slack] fix: preserve thread context for string threadId in queue drain#5245
[Slack] fix: preserve thread context for string threadId in queue drain#5245cutsome wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/queue/drain.ts
Line: 43:43
Comment:
This line still checks `typeof threadId !== "number"`, which means Slack threads (with string thread IDs) would still hit the early return and not be processed correctly. This is the third location mentioned in the PR description that needs fixing.
```suggestion
if (!channel && !to && !accountId && threadId == null) {
```
How can I resolve this? If you propose a fix, please make it concise. |
78396bb to
a2ea4f3
Compare
|
Hey! I ran into the same issue and submitted #11194 which builds on this approach but adds empty-string edge case protection ( |
|
Closing as duplicate of #4749. If this is incorrect, comment and we can reopen. |
Summary
Fixes:
Queued messages in Slack threads were losing their thread context and being posted to the main channel instead of the thread.
Root Cause
In
src/auto-reply/reply/queue/drain.ts, theoriginatingThreadIdwas only being handled when it was anumbertype (for Telegram topic IDs), but Slack uses string type thread IDs (e.g.,"1769840211.421709").Three locations were checking
typeof threadId === "number", which caused Slack's string-basedthreadIdto be ignored:threadKeygeneration for cross-channel detectionoriginatingThreadIdextraction from queued itemsChanges
Changed all three checks to use
!= nullinstead oftypeof === "number"to support both:Testing
Manually tested by:
Greptile Overview
Greptile Summary
This PR attempts to fix Slack thread context preservation by supporting both number (Telegram) and string (Slack) thread IDs in the queue drain logic. However, the fix is incomplete.
What was changed
threadKeygeneration now usesthreadId != nullinstead oftypeof threadId === "number"originatingThreadIdextraction now usesi.originatingThreadId != nullinstead oftypeof i.originatingThreadId === "number"Critical issue found
The PR description claims three locations were updated, but line 43 was not changed. It still checks
typeof threadId !== "number", which means:return {})Impact
The bug would likely still occur because the early return check on line 43 happens before the other two fixed checks, preventing Slack threads from being processed correctly.
Recommendation
Update line 43 to use
threadId == nullfor consistency with the other two fixes.Confidence Score: 2/5