Bug Description
In remote_a2a_agent.py, both _handle_a2a_response() (legacy) and _handle_a2a_response_v2() access attributes like event.content or event.custom_metadata on results from convert_a2a_message_to_event() / convert_a2a_task_to_event() without checking for None. This results in AttributeError when a converter legitimately returns None.
Additionally, the legacy handler still uses the outdated event_converter.py path instead of the newer to_adk_event.py converters, and update.context_id is ignored in favor of task.context_id only.
Steps to Reproduce
This can be triggered when a remote A2A agent sends:
- A message with no convertible parts
- A task snapshot with no artifacts and no status message
- A status update where the message converter returns
None
Expected Behavior
Handlers should guard against None converter results with early returns.
Affected Files
src/google/adk/agents/remote_a2a_agent.py
Bug Description
In
remote_a2a_agent.py, both_handle_a2a_response()(legacy) and_handle_a2a_response_v2()access attributes likeevent.contentorevent.custom_metadataon results fromconvert_a2a_message_to_event()/convert_a2a_task_to_event()without checking forNone. This results inAttributeErrorwhen a converter legitimately returnsNone.Additionally, the legacy handler still uses the outdated
event_converter.pypath instead of the newerto_adk_event.pyconverters, andupdate.context_idis ignored in favor oftask.context_idonly.Steps to Reproduce
This can be triggered when a remote A2A agent sends:
NoneExpected Behavior
Handlers should guard against
Noneconverter results with early returns.Affected Files
src/google/adk/agents/remote_a2a_agent.py