fix(feishu): use thread_id as reply target when reply_to is empty#11433
Open
youttiao wants to merge 1 commit into
Open
fix(feishu): use thread_id as reply target when reply_to is empty#11433youttiao wants to merge 1 commit into
youttiao wants to merge 1 commit into
Conversation
In Feishu topic groups (话题群), messages within a thread have a thread_id but the reply_to field can be empty. The original code only used reply_to for the reply API call, causing replies to fall back to creating new top-level messages instead of replying within the thread. Now falls back to thread_id when reply_to is absent, ensuring responses stay in the correct thread context. Made-with: Cursor
nickdlkk
added a commit
to nickdlkk/hermes-agent
that referenced
this pull request
Apr 21, 2026
PR NousResearch#11433 introduced a regression: effective_reply_to = reply_to or thread_id causes message.reply to be called with thread_id as the target message_id. Feishu's reply API requires an actual message_id, not a thread_id, so this causes 'message not found' errors and messages are created as new top-level messages instead of within the topic. Fix: - When reply_to is present: use reply API with reply_to as message_id, pass thread_id as a separate query parameter - When reply_to is absent: use create API with topic_id=thread_id to place the message inside the correct topic
Collaborator
This was referenced Apr 26, 2026
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.
Summary
Fixes Feishu topic group (话题群) replies falling through to top-level messages instead of staying within the thread.
Problem: In Feishu topic groups, messages within a thread carry a
thread_idin metadata but thereply_toparameter can beNone. The existing code only checkedreply_toto decide whether to use the reply API, so thread messages with noreply_towould silently fall back tocreate_message— posting a new top-level message instead of replying in-thread.Fix: Extract
thread_idfrom metadata and use it as a fallback whenreply_tois absent. This ensures the reply API is called with the correct message target, keeping responses within the thread context.Changes
gateway/platforms/feishu.py: 3 lines changed in_send_single_messagethread_idbefore the reply decisioneffective_reply_to = reply_to or thread_ideffective_reply_tofor both the guard condition and the reply requestTesting
Tested in production with a Feishu bot deployed in topic groups (话题群). Before the fix, bot responses appeared as new top-level messages. After the fix, responses correctly appear within the originating thread.
Made with Cursor