Repository navigation
fix(a2a): use final text when finish_task has no call args - #7769
Open
mangeshraut712 wants to merge 6 commits into
Open
mangeshraut712 wants to merge 6 commits into
mangeshraut712 wants to merge 6 commits into
Conversation
Custom A2A servers may complete a task-mode delegation with only a
finish_task FunctionResponse (result="Task completed.") and put the
answer in text parts of the same event. Args lookup then returns None
and we used to set output={}. Prefer the remote's non-thought text so
the parent still receives the answer. Fixes google#7746.
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
Custom A2A servers can complete a task-mode delegation with only a
finish_taskFunctionResponse (result="Task completed.") and put the actual answer in text parts of the same event._find_finish_task_args_from_historythen returnsNone, and we used to setsession_state[A2A_METADATA_PREFIX + "output"] = {}.When args are missing, prefer the remote event's non-thought text (unwrap with the wrapper key when present; otherwise wrap under
FINISH_TASK_DEFAULT_WRAPPER_KEY) so the parent still receives the answer. Empty text still yields{}with the existing warning.Fixes #7746.
Test plan
pytest tests/unittests/a2a/agent/test_remote_a2a_agent.py -k OutputUnwrapping(7 passed)test_finish_task_response_only_uses_final_text