feat(feishu): add FEISHU_REQUIRE_MENTION toggle + hermes upgrade deps validation - #10802
Open
bugmaker2 wants to merge 2 commits into
Open
feat(feishu): add FEISHU_REQUIRE_MENTION toggle + hermes upgrade deps validation#10802bugmaker2 wants to merge 2 commits into
bugmaker2 wants to merge 2 commits into
Conversation
… env vars set When `hermes upgrade` runs and `pip install -e ".[all]"` fails (e.g. network issues), the fallback path `pip install -e "."` only installs base deps and omits optional extras like feishu (lark-oapi). No warning was shown, causing the gateway to crash on restart when Feishu env vars were set. After the fallback installation completes, check if FEISHU_APP_ID and FEISHU_APP_SECRET env vars are set. If so, attempt to import lark_oapi. If the import fails, print a clear error message directing the user to install the feishu extra. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s without @mention Add a require_mention toggle for Feishu group messages. When FEISHU_REQUIRE_MENTION=false, the bot accepts all group messages that pass the group policy check (allowlist/blacklist), even without an @mention. This matches the behavior already supported by Slack, Discord, and WhatsApp. Previously, file/image/audio messages in group chats were silently dropped because the @mention check ran before the message type was resolved, and those message types had no mention metadata. With require_mention=false, file/audio/image messages are now accepted in group chats when the policy allows it. The setting can be configured via: - Environment variable: FEISHU_REQUIRE_MENTION=false - Config.yaml: platforms.feishu.require_mention: false Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Contributor
|
Thanks for the contribution. The Feishu mention-toggle portion has been superseded on current main by Problems
Suggested changes
This is an automated hermes-sweeper review. |
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.
What does this PR do?
Two Feishu improvements:
FEISHU_REQUIRE_MENTION toggle (implements feat(gateway): add FEISHU_REQUIRE_MENTION environment variable for Feishu group chats #10275, fixes [Bug]: Feishu adapter has no require_mention toggle — file messages in group chats are silently dropped #9835): Added
FEISHU_REQUIRE_MENTIONenvironment variable to control whether group messages require an explicit @mention. When set tofalse/0/no/off, the bot responds to all group messages that pass the group policy. File/image/audio messages are now handled the same as text messages regarding @mention detection. Default isTrue(safe default matching Slack/Discord patterns).hermes upgrade deps validation (fixes Bug:
hermes upgradesilently fails optional extras (e.g. feishu/lark-oapi), gateway crashes on restart #10651): Afterhermes upgradecompletes, ifFEISHU_APP_IDorFEISHU_APP_SECRETenvironment variables are set, the upgrade process validates thatlark_oapican be imported. If import fails, a clear error message directs the user to install the feishu extra:pip install hermes-agent[feishu].Related Issue
Fixes #10275 (FEISHU_REQUIRE_MENTION)
Fixes #9835 (file messages silently dropped)
Fixes #10651 (hermes upgrade deps validation)
Type of Change
Changes Made
gateway/platforms/feishu.py: Addedrequire_mention: bool = Truefield toFeishuAdapterSettings,_parse_require_mention()helper function (parses env var and config, explicit-false detection),_feishu_require_mention()instance method, modified_require_group_mention()to returnTrueearly when mention is disabledhermes_cli/main.py: Added post-upgrade Feishu deps validation — checks ifFEISHU_APP_ID/FEISHU_APP_SECRETare set, attemptsimport lark_oapi, prints clear error if missingtests/gateway/test_feishu.py: Addedtest_feishu_require_mention_loaded_from_env,test_parse_require_mention_defaults_true,test_parse_require_mention_explicit_false,test_parse_require_mention_explicit_trueHow to Test
FEISHU_REQUIRE_MENTION=false hermes gateway— verify bot responds to group messages without @mentionFEISHU_REQUIRE_MENTION=true hermes gateway— verify bot requires @mention (default behavior)FEISHU_APP_ID, runhermes upgrade— verify clear error message about missing depspython -m pytest tests/gateway/test_feishu.py -q -k "require_mention or parse_require_mention"→ all passChecklist
Code
feat(feishu):,fix(hermes):)pytest tests/gateway/test_feishu.py -q— 103 passed, 16 skipped, 2 failed (lark-oapi optional dep not installed in test env)Documentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A