fix(feishu): keep group replies in group chats - #23729
Open
LeonSGP43 wants to merge 1 commit into
Open
Conversation
1 task
23 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused Feishu routing regression fix. The production premise is still present on current main: gateway/platforms/base.py:105-107 returns event.message_id for a non-thread Feishu event, and plugins/platforms/feishu/adapter.py:4609-4621 consequently uses the reply API.
Problems
tests/gateway/test_feishu.py:2007importsgateway.platforms.feishu, and line 2030 patches that old module path. Current main moved the adapter toplugins/platforms/feishu/adapter.pyin552adbe08; the added regression test needs those references migrated before it can execute.
Suggested changes
- Update the added test's import and
asyncio.to_threadpatch target toplugins.platforms.feishu.adapter, following the current neighboring Feishu tests.
Automated hermes-sweeper review.
| @patch.dict(os.environ, {}, clear=True) | ||
| def test_send_without_topic_metadata_creates_group_message(self): | ||
| from gateway.config import PlatformConfig | ||
| from gateway.platforms.feishu import FeishuAdapter |
Contributor
There was a problem hiding this comment.
Current main migrated the adapter to plugins.platforms.feishu.adapter in 552adbe08; this import, and the gateway.platforms.feishu.asyncio.to_thread patch at line 2030, will fail before the regression assertion runs. Please port both references to the plugin module path used by the neighboring tests.
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
Type of Change
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.pytest_send_without_topic_metadata_creates_group_messagepassestest_feishu_group_events_do_not_request_reply_anchorpassesChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
uv run --frozen pytest -q -o addopts='' tests/gateway/test_feishu.pyuv run --frozen pytest -q -o addopts='' tests/gateway/test_feishu.py -k 'topic or group_message or reply_anchor or send_without_topic_metadata'