Skip to content

fix(feishu): ignore @所有人/@everyone mentions in group chats - #59347

Open
Mason-zy wants to merge 1 commit into
NousResearch:mainfrom
Mason-zy:fix/feishu-ignore-at-all
Open

fix(feishu): ignore @所有人/@everyone mentions in group chats#59347
Mason-zy wants to merge 1 commit into
NousResearch:mainfrom
Mason-zy:fix/feishu-ignore-at-all

Conversation

@Mason-zy

@Mason-zy Mason-zy commented Jul 6, 2026

Copy link
Copy Markdown

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() in plugins/platforms/feishu/adapter.py treats @_all (Feishu's @everyone placeholder) as a self-mention:

def _mentions_self(self, message):
    # @_all is Feishu's @everyone placeholder.
    raw_content = getattr(message, "content", "") or ""
    if "@_all" in raw_content:
        return True            # ← always triggers the bot

Combined with the require_mention gate (@_all returns True → gate passes → bot replies), this means every @所有人 announcement triggers a response.

Fix

Drop the @_all → return True branch so @所有人 no longer counts as a self-mention. The bot will still respond to explicit @botname mentions.

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() checks m.is_self (an @everyone tag is is_all=True, never is_self)

So removing this branch only stops @所有人 from triggering the bot; real @bot mentions are unaffected.

Behavior contrast

Message Before After
@所有人 please review bot replies bot ignores (no @bot)
@botname what's up bot replies bot replies
@所有人 @botname hey bot replies bot replies (bot explicitly mentioned)

Closes #33723.

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/feishu Feishu / Lark adapter P3 Low — cosmetic, nice to have labels Jul 6, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_self check is changed
  • Clear comment referencing the issue
  • No security or correctness concerns

Suggestions

  • None

Reviewed by Hermes Agent

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

COMMENT: fix(feishu): ignore @所有人/@everyone mentions in group chats

Small fix (2 additions, 3 deletions). No security concerns.


Reviewed by Hermes Agent

johnson7788 pushed a commit to johnson7788/MultiUserClaw that referenced this pull request Jul 6, 2026
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 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-3553 currently asserts that an @_all message 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:238 and the zh-Hans counterpart at website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/feishu.md:204 say @all satisfies 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 TestGroupMentionAtAll expectation and add explicit-@bot coverage 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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
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 P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add option to ignore @all/@everyone mentions in Feishu group chats

4 participants