fix(gateway): add reply_to for all mid-turn messages in group chats - #10929
Closed
shamork wants to merge 1 commit into
Closed
fix(gateway): add reply_to for all mid-turn messages in group chats#10929shamork wants to merge 1 commit into
shamork wants to merge 1 commit into
Conversation
All mid-turn messages sent during agent processing were missing reply_to, causing them to appear as standalone posts in group chats instead of threading under the user's original message. On Feishu/Lark this was especially broken: - Normal groups: mid-turn messages posted to group root, not as replies - Topic groups: messages created spurious new topics because reply_in_thread only takes effect in the ReplyMessage API path, which requires reply_to to be set Fix: propagate event_message_id as reply_to through every mid-turn message path in _run_agent() and _run_agent_via_proxy(): gateway/run.py: - send_progress_messages() — tool progress line edits - _status_callback_sync() — context pressure / status events - _interim_assistant_cb() — natural mid-turn commentary (non-streaming) - _approval_notify_sync() — dangerous command approval card and plain-text fallback - _notify_long_running() — periodic "still working" heartbeat - _deliver_bg_review_message() — background code-review callback - Inactivity warning — "no activity for N min" timeout warning - Queued-message first-response delivery after interrupt - GatewayStreamConsumer creation (both local and proxy paths) gateway/stream_consumer.py: - New reply_to constructor parameter, wired through _send_commentary(), _send_or_edit() first-send path, and _send_fallback_final() gateway/platforms/feishu.py: - send_exec_approval() now accepts and forwards reply_to instead of hardcoding None
This was referenced Apr 22, 2026
Closed
Contributor
Author
|
fixed by 910684c9 |
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?
All mid-turn messages sent during agent processing were missing
reply_to, causing them to appear as standalone posts in group chats instead of threading under the user's original message.On Feishu/Lark this was especially broken:
reply_in_threadonly takes effect in theReplyMessageAPI path, which requiresreply_toto be setFix: propagate
event_message_idasreply_tothrough every mid-turn message path in_run_agent()and_run_agent_via_proxy():gateway/run.py:
send_progress_messages()— tool progress line edits_status_callback_sync()— context pressure / status events_interim_assistant_cb()— natural mid-turn commentary (non-streaming)_approval_notify_sync()— dangerous command approval card and plain-text fallback_notify_long_running()— periodic "still working" heartbeat_deliver_bg_review_message()— background code-review callbackGatewayStreamConsumercreation (both local and proxy paths)gateway/stream_consumer.py:
reply_toconstructor parameter, wired through_send_commentary(),_send_or_edit()first-send path, and_send_fallback_final()gateway/platforms/feishu.py:
send_exec_approval()now accepts and forwardsreply_toinstead of hardcodingNoneRelated Issue
Fixes Feishu/Lark group chat threading — mid-turn messages broke out of thread context.
Type of Change
Changes Made
gateway/run.py— propagatedreply_to=event_message_idto all 8+ mid-turn message pathsgateway/stream_consumer.py— addedreply_toconstructor param, wired through commentary/edit/fallback sendsgateway/platforms/feishu.py—send_exec_approval()accepts and forwardsreply_toHow to Test
rm -rf /tmp/test) → verify the approval card is posted as a replypytest tests/ -q— 184 passed, 16 skipped, 0 failed. The only known failure (test_run_agent_previewed_final_marks_already_sent) is a pre-existing issue unrelated to this changeChecklist
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
Before: mid-turn messages appear as standalone posts / create new topics in Feishu groups
After: all mid-turn messages correctly thread under the user's original message