[Bug]: SendStreamingMessage returns an empty 200 stream when the executor produces no events
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What happened?
Since #1345, SendMessage with an AgentExecutor that returns without enqueueing any event fails with InvalidAgentResponseError ("Agent execution produced no events", JSON-RPC -32006). SendStreamingMessage with the same executor still answers 200 text/event-stream with zero events and closes, so the client gets no Task, no Message and no error.
Spec §3.1.2 says the stream MUST either contain exactly one Message, or begin with the Task: https://a2a-protocol.org/latest/specification/#312-send-streaming-message. An empty stream is neither, and the client can't tell it apart from a stream that closed early.
Code on main (2ba8e7b): on_message_send has the guard (https://github.com/a2aproject/a2a-python/blob/2ba8e7bd27fce7de92c33813a46dbea1e3f7e6ce/src/a2a/server/request_handlers/default_request_handler_v2.py#L522-L527); on_message_send_stream returns once subscribe() ends, whatever it yielded (https://github.com/a2aproject/a2a-python/blob/2ba8e7bd27fce7de92c33813a46dbea1e3f7e6ce/src/a2a/server/request_handlers/default_request_handler_v2.py#L547-L572).
Repro
import asyncio
from a2a.server.agent_execution import AgentExecutor
from a2a.server.context import ServerCallContext
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.tasks import InMemoryTaskStore
from a2a.types.a2a_pb2 import AgentCapabilities, AgentCard, Message, Part, Role, SendMessageRequest
class SilentExecutor(AgentExecutor):
async def execute(self, context, event_queue):
return None
async def cancel(self, context, event_queue):
return None
def request():
return SendMessageRequest(message=Message(message_id='m1', role=Role.ROLE_USER, parts=[Part(text='hi')]))
async def main():
handler = DefaultRequestHandler(
agent_executor=SilentExecutor(),
task_store=InMemoryTaskStore(),
agent_card=AgentCard(name='a', version='1', capabilities=AgentCapabilities(streaming=True)),
)
try:
await handler.on_message_send(request(), ServerCallContext())
except Exception as e:
print('on_message_send ->', type(e).__name__, e)
events = [e async for e in handler.on_message_send_stream(request(), ServerCallContext())]
print('on_message_send_stream ->', events)
asyncio.run(main())
Output on main:
on_message_send -> InvalidAgentResponseError Agent execution produced no events
on_message_send_stream -> []
Over HTTP the same thing shows up as SendMessage returning a -32006 error, while SendStreamingMessage (JSON-RPC) and POST /message:stream (REST) return 200 with an empty event stream.
Expected: the streaming call fails the same way as the non-streaming one: InvalidAgentResponseError, which the JSON-RPC dispatcher and the REST dispatcher already turn into an error response because they read the first event eagerly.
Actual: an empty, successful stream.
I have a fix with a regression test and will open a PR.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Python
- Star
- 2.2k
- Fork
- 540
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 56
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của a2aproject/a2a-python
-
[Bug]: `A2A-Version` validation ignores minor versions and the query parameterCó thể đã có người làm @rohityan đã nhận 82 ngày trước. Đang mởcomponent: server status:awaiting response status:stale
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
a2aproject/a2a-python#1204 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: REST task/request id sanitizationCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởmaintainers-only
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
a2aproject/a2a-python#805 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: JSON-RPC client ignores the JSON-RPC error body when the HTTP status is not 2xxCó thể đã có người làm @rohityan đã nhận hôm nay. Đang mở
a2aproject/a2a-python#1475 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Feat]: validate_input_modes: match media ranges such as image/* declared in the agent cardCó thể đã có người làm @rohityan đã nhận 2 ngày trước. Đang mở
a2aproject/a2a-python#1468 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Required extensions aren't enforced, so ExtensionSupportRequiredError is never raisedCó thể đã có người làm @rohityan đã nhận 2 ngày trước. Đang mởcomponent: server status:awaiting response
a2aproject/a2a-python#1467 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của a2aproject/a2a-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Install the skills as a Claude Code pluginCó thể đã có người làm @ruban-24 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 6 ngày
-
Make the usage of time-zone aware UTC timestamps the norm across the pynxtools NOMAD ecosystemĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
FAIRmat-NFDI/pynxtools#874 ·
-
Eval: PublicationĐang mởdata
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100