[Bug]: AgentEmitter remains terminal when terminal event enqueue fails
Los mantenedores suelen responder en 1 día
@kabir ya está trabajando en esto.
Desde el 25/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
- Lenguaje dominante
- Java
- Estrellas
- 500
- Forks
- 179
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 48
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de a2aproject/a2a-java
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
a2aproject/a2a-java#1012 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
a2aproject/a2a-java#464 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksQuizá libre de nuevo @tanish111 la tomó hace 342 días y no hay ningún pull request abierto. Abiertosample
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
a2aproject/a2a-java#375 · 5 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
a2aproject/a2a-java#1161 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
a2aproject/a2a-java#1132 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de a2aproject/a2a-java
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Content
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
RunestoneInteractive/rs#1559 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
inu-appcenter/memorIN-backend#298 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
opendataloader-project/opendataloader-pdf#757 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
redhat-developer/intellij-quarkus#1626 ·