feat(feishu): operator-configurable bot admission and mention policy - #18208
Merged
Conversation
Add two operator-facing toggles for inbound Feishu admission, enabling
bot-to-bot scenarios such as A2A orchestration and inter-bot
notifications:
FEISHU_ALLOW_BOTS=none|mentions|all (default: none)
Accept messages from other bots. `mentions` requires the peer
bot to @-mention Hermes; `all` admits every peer-bot message.
FEISHU_REQUIRE_MENTION=true|false (default: true)
Whether group messages must @-mention the bot. Override per-chat
via `group_rules.<chat_id>.require_mention` in config.yaml.
Defaults preserve prior behavior. Self-echo protection is always on:
when the bot's identity is unresolved (auto-detection failed and
FEISHU_BOT_OPEN_ID unset), peer-bot messages are rejected fail-closed
to avoid feedback loops.
Admitted peer bots bypass the human-user allowlist
(FEISHU_ALLOWED_USERS) to match existing Discord behavior; humans
still need an explicit allowlist entry. yaml feishu.allow_bots is
bridged to the env var so the adapter and gateway auth layer share
one source of truth.
Resolving peer-bot display names requires the
application:bot.basic_info:read scope; without it, peers still route
but appear as their open_id.
Test: tests/gateway/test_feishu_bot_admission.py covers the admission
pipeline, group-policy bot-bypass, hydration, and event-dispatch
plumbing as a parametrized matrix.
Change-Id: I363cccb578c2a5c8b8bf0f0a890c01c89909e256
13 tasks
This was referenced May 1, 2026
1 task
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.
Salvage of #15937 by @Roy-oss1 onto current main. Branch was ~53 commits behind; cherry-picked cleanly, no conflicts.
Adds operator-facing Feishu admission toggles, matching the pattern every other platform already has.
Changes
FEISHU_REQUIRE_MENTION=true|false(default true) — group@mentionrequirement, with per-chatgroup_rules.<chat_id>.require_mentionoverride. Closes feat(gateway): add FEISHU_REQUIRE_MENTION environment variable for Feishu group chats #10275, Feishu group messages ignore require_group_mention=false from config.yaml #15226, Support require_mention: false for group chats in Feishu #5465.FEISHU_ALLOW_BOTS=none|mentions|all(default none) — admit peer bots, matching Discord'sDISCORD_ALLOW_BOTS. Unblocks bot-to-bot scenarios. Closes [Bug]: Feishu adapter has no require_mention toggle — file messages in group chats are silently dropped #9835.feishu.allow_botsbridged to the env var ingateway/config.py(same pattern as Slack/Matrix)._admit): self-echo → bot filter → DM bypass → group policy + mention, with explicit fail-closed on unresolved self-identity.platform_allow_bots_mapin_is_authorized_user(gateway/run.py) collapses the Discord DISCORD_ALLOW_BOTS has no effect without also adding the bot to DISCORD_ALLOWED_USERS #4466 branch and the new Feishu one into one table-driven clause.sender_type == "app"matched peer bots too, so our reaction handler ran on their reactions. Now comparessender.idagainstself._app_id.bot/v3/bots/basic_batch(newapplication:bot.basic_info:readscope, docs updated).Defaults preserve prior behavior — no operator sees a change unless they opt in.
Validation
tests/gateway/test_feishu*.py + test_config.pyCredit to @Roy-oss1 — original PR #15937.
Co-authored-by: Roy-oss1 268667990+Roy-oss1@users.noreply.github.com