fix(feishu): prevent topic replies from spawning new threads#16620
Closed
julysir wants to merge 1 commit into
Closed
fix(feishu): prevent topic replies from spawning new threads#16620julysir wants to merge 1 commit into
julysir wants to merge 1 commit into
Conversation
…l patch) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Likely duplicate of #16018 — same root cause: Feishu topic thread replies create new topics due to missing root_id to thread_id fallback and reply failure fallback behavior. |
Contributor
|
Salvaged via #19711 onto current main. Main has since added ephemeral-message handling at the two dispatch sites your PR targeted, so the Feishu reply-anchor fix was re-applied in-place on the HEAD send blocks (modifying the existing |
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
When replying inside a Feishu topic-enabled group chat, the agent would create a new topic/thread instead of staying inside the current one. This breaks multi-agent workflows where several bots operate in parallel within the same group — replies "cross" into stray topics.
Two root causes:
root_idwas not used as a fallback forthread_id. When Feishu didn't providethread_iddirectly, thread context was silently lost.230011/231003), the code fell back toim.v1.message.create. In topic-enabled groups this spawns a brand-new topic instead of staying in the thread.Changes
gateway/platforms/feishu.py(+13 / −1)thread_idwithroot_idas fallback (thread_id || root_id)root_idto thereply_to_message_idfallback chain (parent_id → upper_message_id → root_id)metadata.thread_idis set), skip the fallback and return the error response as-is — avoids spawning a new topicgateway/platforms/base.py(+21 / −3)event.reply_to_message_idoverevent.message_idwhen:event.source.thread_id) andreply_to_message_idis availableTest plan