fix(gateway): preserve reply anchors across queued turns - #64752
Open
hansnow wants to merge 3 commits into
Open
Conversation
…ly-anchor # Conflicts: # scripts/release.py
Contributor
|
Thanks for tracing this through the queued recursive path. The reported defect is present on current main: The |
12 tasks
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
Fix reply anchoring when multiple messages are queued into the same shared group session.
When two group members mention the agent while a turn is already running, the queued turn's final response could be delivered using the original event. This caused the later answer to quote the earlier member's message instead of the message that produced that answer.
Root cause
_run_agent()recursively processed queued follow-ups but returned only the final response text to the outer delivery layer. The outer layer therefore still held the first event's chat and message context.Intermediate queued replies also did not explicitly bind delivery to the message ID for the turn being completed.
Solution
MessageEventand reply anchor back to the delivery layer withAnchoredReply.reply_to_mode=firstonly after the first successful visible delivery, while preservingreply_to_mode=allfor every delivered part.Validation
git diff --checkpassed.codex -m gpt-5.6-sol review --uncommittedcompleted with no actionable findings.