feat(feishu): add require_mention config option for group chats - #5219
Closed
Leegenux wants to merge 6 commits into
Closed
feat(feishu): add require_mention config option for group chats#5219Leegenux wants to merge 6 commits into
Leegenux wants to merge 6 commits into
Conversation
Add feishu.require_mention config option (default: true) to control
whether @mention is required for bot to respond in group chats.
Previously, group_policy="open" would bypass @mention check, but this
was hardcoded behavior. Now users can configure this independently:
- require_mention=true (default): Only respond when bot is @mentioned or @_all
- require_mention=false: Respond to all allowed group messages without @mention
Configuration via config.yaml:
feishu:
require_mention: false
Or via environment variable:
FEISHU_REQUIRE_MENTION=false
This matches the pattern used by Discord's require_mention setting.
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Allow require_mention from extra.get() (platforms.feishu.extra) with env var fallback - Add TestRequireMentionDisabled test class covering: - require_mention=false accepts messages without @mention - require_mention=true requires @mention (default) - Default behavior when env var unset - Allowlist policy still respected when require_mention=false Addresses Copilot PR NousResearch#4591 review comments. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Use explicit None check instead of 'or' fallback to correctly handle require_mention=False from PlatformConfig.extra. Previously the 'or' operator treated False/0/empty string as 'not provided' and fell back to env var, making it impossible to disable mention gating via config. - Add _resolve_require_mention() helper with explicit None check - Add tests for require_mention via PlatformConfig.extra (True/False) - Add test for extra precedence over env var when explicitly False Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
The staticmethod was called without proper class reference in _load_settings. Changed from '_resolve_require_mention(extra)' to 'FeishuAdapter._resolve_require_mention(extra)'. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a configurable require_mention gate for Feishu/Lark group chats so operators can choose whether group messages must @mention the bot to be routed.
Changes:
- Introduce
require_mentioninto Feishu adapter settings with resolution fromPlatformConfig.extraorFEISHU_REQUIRE_MENTION. - Update group message routing logic to optionally bypass mention checks when
require_mention=false. - Add unit tests covering default behavior, env var configuration, and
PlatformConfig.extraprecedence.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
gateway/platforms/feishu.py |
Adds require_mention setting resolution and applies it to group message acceptance logic. |
gateway/config.py |
Bridges feishu.require_mention from config.yaml into an env var. |
hermes_cli/config.py |
Adds default config entry for Feishu require_mention. |
tests/gateway/test_feishu.py |
Adds tests validating mention-gating behavior and precedence rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
Thanks for the Feishu configuration and test coverage. Current Automated hermes-sweeper review evidence:
|
1 task
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.
Add configurable @mention gating for Feishu group chats.
Changes
require_mentionsetting to Feishu adapter (default: true)extradict in config orFEISHU_REQUIRE_MENTIONenv varCo-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>