#6003: feat(slack): auto-follow threads where bot was mentioned in root message
channel: slack
Cluster:
Slack Thread Management Improvements
## Summary
Closes #6005
Closes #6002
When a user mentions the bot in a Slack channel message, the bot now automatically follows the resulting thread — subsequent replies no longer require re-mentioning the bot.
## Changes
- **New:** `src/slack/monitor/thread-mention-cache.ts` — Bounded LRU cache (max 1000 entries, 1h TTL) that tracks `channelId:threadTs` pairs where the bot was explicitly mentioned in the root message
- **Modified:** `src/slack/monitor/message-handler/prepare.ts` — Records mentions for root-level messages; checks cache during thread reply processing to set `implicitMention = true`
- **New:** `src/slack/monitor/thread-mention-cache.test.ts` — Unit tests for the cache
- **Modified:** `src/channels/mention-gating.test.ts` — Added test case for implicit mention (thread auto-follow scenario)
## How it works
1. When a channel message explicitly mentions the bot and is NOT a thread reply, record `{channelId, messageTs}` in the cache
2. When processing a thread reply, look up `{channelId, threadTs}` in the cache
3. If found (and not expired), treat the reply as an implicit mention → bypasses `requireMention` gating
## Testing
- 10 tests pass (6 mention-gating + 4 thread-mention-cache)
- TypeScript compiles clean (`tsc --noEmit`)
- Lint clean (`oxlint`)
- Format clean (`oxfmt`)
## AI Disclosure
- [x] AI-assisted (built with Claude)
- [x] Fully tested
- [x] I understand what the code does
Most Similar PRs
#19419: feat(slack): track thread participation for implicit mentions
by Utkarshbhimte · 2026-02-17
75.3%
#21108: slack: keep requireMention thread follow-ups when thread session is...
by JayElRay · 2026-02-19
74.9%
#16223: feat(slack): sticky thread routing — bypass @mention in active threads
by iamfuntime · 2026-02-14
74.4%
#7719: fix(slack): thread replies with @mentions dropped in requireMention...
by SocialNerd42069 · 2026-02-03
71.1%
#20152: fix(slack): allow app_mention events to bypass dedup cache
by nova-openclaw-cgk · 2026-02-18
69.9%
#23320: fix(slack): respect replyToMode when incomingThreadTs is auto-created
by dorukardahan · 2026-02-22
68.4%
#16186: fix(slack): thread history on subsequent turns, inbound meta contex...
by markshields-tl · 2026-02-14
68.1%
#10686: fix(slack): use thread-level sessions for channels to prevent conte...
by pablohrcarvalho · 2026-02-06
68.0%
#9985: feat(slack): add channel-aware context for AI Assistant threads
by natedenh · 2026-02-05
67.0%
#15969: fix: per-thread session isolation for Slack DMs when replyToMode is...
by neeravmakwana · 2026-02-14
66.6%