feat(gateway): add FEISHU_REQUIRE_MENTION config to control group @mention gate - #7546
feat(gateway): add FEISHU_REQUIRE_MENTION config to control group @mention gate#7546antik-x wants to merge 1 commit into
Conversation
…ntion gate When FEISHU_REQUIRE_MENTION is set to false/0/no/off, group messages bypass the @mention requirement while still respecting the group policy gate (open/allowlist/blacklist/etc). This matches the require_mention pattern used by Slack, Discord, and Matrix adapters. The default remains true (mention gating on) for backward compatibility. Closes NousResearch#5465
cb11851 to
88d7b1d
Compare
|
I manually verified this on the current latest Configfeishu:
require_mention: falseReproI sent a normal group message in Feishu without @mentioning the bot. ExpectedThe bot should reply, because ActualThe bot did not reply. This was tested against an up-to-date local checkout synced to One related observation: |
|
Following up on my previous comment after checking this more closely: This PR seems to address the global However, one related gap I noticed is that it still does not seem to cover per-chat mention bypass for Feishu (similar to So from my perspective, the Feishu mention-gating/config story currently has two closely related pieces:
Would you prefer to extend this PR to cover the per-chat bypass case as well, or should that be handled in a separate follow-up PR? I mainly want to avoid duplicating work, since the implementation areas seem closely related ( |
|
Thanks for the contribution. This is an automated hermes-sweeper review; the requested behavior is already implemented on current
|
Summary
Add a
FEISHU_REQUIRE_MENTIONconfiguration option to the Feishu gateway adapter, allowing users to disable the requirement for @mentioning the bot in group chats. By default, the bot still requires being @mentioned in groups (backward compatible), but this can be turned off via config or environment variable.Motivation
Currently, the Feishu bot only responds when @mentioned in group chats. Some users prefer the bot to respond to all messages in a group (e.g., dedicated bot channels). This PR makes the behavior configurable.
Changes
gateway/platforms/feishu.py:
require_mention: bool = TruetoFeishuAdapterSettings(default:True, backward compatible)_feishu_require_mention()validation function for config parsingFEISHU_REQUIRE_MENTIONenv var support inFeishuAdapter.from_config()_is_mentioned()check on the new setting inFeishuAdapter._process_message()tests/test_feishu.py:
require_mention=False(bot responds to all group messages)require_mention=Truedefault (bot only responds when @mentioned)FEISHU_REQUIRE_MENTIONConfiguration
Or via environment variable:
export FEISHU_REQUIRE_MENTION=falseImportant: Feishu Platform Event Subscription
Setting
require_mention: falsealone is not sufficient. You must also configure the event subscription on the Feishu Open Platform:im.message.receive_v1event subscriptionim:message.group_msg:readonlypermission is granted under Permissions (权限管理)Without the
im.message.receive_v1event subscription, the Feishu platform will not push any message events to your bot, regardless of therequire_mentionsetting.重要:飞书平台事件订阅配置
仅设置
require_mention: false是不够的。你还需要在飞书开放平台进行以下配置:im.message.receive_v1事件订阅im:message.group_msg:readonly权限如果没有添加
im.message.receive_v1事件订阅,飞书平台不会向你的机器人推送任何消息事件,无论require_mention如何设置。Backward Compatibility
Fully backward compatible. Default is
require_mention: true, preserving existing behavior.