← Back to PRs

#21108: slack: keep requireMention thread follow-ups when thread session is active

by JayElRay open 2026-02-19 17:28 View on GitHub →
channel: slack size: S
## 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