fix(slack): respect require_mention config for channel messages#6268
Closed
giwaov wants to merge 1 commit into
Closed
fix(slack): respect require_mention config for channel messages#6268giwaov wants to merge 1 commit into
giwaov wants to merge 1 commit into
Conversation
The Slack adapter had mention gating hardcoded - it always required
@mention in channels regardless of config. The require_mention setting
was properly stored in config.extra by gateway/config.py but never read
by the Slack adapter.
Now reads self.config.extra.get('require_mention', True) and skips
mention gating when set to false, allowing the bot to respond to all
channel messages without requiring @mention.
Closes NousResearch#6218
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.
Summary
The Slack adapter had mention gating hardcoded - it always required @mention in channels regardless of the
require_mentionconfig setting. The setting was properly stored inconfig.extrabygateway/config.py(lines 529-535) but never consulted by the Slack adapter's message routing logic.Changes
gateway/platforms/slack.py
self.config.extra.get('require_mention', True)before the mention gating checkrequire_mentionisfalse, allowing the bot to respond to all channel messagestests/gateway/test_slack.py
require_mention: true(default) andrequire_mention: falsebehaviorRoot Cause
In
gateway/platforms/slack.py, the channel message filter was:\\python
if not is_dm and bot_uid and not is_mentioned:
# check thread/session fallbacks...
return # ignore if none match
\\
This blocked all non-mention channel messages unconditionally. The fix adds:
\\python
require_mention = self.config.extra.get('require_mention', True)
if not is_dm and bot_uid and not is_mentioned and require_mention:
\\
Config Example
\\yaml
slack:
require_mention: false # respond to all channel messages without @mention
\\
Closes #6218