google / google/adk-python

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

Đang mở
#5,185 2 bình luận 0 reaction 3 người được giao Được @GWeale nhận Xem trên GitHub
core needs review
Ngôn ngữ chính
Python
Star
21.5k
Fork
4k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
37

Mô tả

## Bug Description

The public inbound converters `convert_a2a_message_to_event()` and `convert_a2a_task_to_event()` in `to_adk_event.py` only restore `actions` from A2A metadata. Other ADK event metadata fields (`custom_metadata`, `usage_metadata`, `error_code`, `long_running_tool_ids`, etc.) are silently dropped.

Additionally, `_create_event()` returns `None` when there are no `parts` and no `actions`, even if `event_metadata` is present. This means metadata-only A2A messages are discarded entirely.

## Steps to Reproduce

```python
from a2a.types import Message, Part, TextPart, Role

msg = Message(
role=Role.agent,
parts=[],
metadata={"adk_custom_metadata": {"flag": True}}
)
event = convert_a2a_message_to_event(msg, author="agent")
assert event is not None # FAILS — metadata-only message silently dropped
```

## Expected Behavior

- `custom_metadata`, `usage_metadata`, and other semantic metadata fields should be restored on the resulting `Event`
- Metadata-only messages (no content parts, but valid metadata) should produce a valid `Event` with `content=None`

## Affected Files

- `src/google/adk/a2a/converters/to_adk_event.py`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.