Skip to content

feat(feishu): allow disabling group mention requirement - #17406

Closed
de1tydev wants to merge 1 commit into
NousResearch:mainfrom
de1tydev:feat/feishu-group-require-mention
Closed

feat(feishu): allow disabling group mention requirement#17406
de1tydev wants to merge 1 commit into
NousResearch:mainfrom
de1tydev:feat/feishu-group-require-mention

Conversation

@de1tydev

@de1tydev de1tydev commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a Feishu/Lark option to let allowed group messages trigger the bot without an explicit @ mention.

The default behavior is unchanged: group messages still require an @ mention unless this option is explicitly disabled.

The safety gate is preserved. Feishu group policy / allowlist checks still run first, so disabling mention requirements does not make every group user able to trigger the bot.

Supported configuration:

platforms:
  feishu:
    extra:
      require_mention: false

Supported environment variables:

FEISHU_REQUIRE_MENTION=false
# or
HERMES_FEISHU_REQUIRE_MENTION=false

Accepted boolean values: true/false, 1/0, yes/no, on/off. Invalid values fall back to the safer default: requiring mentions.

Feishu/Lark apps still need permission to receive group messages that do not mention the bot; this option only controls Hermes-side filtering after Feishu delivers the event.

Related Issue

Fixes #10275
Fixes #9835

Related / overlapping PRs: #15525 and #12887.

This PR keeps the change intentionally small: it preserves the group policy / allowlist gate before bypassing mention matching, supports both config and env vars, keeps the safe default enabled, documents the option, and includes directed unit tests.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • gateway/config.py
    • Loads FEISHU_REQUIRE_MENTION / HERMES_FEISHU_REQUIRE_MENTION into Feishu platform extra config.
  • gateway/platforms/feishu.py
    • Adds require_mention setting with safe default true.
    • Applies group policy / allowlist first, then optionally skips mention matching.
    • Keeps @_all and bot mention behavior unchanged when mention requirement is enabled.
  • tests/gateway/test_feishu.py
    • Adds coverage for default behavior, config/env overrides, invalid fallback, blocked sender behavior, and per-group allowlist behavior.
  • website/docs/user-guide/messaging/feishu.md
    • Documents the new option and env vars.

How to Test

python -m py_compile gateway/config.py gateway/platforms/feishu.py
python -m pytest tests/gateway/test_feishu.py -q -o 'addopts='
git diff --check origin/main..HEAD

Result locally:

198 passed, 4 warnings

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this feature
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes
  • I've tested on my platform: Ubuntu/Linux, Python 3.12

Documentation & Housekeeping

  • I've updated relevant documentation
  • I've updated cli-config.yaml.example if I added/changed config keys — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — N/A
  • I've considered cross-platform impact — Feishu gateway config only
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A

@alt-glitch alt-glitch added type/feature New feature or request P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists labels Apr 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #4591 and #16864 — same require_mention toggle for Feishu group chats. At least 6 competing PRs for this feature.

@de1tydev
de1tydev force-pushed the feat/feishu-group-require-mention branch from c95e6cd to bf7502c Compare May 2, 2026 01:20
@orangepropeller

Copy link
Copy Markdown

+1

@teknium1

Copy link
Copy Markdown
Contributor

This looks implemented on current main, so this PR can be closed as covered by a later merged Feishu change. This is an automated hermes-sweeper review.

Evidence:

  • gateway/platforms/feishu.py:397 keeps the safe default with require_mention: bool = True.
  • gateway/platforms/feishu.py:1575 loads the global setting from Feishu extra config or FEISHU_REQUIRE_MENTION, defaulting to true.
  • gateway/platforms/feishu.py:4122 applies the group policy / allowlist gate before the mention requirement, and gateway/platforms/feishu.py:4126 only enforces mention matching when require_mention is enabled.
  • gateway/platforms/feishu.py:1490 and gateway/platforms/feishu.py:4130 implement per-group group_rules.<chat_id>.require_mention overrides.
  • website/docs/user-guide/messaging/feishu.md:240 documents FEISHU_REQUIRE_MENTION=false; website/docs/user-guide/messaging/feishu.md:527 documents per-chat require_mention: false.
  • The merged implementation is commit b94cb8e2c4ebf2a8c7688cf676c3cf9899584adb (feat(feishu): operator-configurable bot admission and mention policy), which is contained in v2026.5.7.

Prior discussion on this PR also flagged it as duplicate work for the same Feishu group-chat require_mention toggle.

@teknium1 teknium1 closed this Jun 10, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/feature New feature or request

Projects

None yet

4 participants