fix: legacy A2A executor finalizes metadata-only responses as completed#5225
Open
giulio-leone wants to merge 1 commit intogoogle:mainfrom
Open
fix: legacy A2A executor finalizes metadata-only responses as completed#5225giulio-leone wants to merge 1 commit intogoogle:mainfrom
giulio-leone wants to merge 1 commit intogoogle:mainfrom
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. |
a8f63fc to
2c6180c
Compare
…ed (google#5188) Three linked bugs in the legacy A2A executor finalization path: 1. Metadata-only/action-only final responses (working state, message with no parts) emitted final=True with status=working instead of completed. The else-branch now resolves working → completed. 2. Delta-style streamed text replaced the accumulated message on each event instead of concatenating TextPart content. TaskResultAggregator._accumulate_message now appends text chunks and merges metadata across successive working events. 3. The synthesized final artifact dropped response metadata from the accumulated message. Artifact now carries message.metadata.
2c6180c to
f69b572
Compare
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
Fixes #5188 — three linked bugs in the legacy A2A executor finalization path.
Root cause
The finalization logic in
_handle_request(lines 276-318) only emittedstate=completedwhen the aggregated message had non-empty.parts. Otherwise it fell through to an else-branch that echoed the raw aggregator state (working) into thefinal=Trueevent.Meanwhile,
TaskResultAggregatorreplaced the accumulated message on every working event instead of concatenating text, and the synthesizedArtifactnever copiedmessage.metadata.Symptoms fixed
final=True, state=workingworking → completed_accumulate_message()concatenatesTextPart.textand merges metadatamessage.metadataFiles changed
src/google/adk/a2a/executor/a2a_agent_executor.pysrc/google/adk/a2a/executor/task_result_aggregator.py_accumulate_message()tests/unittests/a2a/executor/test_a2a_agent_executor.pytests/unittests/a2a/executor/test_task_result_aggregator.pyTests
43 tests pass (37 existing + 6 new):
test_metadata_only_response_completes— metadata-only → completedtest_streamed_text_accumulated_in_final_artifact— concatenated text in artifacttest_metadata_propagated_to_synthesized_artifact— message metadata → artifacttest_delta_text_accumulation— aggregator concatenates TextPart chunkstest_metadata_merged_across_working_events— aggregator merges metadata dictstest_accumulation_with_none_message_is_noop— None message doesn't clear state