Client continuation messages can be stored with the agent role

Aberta
#1,325 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@Linux2010 já está trabalhando nisso.

Desde 14/11/2026.

  • #1326 de @Linux2010 — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
50/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
java
Domínio
api, backend

Direção de pesquisa

Start in DefaultRequestHandler.onMessageSend, where a client message reaches the executor with ROLE_AGENT and is written to task history for an existing task. The probe test DefaultRequestHandlerTest#probeClientAgentRoleIsAccepted reproduces the sequence and can be adapted to assert rejection. Done means a client message without ROLE_USER is refused before the executor runs or history changes, and the existing tests still pass. Confirm the rejection behaviour with maintainers first, since the issue proposes enforcing the protocol direction rather than citing an explicit MUST.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

What happened?

A client can send an agent-authored message to DefaultRequestHandler.onMessageSend when continuing an existing task. The request succeeds, the executor receives ROLE_AGENT, and the same caller-supplied message is persisted in the task history with ROLE_AGENT. This can make client text appear agent-authored to history consumers.

Reproduced on a2a-java main 897835ef with an in-memory task store and the real default request handler:

  1. Save a task in TASK_STATE_INPUT_REQUIRED with a task ID and context ID.
  2. Call onMessageSend with a message containing those IDs, a text part, and Message.Role.ROLE_AGENT.
  3. Have the executor start work and complete the task.
  4. The call succeeds; RequestContext.getMessage().role() is ROLE_AGENT, and the persisted task history contains the caller's message ID with ROLE_AGENT.

A focused JUnit test using this sequence passed with mvn -o -pl server-common -am -Dtest=DefaultRequestHandlerTest#probeClientAgentRoleIsAccepted -Dsurefire.failIfNoSpecifiedTests=false test. This reproduction uses the default handler directly, not a network transport. It establishes the existing-task continuation case; it does not claim the new-task response has the same history behavior.

Expected behavior

Reject client messages without ROLE_USER as invalid input before invoking the agent or updating task history. The protocol describes ROLE_USER as client-to-server and ROLE_AGENT as server-to-client. This proposes enforcing that direction rather than asserting a separate explicit protocol MUST for rejection.

Related reports: a2aproject/a2a-go#564, a2aproject/a2a-js#819, a2aproject/a2a-rs#557 and a2aproject/a2a-dotnet#607.

Linguagem predominante
Java
Estrelas
514
Forks
200
Merge médio
1d 2h
PRs com merge (30d)
53

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de a2aproject/a2a-java

Todas as issues de a2aproject/a2a-java

Issues semelhantes

Mais issues de Java

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.