Skip to content

fix: restore A2A inbound metadata and handle metadata-only events#5205

Open
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
enjoykumawat:fix/a2a-metadata-restoration
Open

fix: restore A2A inbound metadata and handle metadata-only events#5205
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
enjoykumawat:fix/a2a-metadata-restoration

Conversation

@enjoykumawat
Copy link
Copy Markdown
Contributor

Summary

  • Restore custom_metadata and other event metadata fields from A2A inbound messages that were silently dropped during conversion
  • Fix _create_event() to return a valid Event when metadata is present but there are no content parts or actions

Root Cause

convert_a2a_message_to_event() only restored actions from A2A metadata. All other ADK event metadata fields were silently dropped. _create_event() returned None for metadata-only messages.

Test Plan

  • Tests for custom_metadata restoration from A2A metadata
  • Tests for metadata-only messages producing valid events
  • Existing A2A converter tests pass

Fixes #5185

The inbound converters in to_adk_event.py only restored `actions` from
A2A metadata, silently dropping `custom_metadata`, `usage_metadata`,
`error_code`, and `grounding_metadata`. Additionally, `_create_event()`
returned None for metadata-only messages with no parts or actions.

Add `_extract_event_metadata()` to restore these fields from A2A metadata
and update `_create_event()` to accept and apply them. Metadata-only
messages now correctly produce a valid Event.
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Apr 8, 2026
@rohityan rohityan self-assigned this Apr 9, 2026
@rohityan rohityan added the needs review [Status] The PR/issue is awaiting review from the maintainer label Apr 13, 2026
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @enjoykumawat , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@rohityan
Copy link
Copy Markdown
Collaborator

Hi @wukath , can you please review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation needs review [Status] The PR/issue is awaiting review from the maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A2A inbound converters do not restore custom_metadata and drop metadata-only events

3 participants