fix(feishu): ignore @所有人/@everyone mentions in group chats - #59347
fix(feishu): ignore @所有人/@everyone mentions in group chats#59347Mason-zy wants to merge 1 commit into
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Changes
Fixes #33723: Feishu bot was replying to every @所有人 group announcement because @_all was treated as a self-mention. The fix removes the @_all special case so only actual bot mentions trigger a response.
Quality
- Minimal, targeted fix: only the
_mentions_selfcheck is changed - Clear comment referencing the issue
- No security or correctness concerns
Suggestions
- None
Reviewed by Hermes Agent
Backport of NousResearch/hermes-agent#59347 (upstream issue #33723). _mentions_self() treated @_all (Feishu @everyone placeholder) as a self-mention, so @所有人 announcements triggered the bot in groups. Drop that branch — real @bot mentions still work via the ID-based mention detection paths.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused Feishu fix. The premise is confirmed on current main: plugins/platforms/feishu/adapter.py:4335-4339 treats every raw @_all as a self-mention, and _admit() applies that result to required-mention group traffic at :4278.
Problems
tests/gateway/test_feishu.py:3543-3553currently asserts that an@_allmessage without a bot mention is admitted. This patch reverses that behavior but does not update the regression test.- The documented contract would become stale:
website/docs/user-guide/messaging/feishu.md:238and the zh-Hans counterpart atwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/feishu.md:204say@allsatisfies the gate. - This is a compatibility decision: linked competing PR #60910 preserves the existing default through an opt-out configuration, while this patch changes it unconditionally.
Suggested changes
- If unconditional removal is selected, update the
TestGroupMentionAtAllexpectation and add explicit-@botcoverage for the same gate. - Update both documentation statements to require an explicit bot mention.
Automated hermes-sweeper review.
| if "@_all" in raw_content: | ||
| return True | ||
| mentions = getattr(message, "mentions", None) or [] | ||
| if mentions and self._message_mentions_bot(mentions): |
There was a problem hiding this comment.
Removing this branch reverses tests/gateway/test_feishu.py:3543-3553, which currently asserts that an @_all-only group message is admitted. Please update that regression test and add an explicit bot-mention case so the new gate behavior is covered.
Problem
In Feishu group chats, the bot always replies when someone uses @所有人 (
@everyone), even though the bot itself is not mentioned. This creates noise in enterprise groups where @所有人 is routinely used for announcements. Tracked in #33723.Root cause
_mentions_self()inplugins/platforms/feishu/adapter.pytreats@_all(Feishu's@everyoneplaceholder) as a self-mention:Combined with the
require_mentiongate (@_allreturns True → gate passes → bot replies), this means every @所有人 announcement triggers a response.Fix
Drop the
@_all → return Truebranch so @所有人 no longer counts as a self-mention. The bot will still respond to explicit@botnamementions.This change is safe because the other two mention-detection paths already handle the case correctly:
_message_mentions_bot()matches by bot open_id/user_id/name (an @everyone tag has no bot ID)_post_mentions_bot()checksm.is_self(an @everyone tag isis_all=True, neveris_self)So removing this branch only stops @所有人 from triggering the bot; real @bot mentions are unaffected.
Behavior contrast
@所有人 please review@botname what's up@所有人 @botname heyCloses #33723.