Client continuation messages can be stored with the agent role

未关闭
#1,325 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Linux2010 已经在做这个了。

开始于 2026年11月14日。

  • #1326 来自 @Linux2010 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
50/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java
领域
api, backend

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Java
星标
514
派生
200
平均合并
1 天 2 小时
30 天内合并 PR
53

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

a2aproject/a2a-java 的其他 Issue

查看 a2aproject/a2a-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。