fix(feishu): preserve topic thread context for forum replies#8656
Open
sgaofen wants to merge 1 commit into
Open
fix(feishu): preserve topic thread context for forum replies#8656sgaofen wants to merge 1 commit into
sgaofen wants to merge 1 commit into
Conversation
This was referenced Apr 24, 2026
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.
Summary
thread_idupper_message_idfirst, thenparent_id, but only for forum chatsProblem
Part of #7734 reports that messages sent inside an existing Feishu topic can still trigger Hermes replies that start a new topic instead of staying inside the current one.
The adapter only propagated
message.thread_idintosource.thread_id. In Feishu forum chats, that field is not reliably present on every inbound message, so the downstream gateway lost the thread context and sent follow-up replies withoutreply_in_thread=True.Fix
_resolve_inbound_thread_id()ingateway/platforms/feishu.pythread_idwhen Feishu provides itforumchats only, fall back toupper_message_id, thenparent_idgroupmessages unchanged so ordinary replies do not become synthetic threadsScope
This PR addresses the topic-threading half of #7734. The interactive authorization-card button error discussed in that issue appears to depend on Feishu callback permissions / account capabilities and is intentionally out of scope here.
Testing
python3 -m py_compile gateway/platforms/feishu.py tests/gateway/test_feishu.pyuv run --extra dev pytest -o addopts='' tests/gateway/test_feishu.py -k 'thread_context or replies_in_thread_when_thread_metadata_present or fetches_reply_to_text'Notes
uv run --extra dev pytest -o addopts='' tests/gateway/test_feishu.py -qstill hits one pre-existing mock-builder failure on currentmain(test_build_event_handler_registers_reaction_and_card_processors) unrelated to this change.Platform Tested
Contribution Guide Notes
CONTRIBUTING.mdand checked for existing open PRs before submitting this scoped change.pytest tests/ -qpass unless explicitly noted.