fix(feishu): keep group replies in group chats - #24290
Open
feige2003 wants to merge 1 commit into
Open
Conversation
The _reply_anchor_for_event() function was falling back to event.message_id for ordinary Feishu group messages (those without a thread_id). That caused the adapter to call message.reply(...) which Feishu routes to the sender's DM instead of the group chat when the inbound message was a regular group @mention rather than a Feishu topic/thread reply. Fix: return None for Feishu non-thread messages so they go through the normal group create path instead of the reply API. Fixes NousResearch#23698, NousResearch#23729
Collaborator
23 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the normal-group reply-anchor case. The current main still has the reported control flow: gateway/platforms/base.py:105-107 returns event.message_id for non-threaded Feishu events, and plugins/platforms/feishu/adapter.py:4613-4621 sends any non-empty anchor through Feishu's reply API.
Problems
- The changed assertion at
tests/gateway/test_feishu.py:1998expectsom_reply, but the adapter's unchanged metadata fallback resolves the request target toom_trigger(plugins/platforms/feishu/adapter.py:4609-4621). Current coverage retainsom_triggerattests/gateway/test_feishu.py:2115. - The PR predates the Feishu plugin migration (
5600105478ffde29d7566b45421b100eaa29c4ef), so its addedgateway.platforms.feishuimports and patch targets need to useplugins.platforms.feishu.adapteron current main.
Suggested changes
- Preserve the existing threaded-topic assertion and transplant the normal-group anchor regression using the current plugin import path.
Automated hermes-sweeper review.
| @@ -1998,9 +1998,74 @@ async def _direct(func, *args, **kwargs): | |||
| ) | |||
Contributor
There was a problem hiding this comment.
This expectation should remain om_trigger: the unchanged adapter fallback uses metadata["reply_to_message_id"] whenever reply_to is absent for a threaded send. The group-anchor change does not alter that target.
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?
Fixes Feishu group replies being routed through the reply API even when the inbound message was a normal group @mention rather than a Feishu topic/thread reply.
The root cause was
_reply_anchor_for_event()falling back toevent.message_idfor ordinary Feishu group messages. That caused the adapter to callmessage.reply(...), which Feishu routes back to the sender DM in this scenario. This change keeps reply semantics only for true Feishu thread/topic replies and lets ordinary group responses go out through the normal group send path.Related Issue
Fixes #23698
Fixes #23729
Changes Made
gateway/platforms/base.pyso Feishu only returns a reply anchor for actual thread/topic repliesmessage.reply(...)How to Test
uv run --frozen pytest -q -o addopts="" tests/gateway/test_feishu.py::TestFeishuSend::test_send_without_topic_metadata_creates_group_message tests/gateway/test_feishu.py::TestFeishuSend::test_feishu_group_events_do_not_request_reply_anchoruv run --frozen pytest -q -o addopts="" tests/gateway/test_feishu.pyto confirm no regressions