Skip to content

feat(feishu): operator-configurable bot admission and mention policy - #18208

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-bb4c06d3
May 1, 2026
Merged

feat(feishu): operator-configurable bot admission and mention policy#18208
teknium1 merged 1 commit into
mainfrom
hermes/hermes-bb4c06d3

Conversation

@teknium1

@teknium1 teknium1 commented May 1, 2026

Copy link
Copy Markdown
Contributor

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

Defaults preserve prior behavior — no operator sees a change unless they opt in.

Validation

Suite Result
tests/gateway/test_feishu*.py + test_config.py 295/295 passing
Compile check (feishu.py, run.py, config.py) OK

Credit to @Roy-oss1 — original PR #15937.

Co-authored-by: Roy-oss1 268667990+Roy-oss1@users.noreply.github.com

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
@teknium1
teknium1 merged commit b94cb8e into main May 1, 2026
6 of 11 checks passed
@teknium1
teknium1 deleted the hermes/hermes-bb4c06d3 branch May 1, 2026 03:30
@alt-glitch alt-glitch added type/feature New feature or request P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter area/config Config system, migrations, profiles labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/feature New feature or request

Projects

None yet

3 participants