[Bug]: REST transport never signals normal stream completion to the client (SSE hangs until timeout)
Maintainer thường phản hồi trong vòng 1 ngày
@SashaMIT đang làm issue này rồi.
Từ ngày 9/10/2026.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start with RestTransport.sendMessageStreaming and the A2AHttpClient postAsyncSSE/getAsyncSSE completion callbacks, then compare the JSON-RPC listener behavior described in the issue. Trace how ClientTransport exposes stream outcomes and how the returned CompletableFuture could support cancellation. Done means REST streams report exactly one normal completion or error and in-flight streams can be released.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened?
What happened?
On the REST (HTTP+JSON) client transport, a streaming call (sendMessage / sendMessageStreaming, resubscribe) never delivers a normal-completion signal to the caller. When the remote finishes a stream cleanly, the client's Flow.Publisher / SSE consumer stays open until it times out, even though the upstream connection has already ended.
The JSON-RPC transport does not surface this the same way: its listener turns the connection-end into a terminal errorHandler(null) completion signal. RestTransport does not do the equivalent, so a REST client has no way to observe that a stream completed normally.
Root cause (as far as we traced it)
The HTTP layer already carries a completion callback — A2AHttpClient's postAsyncSSE / getAsyncSSE accept a completeRunnable. But:
RestTransport.sendMessageStreamingpasses a no-op for thatcompleteRunnableand discards the returnedCompletableFuture, so the transport neither forwards the "stream ended" signal nor retains a handle to the stream.close()on the REST transport is a no-op, so a client cannot release the upstream connection that way either.
The completion signal therefore exists at the HTTP layer and is dropped at the transport layer, never reaching ClientTransport / the client. This is the same no-op REST completion callback that #1170 / #1173 explicitly scoped out when fixing the duplicate-terminal-callback contract for the JSON-RPC listeners: #1170 says to "evaluate REST separately: its native and 0.3 implementations currently both use a no-op completion callback, so changing that is an API decision rather than a compat-only fix," and #1173 left REST as is on those grounds. This issue is to track that deferred REST decision.
Note the signal that's missing is "the connection ended," not "a terminal event arrived." Terminal-event detection alone is insufficient, because a stream can legitimately end with no final event — e.g. an interrupted state (input-required / auth-required), which per #975 / #756 is deliberately non-terminal and keeps the stream open. Those streams close only on connection-end.
Expected behavior
A REST streaming client should be able to observe exactly one terminal outcome per stream — a normal completion or an error — the way the JSON-RPC path does after #1173, and should be able to cancel/release an in-flight stream.
Actual behavior
Normal completion is silently dropped. A stream that ends without a terminal event (or whose terminal event the client isn't watching for) hangs until the caller's own SSE/emitter timeout fires.
Steps to reproduce
- Build a client against an agent whose card selects the REST (HTTP+JSON) transport.
- Start a streaming request (
sendMessagestreaming or resubscribe) against a remote that ends the stream by closing the connection without a finalTaskStatusUpdateEvent— e.g. a turn that ends oninput-required. - Observe that the client's stream never completes; it stays open until timeout.
Workaround
Decorate the A2AHttpClient for one stream's duration: wrap the completeRunnable handed to postAsyncSSE / getAsyncSSE so connection-end fires a caller-visible callback, and retain the returned CompletableFuture so the stream can be cancelled on caller disconnect. This recovers both capabilities the transport drops, but it reaches around the SDK for something the transport could expose directly.
Proposed fix
Thread the existing HTTP-layer completion callback through RestTransport and expose it on ClientTransport, mirroring what JSON-RPC effectively does after #1173. This is additive and backward-compatible — callers that don't supply a completion handler are unaffected. (@scarvel8 offered a similar PR in #310.)
Related
- #310 — feature request for a stream-completion callback (transport-agnostic); this issue is the REST-transport-specific bug behind it.
- #1170 / #1173 — fixed the JSON-RPC SSE terminal-callback contract and explicitly deferred REST as an API decision (#1170: "evaluate REST separately ... a no-op completion callback ... an API decision").
- #975 / #756 — interrupted states are intentionally non-terminal, which is why connection-end (not terminal-event detection) is the signal that must be exposed.
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Java
- Star
- 505
- Fork
- 185
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 26
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-java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
a2aproject/a2a-java#1012 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
a2aproject/a2a-java#464 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksCó thể làm lại được @tanish111 đã nhận 357 ngày trước và không có pull request nào đang mở. Đang mởsample
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
a2aproject/a2a-java#375 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
a2aproject/a2a-java#1222 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
No structured payload loggingĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
a2aproject/a2a-java#1221 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của a2aproject/a2a-java
Issue tương tự
-
status: waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
AOT compilation fails for derived delete queries returning SetCó thể đã có người làm @ryujungkyun đã nhận hôm nay. Đang mởstatus: waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
spring-projects/spring-data-jpa#4387 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/rocketmq-dashboard#6636 ·
Maintainer thường phản hồi trong vòng 3 ngày