fix(feishu): record non-mentioned group messages as context-only transcript entries - #16112
Open
lewislulu wants to merge 1 commit into
Open
fix(feishu): record non-mentioned group messages as context-only transcript entries#16112lewislulu wants to merge 1 commit into
lewislulu wants to merge 1 commit into
Conversation
…script entries Group messages that pass the policy gate but do not @mention the bot are currently silently dropped. This means the agent has no awareness of the ongoing group conversation — when a user later @mentions the bot and references earlier messages, the agent cannot see them. This commit introduces a 'context_only' flag on MessageEvent. When a group message passes _allow_group_message() but is not addressed to the bot (_message_is_bot_addressed() returns False), the message is still processed through _process_inbound_message() but flagged context_only. context_only events: - Are persisted to the session transcript with a context_only: true marker - Skip the agent pipeline entirely (no reaction, no typing, no response) - Give the agent conversational awareness when later @mentioned The mention-check logic is extracted from _should_accept_group_message() into a new _message_is_bot_addressed() method for independent reuse. Fixes NousResearch#9835 Ref NousResearch#10275
1 task
|
this is exact user case for group chat with multiple people discussion and let agent summary and make further actions, hope can add this feature to release! |
Contributor
|
Thanks for addressing a real Feishu group-chat gap. Current main still drops policy-allowed, unmentioned group messages when Problems
Suggested changes
Automated hermes-sweeper review. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When a Feishu/Lark group message passes the policy gate (
_allow_group_message) but does not @mention the bot, the message is currently silently dropped. This means the agent has zero awareness of the ongoing group conversation — when a user later @mentions the bot and references earlier messages, the agent cannot see them.This PR introduces a
context_onlypathway: non-mentioned group messages are still processed and persisted to the session transcript, but they skip the agent pipeline entirely (no reaction, no typing indicator, no response). When the bot is later @mentioned, it can see the full conversation history.Related Issue
Fixes #9835
Ref #10275
Type of Change
Changes Made
gateway/platforms/base.pycontext_only: bool = Falsefield toMessageEventdataclassgateway/platforms/feishu.py_handle_message_event_data()— Split the group message gate into two steps: (1) policy check via_allow_group_message(), (2) mention check via new_message_is_bot_addressed(). Messages passing policy but not mentioning the bot are flaggedcontext_only=True_handle_message_with_guards()— Added early return forcontext_onlyevents, routing them to_record_context_only_message()instead of the agent pipeline_record_context_only_message()— New method that persists context-only events to the session transcript with acontext_only: truemarker_message_is_bot_addressed()— New method extracted from_should_accept_group_message()containing the pure mention-check logic (@mention / @ALL detection), callable independently_process_inbound_message()— Addedcontext_onlyparameter passthrough toMessageEventconstructionHow to Test
FEISHU_GROUP_POLICY=openChecklist
Code
pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — or N/ADesign Notes
Why
context_onlyinstead ofFEISHU_REQUIRE_MENTION=false?A simple
require_mention=falsetoggle (as proposed in #10275) would route all group messages through the full agent pipeline — triggering reactions, typing indicators, and LLM inference for every message. This is wasteful and noisy.The
context_onlyapproach is surgical: non-mentioned messages are recorded for context but never trigger the agent. The bot stays silent until explicitly addressed, yet has full conversational awareness when called upon.