[Bug]: AgentEmitter remains terminal when terminal event enqueue fails
维护者通常 2 天内回复
@kabir 已经在做这个了。
开始于 2026年9月25日。
评估
这个 Issue 还没有评估数据。
描述
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
- 主要语言
- Java
- 星标
- 495
- 派生
- 174
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 48
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
a2aproject/a2a-java 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
a2aproject/a2a-java#1012 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
a2aproject/a2a-java#464 · 1 条评论 ·
维护者通常 2 天内回复
-
Create a sample that demonstrates how to use a shared contextId across multiple tasks可能重新可做 @tanish111 于 340 天前认领,目前没有进行中的 PR。 未关闭sample
难度 2/5 1-3 小时 新手友好度 70/100
a2aproject/a2a-java#375 · 5 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 74/100
a2aproject/a2a-java#1182 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
a2aproject/a2a-java#1161 ·
维护者通常 2 天内回复
查看 a2aproject/a2a-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
OpenAPITools/openapi-generator#25014 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
openhab/openhab-core#5847 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 88/100
apache/parquet-java#3820 ·
维护者通常 1 天内回复