#21108: slack: keep requireMention thread follow-ups when thread session is active
channel: slack
size: S
Cluster:
Slack Thread Management Improvements
## Summary
- fix Slack mention gating for thread follow-ups when `requireMention=true`
- treat a thread reply as implicitly mentioned when either:
- `parent_user_id === botUserId` (existing behavior), or
- the thread session already exists in the session store (new behavior)
- add regression coverage in `prepare.test.ts` to ensure unmentioned follow-up thread replies are accepted once the thread session is active
## Why
Slack thread roots started by humans often have `parent_user_id != botUserId`, which can cause follow-up no-mention messages in the same active thread session to be dropped despite prior interaction.
## Validation
- `corepack pnpm exec vitest run src/slack/monitor/message-handler/prepare.test.ts`
- `13 passed`
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes Slack mention gating for thread follow-ups when `requireMention=true`. Previously, unmentioned thread replies from human-started threads could be dropped despite an active session. The PR adds a check for existing thread sessions (`existingThreadSessionUpdatedAt`) and treats replies in active thread sessions as implicitly mentioned.
- Moves `storePath` resolution and `existingThreadSessionUpdatedAt` check earlier in the flow (before mention gating logic)
- Updates `implicitMention` to include `threadSessionHasHistory` condition alongside existing `parent_user_id === botUserId` check
- Removes redundant `ctx.botUserId` check from `implicitMention` (still implicitly required via `parent_user_id` check)
- Adds regression test covering unmentioned follow-ups in active thread sessions with `requireMention: true`
<h3>Confidence Score: 4/5</h3>
- Safe to merge with minimal risk - focused fix for mention gating edge case with test coverage
- The changes are well-scoped, addressing a specific bug in thread mention gating. The logic is sound: checking for existing thread sessions prevents dropping follow-up messages in active conversations. Test coverage validates the fix. Minor concern: removing `ctx.botUserId` check from `implicitMention` could theoretically allow messages through when botUserId is undefined, but the `parent_user_id === ctx.botUserId` comparison already handles this safely (returns false when botUserId is undefined).
- No files require special attention
<sub>Last reviewed commit: b124544</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#7719: fix(slack): thread replies with @mentions dropped in requireMention...
by SocialNerd42069 · 2026-02-03
86.4%
#19419: feat(slack): track thread participation for implicit mentions
by Utkarshbhimte · 2026-02-17
85.5%
#22433: Slack: fix thread context loss after session reset
by stgarrity · 2026-02-21
85.2%
#19083: Slack: preserve per-thread context and consistent thread replies
by jkimbo · 2026-02-17
82.8%
#16223: feat(slack): sticky thread routing — bypass @mention in active threads
by iamfuntime · 2026-02-14
82.3%
#20406: fix(slack): respect replyToMode when computing statusThreadTs in DMs
by QuinnYates · 2026-02-18
81.9%
#20152: fix(slack): allow app_mention events to bypass dedup cache
by nova-openclaw-cgk · 2026-02-18
81.8%
#23320: fix(slack): respect replyToMode when incomingThreadTs is auto-created
by dorukardahan · 2026-02-22
80.9%
#20389: fix(slack): inject thread history on first thread turn, not only on...
by lafawnduh1966 · 2026-02-18
80.6%
#5935: fix(slack): persist thread starter body across thread messages
by thisischappy · 2026-02-01
79.8%