Skip to content

fix(a2a): drop unparseable A2A metadata instead of aborting conversion - #1401

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_958968673
Aug 6, 2026
Merged

fix(a2a): drop unparseable A2A metadata instead of aborting conversion#1401
copybara-service[bot] merged 1 commit into
mainfrom
test_958968673

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Aug 4, 2026

Copy link
Copy Markdown

fix(a2a): drop unparseable A2A metadata instead of aborting conversion

ResponseConverter.parseMetadata rethrew every deserialization failure as
IllegalArgumentException, which propagated out of taskToEvent,
messageToEvent and handleTaskUpdate. Because adk_grounding_metadata,
adk_usage_metadata, adk_custom_metadata and adk_error_code are all
peer-controlled, a single unparseable value from a remote agent could break the
caller's turn. Log at WARN and drop the offending field instead, so auxiliary
telemetry cannot take down the whole conversion.

On the Java side these keys are read-only: nothing in ADK Java writes them, so a
parse failure is always peer data, never our own serialization. This matches the
drop semantics in ADK Kotlin (LegacyA2aConverters.kt logs WARN and returns
null) and ADK Python (to_adk_event._extract_genai_metadata logs and returns
None); Java was the outlier. The warning here omits the parser message, which
quotes the peer's bytes, so it follows Python rather than Kotlin, which still
attaches the exception.

`ResponseConverter.parseMetadata` rethrew every deserialization failure as
`IllegalArgumentException`, which propagated out of `taskToEvent`,
`messageToEvent` and `handleTaskUpdate`. Because `adk_grounding_metadata`,
`adk_usage_metadata`, `adk_custom_metadata` and `adk_error_code` are all
peer-controlled, a single unparseable value from a remote agent could break the
caller's turn. Log at WARN and drop the offending field instead, so auxiliary
telemetry cannot take down the whole conversion.

On the Java side these keys are read-only: nothing in ADK Java writes them, so a
parse failure is always peer data, never our own serialization. This matches the
drop semantics in ADK Kotlin (`LegacyA2aConverters.kt` logs WARN and returns
null) and ADK Python (`to_adk_event._extract_genai_metadata` logs and returns
None); Java was the outlier. The warning here omits the parser message, which
quotes the peer's bytes, so it follows Python rather than Kotlin, which still
attaches the exception.

PiperOrigin-RevId: 960211499
@copybara-service
copybara-service Bot merged commit b75c916 into main Aug 6, 2026
@copybara-service
copybara-service Bot deleted the test_958968673 branch August 6, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant