Skip to content

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

Closed
enjoykumawat wants to merge 1 commit into
google:mainfrom
enjoykumawat:fix/a2a-metadata-restoration
Closed

enjoykumawat wants to merge 1 commit into
google: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.

@rohityan rohityan added a2a [Component] This issue is related a2a support inside ADK. and removed core [Component] This issue is related to the core interface and implementation labels Jul 9, 2026
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Jul 11, 2026
@enjoykumawat

Copy link
Copy Markdown
Contributor Author

Closing as superseded. While rebasing this onto current main, I found _create_event() in to_adk_event.py already restores all the metadata fields this PR added (custom_metadata, usage_metadata, error_code, grounding_metadata) via _extract_genai_metadata, plus a fifth field (citation_metadata) this PR didn't cover — landed independently via 3127f368/eee700a0/0ba7d3cb.

Nothing left of this PR to contribute — thanks for the review time regardless.

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

Labels

a2a [Component] This issue is related a2a support inside ADK. 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

4 participants