-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix: Correct message part ordering in A2A history #3262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Response from ADK Triaging Agent Hello @eranco74, thank you for creating this PR! Before we can proceed with the review, could you please address the following points from our contribution guidelines:
This information is necessary to ensure the quality and maintainability of the project. Thanks! |
8e8f7ef
to
626425c
Compare
Unit tests:
|
Response from ADK Triaging Agent Hello @eranco74, thank you for the update and for providing the unit test results! Before we can proceed with a full review, could you please address the remaining items from our contribution guidelines?
You can find more details in our CONTRIBUTING.md. Thanks for your contribution! |
626425c
to
0578d43
Compare
The overall logic processes events in reverse chronological order and then reverses the entire list of collected parts at the end to restore the correct sequence of messages. However, the parts *within* a single message were being appended in their original forward order. This resulted in their sequence being incorrectly inverted by the final list reversal. This change fixes the issue by iterating over an event's parts in reverse. This pre-reversal ensures that after the final list-wide reversal, the internal order of parts within each message is correctly maintained. Signed-off-by: Eran Cohen <[email protected]>
0578d43
to
a7f01bc
Compare
Link to Issue or Description of Change
The previous logic iterated through session events in reverse and then reversed the resulting list of parts. This caused incorrect ordering for multi-part messages generated by
_present_other_agent_message
.Specifically, introductory text like "For context:" was appearing after the content it was meant to introduce.
This change simplifies the implementation by removing both reversals. It now processes events in chronological order, ensuring all message parts are appended in the correct sequence.
Please ensure you have read the contribution guide before creating a pull request.
Problem:
Incorrect ordering for multi-part messages generated by
_present_other_agent_message
.Solution:
processes events in chronological order, ensuring all message parts are appended in the correct sequence.
Testing Plan
Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes.
Unit Tests:
Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.
Checklist
Additional context