agentscope-ai / agentscope-ai/QwenPaw
[Bug]: ACP delegate_external_agent sometimes returns "completed without text output" when notifications race the prompt response
- 主要言語
- Python
- スター
- 34.9k
- フォーク
- 3.1k
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 225
説明
## Description
When an external ACP agent writes a `session/update` notification and the `session/prompt` response back-to-back (e.g. same TCP segment), `delegate_external_agent` sometimes returns **"completed without text output"** even though the agent produced text.
## Root cause
The ACP transport (external `acp` SDK) resolves the prompt response future **inline**, while the notification runner is still queued as a **separate task**. In `ACPService._wait_for_prompt_outcome()`, `finish_prompt()` is called immediately after the prompt future resolves — at that point the notification carrying the final text may not have been processed yet, so `_assistant_text` is empty and the final text is dropped.
## Repro
Occurs reliably when the agent server flushes the notification and the response together in one TCP segment / readline batch. The server-side symptom matches the race documented in the ACP SDK transport.
## Fix (PR #6623)
Two complementary changes:
1. `client.py`: `session_update()` emits accumulated text immediately on `AgentMessageChunk` (in addition to the `finish_prompt()` flush), so streaming consumers capture the text via `on_message`.
2. `service.py`: `_wait_for_prompt_outcome()` yields to the event loop (`await asyncio.sleep(0)`) before calling `finish_prompt()`.
See https://github.com/agentscope-ai/QwenPaw/pull/6623
## Environment
- QwenPaw version: main (2026-08-01)
- OS: Linux (aarch64)
コントリビューションガイド
評価
この issue はまだ評価されていません。