Skip to content

fix(feishu): allow bare @mention with no text to trigger bot response in group chats - #57800

Closed
luxuguang-leo wants to merge 1 commit into
NousResearch:mainfrom
luxuguang-leo:fix/feishu-pure-mention
Closed

luxuguang-leo wants to merge 1 commit into
NousResearch:mainfrom
luxuguang-leo:fix/feishu-pure-mention

Conversation

@luxuguang-leo

Copy link
Copy Markdown
Contributor

Problem

When a user sends a bare @mention with no text in a Feishu group chat (e.g. just @Bot), the gateway silently drops the message. The guard at _process_inbound_message() catches the empty string after mention stripping and returns early, leaving the user with no response or feedback.

This is especially noticeable now that the group context feature (PR #52908, also addressing #55530) lets the agent see prior discussion. A bare @mention is the natural way to re-engage the bot without repeating context — but the guard blocks it entirely.

Root Cause

# Old guard — drops ALL empty text, including pure @mentions
if inbound_type == MessageType.TEXT and not text and not media_urls:
    return

After _strip_edge_self_mentions() strips the @-mention prefix, a bare @Bot becomes empty string. The guard checks not text but never inspects the mentions list.

Changes

plugins/platforms/feishu/adapter.py — 1 file, +6/-3 lines

Narrow the empty-text guard to only drop messages that have neither text content nor @mentions:

if inbound_type == MessageType.TEXT and not text and not media_urls:
    if not mentions:
        logger.debug("[Feishu] Ignoring empty text message id=%s", message_id)
        return

When the guard passes, _build_mention_hint() builds a mention text (e.g. @Bot), and the pipeline proceeds normally.

Relationship with PR #52908

Together with #52908 (group context via _fetch_recent_group_context), a bare @mention now produces a context-aware response instead of silence.

PR What it does
#52908 Injects recent group messages as context when mentioned
This PR Allows bare @mention (no text) to trigger response

Testing

  • Bare @Bot in group → bot responds with context
  • @Bot with text → unchanged behavior
  • DM (p2p) → unchanged behavior
  • /command → unchanged behavior
  • Truly empty message (no mention, no text, no media) → still dropped

Related: #55530, #52908

In Feishu group chats, a bare @mention (e.g. just @bot with no text) is
silently dropped by the guard in _process_inbound_message(). After
_strip_edge_self_mentions() strips the mention prefix, the empty string
hits the 'not text and not media_urls' guard and returns early, even
though the mentions list is populated.

Narrow the guard to only drop messages that have neither text content
nor @mentions. When mentions are present, the existing
_build_mention_hint() builds a mention text (e.g. @bot) and the rest of
the pipeline proceeds normally.

Together with PR NousResearch#52908 (group context via _fetch_recent_group_context),
a bare @mention now produces a context-aware response instead of silence.

Related: NousResearch#55530, NousResearch#52908
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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants