Repository navigation
fix: legacy A2A executor finalizes metadata-only responses as completed - #5225
giulio-leone wants to merge 3 commits into
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
|
Hi @giulio-leone , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh and mypy-diff tests. |
|
Hi @giulio-leone , Since the requested changes are still pending, I'm going to close this PR. Feel free to reopen once you've had a chance to address the requested changes, or create a new PR. Thanks! |
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