agentscope-ai / agentscope-ai/agentscope-java

A2A streaming BufferingTube overflow with parallel tool calls

Aberta
#1,821 0 comentários 0 reações 0 responsáveis Ver no GitHub
area/ext/integration bug
Linguagem predominante
Java
Estrelas
5.6k
Forks
1.3k
Merge médio
4d 12h
PRs com merge (30d)
77

Descrição

## Bug Description

When using A2A streaming with parallel tool calls (e.g., multiple MCP tools executing concurrently), the A2A SSE response throws `IllegalStateException: overflow buffer is full`
from mutiny-zero's `BufferingTube`. The client loses the stream termination signal.

## Root Cause

`a2a-java-sdk-server-common` defines `AsyncUtils.DEFAULT_TUBE_BUFFER_SIZE = 256` (measured in event count, not bytes). When an agent executes multiple tools in parallel, the
produced streaming events can exceed 256 items before the downstream SSE consumer drains them, causing the `BufferingTube` to overflow.

The `A2aJsonRpcController` in `agentscope-a2a-spring-boot-starter` does not apply any `onBackpressureBuffer()` to the Flux chain, so it relies entirely on the a2a-java-sdk
default capacity of 256.

## Stack Trace

java.lang.IllegalStateException: The following item cannot be propagated because there is no demand and the overflow buffer is full:
io.a2a.spec.SendStreamingMessageResponse@6c031fb4
at mutiny.zero.internal.BufferingTube.handleItem(BufferingTube.java:27)
at io.a2a.transport.jsonrpc.handler.JSONRPCHandler$1.onNext(JSONRPCHandler.java:264)
at io.a2a.server.requesthandlers.DefaultRequestHandler$1.onNext(DefaultRequestHandler.java:445)
...

## Steps to Reproduce

1. Register multiple MCP tools that can be invoked by the agent
2. Send an A2A streaming request that triggers the agent to call multiple tools in parallel
3. When total streaming events exceed 256, the `BufferingTube` overflows and the stream terminates abnormally
4. The A2A client never receives the completion event

## Proposed Fix

Add a configurable `stream-buffer-size` property to `A2aCommonProperties` (default: 1024) and apply `onBackpressureBuffer()` in `A2aJsonRpcController`.

## Environment

- AgentScope Java: 2.0.0-RC3
- a2a-java-sdk: 0.3.3.Final

---

I will submit a PR to fix this.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

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