Skip to content

feat(feishu): add FEISHU_IGNORE_AT_ALL env to skip @everyone triggers - #64807

Closed
banserchen wants to merge 3 commits into
NousResearch:mainfrom
banserchen:main
Closed

feat(feishu): add FEISHU_IGNORE_AT_ALL env to skip @everyone triggers#64807
banserchen wants to merge 3 commits into
NousResearch:mainfrom
banserchen:main

Conversation

@banserchen

Copy link
Copy Markdown

What does this PR do?

Currently, Hermes' Feishu adapter treats @_all (Feishu's @everyone placeholder) as a mention of the bot. This means whenever someone uses    @everyone in a group chat, the bot wakes up and responds — which is rarely desired and can be noisy in busy groups.

This PR adds a new environment variable FEISHU_IGNORE_AT_ALL (default: false, preserving existing behavior). When set to true, @_all no    longer triggers the bot — it only responds to explicit @bot mentions.

This is the right approach because:

• It's opt-in — default behavior is unchanged, so existing deployments are not affected
• It's configurable per environment — via a simple env var, no code changes needed
• It follows the same pattern as other Feishu env vars (FEISHU_GROUP_POLICY, FEISHU_REQUIRE_MENTION, etc.)

Related Issue

Fixes #

Type of Change

☑ ✨ New feature (non-breaking change that adds functionality)

Changes Made

• plugins/platforms/feishu/adapter.py — Modified _mentions_self() to check FEISHU_IGNORE_AT_ALL env var; when true, @_all in message content    returns False instead of True, so @everyone no longer passes the mention gate
• tests/gateway/test_feishu.py — Added 2 test cases to TestGroupMentionAtAll:
  • test_at_all_ignored_when_env_set — verifies FEISHU_IGNORE_AT_ALL=true rejects @everyone
  • test_at_all_still_triggers_when_env_unset_or_false — verifies default behavior is preserved

How to Test

1. Set FEISHU_IGNORE_AT_ALL=true in ~/.hermes/.env
2. Restart the gateway: hermes gateway restart
3. In a Feishu group where the bot is a member, send a message with @所有人 (@everyone) — the bot should not respond
4. Now send a message explicitly @mentioning the bot — the bot should respond normally
5. Run unit tests:

  ─ bash
     python3 -m pytest tests/gateway/test_feishu.py::TestGroupMentionAtAll -v -o addopts=""

   All 4 tests should pass (2 existing + 2 new).

Checklist

Code

☑ I've read the hermes-agent/CONTRIBUTING.md at main · NousResearch/hermes-agent · GitHub
☑ My commit messages follow /en/ (feat(scope):, fix(scope):, etc.)
☑ I searched for existing PRs to make sure this isn't a duplicate
☑ My PR contains only changes related to this fix/feature (no unrelated commits)
☑ I've run pytest tests/ -q and all tests pass
☑ I've added tests for my changes (required for bug fixes, strongly encouraged for features)
☑ I've tested on my platform: WSL2 (Ubuntu 24.04)

Documentation & Housekeeping

☑ I've updated relevant documentation — or N/A
☑ I've updated cli-config.yaml.example if I added/changed config keys — or N/A
☑ I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
☑ I've considered cross-platform impact (Windows, macOS) per the hermes-agent/CONTRIBUTING.md at main · NousResearch/hermes-agent · GitHub —or N/A
☑ I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Gateway log before the fix (bot responds to @everyone):

[Lark] [INFO] connected to wss://msg-frontier.feishu.cn/ws/v2/...
[Feishu] Inbound group message received: ... text='@ALL 请注意'

After setting FEISHU_IGNORE_AT_ALL=true (bot ignores @everyone):

[Lark] [INFO] connected to wss://msg-frontier.feishu.cn/ws/v2/...

No inbound log for @everyone messages — bot stays silent

Test output:

$ python3 -m pytest tests/gateway/test_feishu.py::TestGroupMentionAtAll -v -o addopts=""
test_at_all_in_content_accepts_without_explicit_bot_mention PASSED
test_at_all_still_requires_policy_gate PASSED
test_at_all_ignored_when_env_set PASSED
test_at_all_still_triggers_when_env_unset_or_false PASSED
======================== 4 passed, 10 warnings in 5.15s ========================

yan.chen and others added 3 commits July 15, 2026 14:34
By default Hermes treats @_all (@everyone) as a mention of the bot,
so the bot responds whenever someone @everyone's in a group. This adds
FEISHU_IGNORE_AT_ALL=true to make @everyone NOT trigger the bot — it
only responds to explicit @bot mentions.

- Modify _mentions_self() in feishu adapter to check the env var
- Add tests for both ignore=true (skip) and ignore=false (default) cases
@alt-glitch alt-glitch added type/feature New feature or request comp/plugins Plugin system and bundled plugins platform/feishu Feishu / Lark adapter P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jul 15, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #60910 — same mechanism (opt-in FEISHU_IGNORE_AT_ALL env gating the @_all self-mention branch in _mentions_self()), and #60910 is the earlier open PR. Competes via a different design with #59347 (which drops the @_all branch unconditionally rather than behind a config). Both implement #33723. Maintainer should pick one; suggest closing this in favor of #60910 (or vice versa).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants