[Bug]: AgentEmitter remains terminal when terminal event enqueue fails
Maintainer thường phản hồi trong vòng 1 ngày
@kabir đang làm issue này rồi.
Từ ngày 25/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What happened?
AgentEmitter.updateStatus() and AgentEmitter.fail(A2AError) mark the emitter terminal before calling EventQueue.enqueueEvent().
If enqueueing throws, no terminal event is delivered, but the emitter remains marked terminal. DefaultRequestHandler catches the exception and attempts to report an InternalError through emitter.fail(A2AError). That fallback call then throws: IllegalStateException: Cannot update task status - terminal state already reached
The original enqueue failure is logged, but the secondary terminal state exception escapes the error handling path and prevents the fallback error event from being emitted.
Reproduction steps
This behavior is reproducible using the SDK’s built-in EventQueue, including when a terminal enqueue is interrupted while waiting for queue capacity.
- Create an
AgentEmitterbacked by anEventQueuethat throws fromenqueueEvent(). - Call a terminal operation such as
emitter.complete(). - Catch the resulting exception, as
DefaultRequestHandlerdoes. - Call
emitter.fail(new InternalError()).
The fallback operation throws because the first attempt left terminalStateReached set.
Both final status updates through updateStatus() and protocol errors through fail(A2AError) set the terminal flag before enqueueing and are affected.
Reproduced with the SDK’s built-in EventQueue using a size-one queue at capacity and interrupting the terminal enqueue. This was a focused reproduction, not production log output.
Expected behavior
The SDK should handle a failed terminal enqueue without replacing the original failure with a secondary “terminal state already reached” exception. Its terminal state should remain consistent with whether a terminal event was successfully accepted for processing.
Relevant log output
Initial terminal enqueue failure:
java.lang.RuntimeException: Unable to acquire the semaphore to enqueue the event
Fallback failure:
java.lang.IllegalStateException:
Cannot update task status - terminal state already reached
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Java
- Star
- 495
- Fork
- 174
- Merge trung bình
- 1 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 43
Chuẩn bị môi trường
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 341 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 74/100
a2aproject/a2a-java#1182 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
a2aproject/a2a-java#1161 ·
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ự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
refinedmods/refinedstorage2#1414 · 1 bình luận ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
In Java's `LongBoundedSum`, setting `lower` to `Long.MIN_VALUE` under-estimates the sensitivityĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
google/differential-privacy#489 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ScyllaDB Manual: 3 broken linksĐang mởlink-check link-check:manual
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100