Skip to content

fix: validate client message roles - #1326

Open
Linux2010 wants to merge 1 commit into
a2aproject:mainfrom
Linux2010:codex/validate-client-message-role
Open

Linux2010 wants to merge 1 commit into
a2aproject:mainfrom
Linux2010:codex/validate-client-message-role

Conversation

@Linux2010

Copy link
Copy Markdown
Contributor

Problem

A client can submit an agent-authored message while continuing a task, and the default handler forwards it to the executor and stores it in task history as ROLE_AGENT. This can make caller-supplied text appear agent-authored. See #1325.

Change

Validate client message roles in the shared initMessageSend path for normal and streaming requests. Reject non-ROLE_USER roles with InvalidParamsError before loading or updating a task or invoking the executor. Update test fixtures that represented client requests using an agent role, while keeping agent-authored output unchanged.

The protocol describes ROLE_USER as client-to-server and ROLE_AGENT as server-to-client. This change tightens validation of inputs previously accepted by the SDK; it does not assert an additional explicit protocol MUST about receiver rejection.

Validation

  • mvn -o -pl server-common -am test: 621 server-common tests passed, including new normal/streaming and new-task/continuation cases.
  • v1 handler tests: JSON-RPC 74 tests (one skipped), gRPC 62, REST 91.
  • v0.3 compatibility handler tests: JSON-RPC 25, gRPC 19, REST 42.
  • The transport tests call the real adapters in process, not over a TCP network. They verify existing invalid-parameter mappings and that the agent does not execute.
  • git diff --check passed. Full repository mvn clean install and Quarkus network integration were not run locally.

Fixes #1325

This branch has not been deployed

No deployments
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.

Client continuation messages can be stored with the agent role

1 participant