[Bug]: AgentEmitter remains terminal when terminal event enqueue fails
I maintainer di solito rispondono entro 2 giorni
@kabir ci sta già lavorando.
Dal 25/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- Java
- Stelle
- 495
- Fork
- 174
- Merge medio
- 1g 14h
- PR unite (30g)
- 48
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di a2aproject/a2a-java
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
a2aproject/a2a-java#1012 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
a2aproject/a2a-java#464 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksForse di nuovo libera @tanish111 l’ha presa 340 giorni fa e non c’è nessuna pull request aperta. Apertasample
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
a2aproject/a2a-java#375 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
a2aproject/a2a-java#1182 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
a2aproject/a2a-java#1161 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di a2aproject/a2a-java
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenAPITools/openapi-generator#25014 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openhab/openhab-core#5847 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
apache/parquet-java#3820 ·
I maintainer di solito rispondono entro 1 giorno