Skip to content

[Bug]:A2A在传递userId、sessionId时发送逻辑和取值逻辑不一致,导致userId、sessionId在server端丢失。 #1603

Closed

Description

@ZhangChHao

版本为1.1.0-RC2

在client端调用agent发送请求时,会调用A2aAgent的doCall方法,doCall方法会对消息进行处理,将多条消息合并为一条消息。

Image

convertFromMsg方法会将消息的metadata变为<msgId,metadata>的键值对。

Image

但是在server端进行解析时存在不一致,导致下面两个方法无法正确获取到userId、sessionId

Image Image

这是我的client端代码
public class A2aAgentClient {

public static void main(String[] args) {
    // 创建 A2A Agent
    A2aAgent agent = A2aAgent.builder()
            .name("remote-agent")
            .agentCardResolver(
                    WellKnownAgentCardResolver.builder()
                            .baseUrl("http://127.0.0.1:8946")
                            .build()
            )
            .build();
    Msg response = agent.call(Msg.builder().textContent("你好 我是张三").metadata(Map.of("userId","11")).build())
            .block();
    String collect = response.getContent()
            .stream()
            .filter(TextBlock.class::isInstance)
            .map(TextBlock.class::cast)
            .map(TextBlock::getText)
            .collect(Collectors.joining());
    System.out.println(collect);
}

}
这是server端debug的截图,可以明显看到metadata中的结构

Image

Activity

  1. added
    bug
    on Jun 4, 2026
  2. added
    area/ext/integration
    on Jun 5, 2026
  3. moved this from Backlog to In progress in AgentScope Javaon Jun 18, 2026
  4. moved this from In progress to Done in AgentScope Javaon Nov 2, 2026
  5. added a commit that references this issue on Nov 2, 2026
    fcc36d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ext/integrationbug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions