fix(gateway): pass reply_to for Feishu thread routing on status/progress/stream messages - #9384
Closed
creasexul wants to merge 1 commit into
Closed
fix(gateway): pass reply_to for Feishu thread routing on status/progress/stream messages#9384creasexul wants to merge 1 commit into
creasexul wants to merge 1 commit into
Conversation
…ess/stream messages
Feishu's CreateMessage API does not support thread_id — only the
ReplyMessage API does (via reply_in_thread). Several message-sending
paths in the gateway only passed metadata={'thread_id': ...} without
reply_to, causing status notifications, tool progress updates, stream
consumer messages, and long-running heartbeats to appear outside the
conversation thread on Feishu.
Fixed paths:
- Tool progress messages (send_progress_messages)
- Status callback messages (context pressure, connection retry)
- Long-running heartbeat notifications (Still working...)
- GatewayStreamConsumer initial send + fallback sends
The fix adds a _progress_reply_to variable (set to event_message_id
when a thread context exists) and threads it through all send() calls
and the GatewayStreamConsumer constructor.
houko
reviewed
Apr 14, 2026
houko
left a comment
Contributor
There was a problem hiding this comment.
Good fix — properly routing Feishu progress messages to threads via reply_to is important for thread continuity. 👍
Contributor
|
Thanks for the focused Feishu routing fix. This is already implemented on current
The discussion’s cross-reference to #19750 tracks the same resolved behavior. |
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.
Problem
Feishu's CreateMessage API does not support
thread_id— only the ReplyMessage API does (viareply_in_thread). Several message-sending paths in the gateway only passedmetadata={'thread_id': ...}withoutreply_to, causing these messages to appear outside the conversation thread on Feishu as standalone messages:Root Cause
The
_send_raw_messagemethod infeishu.pyuses the ReplyMessage API (which supports threading) only whenreply_tois provided. When onlymetadata={'thread_id': ...}is passed, it falls through to CreateMessage, which ignores thread_id entirely.The tool progress path already had a comment documenting this behavior but the fix was incomplete — it was never applied to status callbacks, long-running notifications, or the stream consumer.
Fix
_progress_reply_to = event_message_id if _progress_thread_id else Noneas a shared variablereply_tothrough all affected send paths:send_progress_messages()— 3 send calls_status_callback_sync()— context pressure, connection retry_notify_long_running()— heartbeat notificationsGatewayStreamConsumer— addedreply_toconstructor param, used in initial send + fallback pathsFiles Changed
gateway/run.py— 5 send calls + new_progress_reply_tovariablegateway/stream_consumer.py— newreply_toparam + 4 send callsTesting
_progress_reply_toisNone, behavior unchangedreply_to=Noneis the default, no behavioral change