Skip to content

A2A inbound message conversion ignores Message.role, always maps to "model" #5186

@YizukiAme

Description

@YizukiAme

Bug Description

convert_a2a_message_to_event() in to_adk_event.py hard-codes role="model" for all resulting ADK events, regardless of the original A2A Message.role. User messages (Role.user) are incorrectly restored as model events.

The task history fallback (a2a_task.history[-1]) also does not check Message.role, so a trailing user message can be treated as agent output.

Steps to Reproduce

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

user_msg = Message(
    role=Role.user,
    parts=[Part(root=TextPart(text="Hello"))],
    metadata={}
)
event = convert_a2a_message_to_event(user_msg, author="user")
# event author is always "model" — should reflect "user"

Expected Behavior

  • A2A Role.user should map to an ADK event with role="user"
  • History fallback should only use agent-role messages to avoid misattribution

Affected Files

  • src/google/adk/a2a/converters/to_adk_event.py

Metadata

Metadata

Labels

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

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions