feat(slack): add strict_mention gate for channel threads#12258
Closed
ching-kaching wants to merge 1 commit into
Closed
feat(slack): add strict_mention gate for channel threads#12258ching-kaching wants to merge 1 commit into
ching-kaching wants to merge 1 commit into
Conversation
538d5d6 to
059b2f6
Compare
9cf16b5 to
f464c7f
Compare
Adds a strict_mention config option that, when enabled, requires an explicit @-mention on every message in channel threads. Disables the 'once mentioned, forever in the thread' and session-presence auto-triggers. - New _slack_strict_mention() helper (config.extra + SLACK_STRICT_MENTION env) - Bridged top-level slack.strict_mention yaml to SLACK_STRICT_MENTION env, matching require_mention/allow_bots bridging - Unit tests for the helper + config bridge
f464c7f to
98dc067
Compare
|
We also encountered this annoying behavior, thanks for the patch |
This was referenced Apr 21, 2026
5 tasks
Contributor
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.
Problem
In Slack channel threads, once the bot has been @-mentioned once (or has any active session for that thread), it auto-responds to every subsequent message — even when humans are talking to each other and not addressing the bot. This makes it noisy and intrusive in multi-person threads.
The existing
require_mentionflag only gates the first message; once triggered, the bot sticks around forever.Summary
Adds an opt-in
strict_mentionconfig for Slack. When enabled, the bot only responds in channel threads when explicitly @-mentioned in the specific message — disabling the 'once mentioned, forever in the thread', bot-message follow-up, and session-presence auto-triggers. Want a follow-up? @-mention again.DMs and free-response channels are unaffected.
Changes
gateway/platforms/slack.py— new_slack_strict_mention()helper (readsplatforms.slack.extra.strict_mentionorSLACK_STRICT_MENTIONenv) + one-line gate in the channel mention-gating blockgateway/config.py— bridges top-levelslack.strict_mentionyaml →SLACK_STRICT_MENTIONenv, matching howrequire_mention/allow_bots/free_response_channelsare already bridgedtests/gateway/test_slack_mention.py— 7 unit tests for the helper + 1 config bridge testConfig
Or via env:
SLACK_STRICT_MENTION=trueBehavior matrix
strict_mention: true