agentscope-ai / agentscope-ai/agentscope-java

A2A streaming BufferingTube overflow with parallel tool calls

オープン
#1,821 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area/ext/integration bug
主要言語
Java
スター
5.6k
フォーク
1.3k
平均マージ
4日 12時間
マージ済み PR(30日)
77

説明

## 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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。