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
Bug Description
convert_a2a_message_to_event()into_adk_event.pyhard-codesrole="model"for all resulting ADK events, regardless of the original A2AMessage.role. User messages (Role.user) are incorrectly restored as model events.The task history fallback (
a2a_task.history[-1]) also does not checkMessage.role, so a trailing user message can be treated as agent output.Steps to Reproduce
Expected Behavior
Role.usershould map to an ADK event withrole="user"Affected Files
src/google/adk/a2a/converters/to_adk_event.py