You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Feishu reaction routing so Hermes only treats reactions on messages sent by the current Hermes bot as inbound synthetic events.
Root Cause
The Feishu reaction handler fetched the reacted-to message and only checked whether the message sender had sender_type == "app". Other Feishu bots also send messages as app senders, so user reactions on another bot's message could be routed into Hermes as reaction:added:* text.
Changes
Reuse a shared own-bot sender identity check for self-sent event filtering and reaction target filtering.
Require reacted-to messages to match the current bot open_id or user_id before routing the reaction.
Add regression coverage for reactions on other app messages and own app messages.
Reviewed the fix locally. The approach of reusing the existing bot identity check (open_id / user_id comparison) for reaction target filtering is correct and consistent with how self-sent event filtering already works in the adapter. The regression tests cover the two critical cases (own bot message → route, other bot message → ignore). LGTM.
Closing this PR because the same issue has now been fixed upstream on main by #18208.
The current upstream implementation in gateway/platforms/feishu.py fetches the reacted-to message and checks the target message sender against this app's app_id, which covers the same peer-bot filtering case this PR addressed:
reactions on peer bot messages are ignored
reactions on this Hermes bot's own messages are still routed
main also includes regression coverage for those cases in tests/gateway/test_feishu.py (test_reaction_on_peer_bot_message_is_not_routed and test_reaction_on_our_own_bot_message_is_routed).
Given that, this PR is now redundant and conflicts with the newer Feishu changes, so closing it in favor of #18208.
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
comp/gatewayGateway runner, session dispatch, deliveryP2Medium — degraded but workaround existsplatform/feishuFeishu / Lark adaptertype/bugSomething isn't working
3 participants
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.
Summary
Fix Feishu reaction routing so Hermes only treats reactions on messages sent by the current Hermes bot as inbound synthetic events.
Root Cause
The Feishu reaction handler fetched the reacted-to message and only checked whether the message sender had
sender_type == "app". Other Feishu bots also send messages as app senders, so user reactions on another bot's message could be routed into Hermes asreaction:added:*text.Changes
open_idoruser_idbefore routing the reaction.Validation
scripts/run_tests.sh tests/gateway/test_feishu.py