Live API: no way to observe session close or connection errors after setup
Los mantenedores suelen responder en 1 día
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Summary
After a Live session is established, a caller has no way to be notified that it ended. When the server closes the session (e.g. after GoAway) or the WebSocket drops, AsyncLive.GenAiWebSocketClient only logs onClosed/onFailure nothing reaches the receive() message consumer or any future, so the application can't react. receive() itself returns an already-completed future (its Javadoc notes it only signals registration), so it can't carry the signal either.
Root cause
In AsyncLive.GenAiWebSocketClient, once sessionFuture is done (i.e. for the whole active session) these just log:
public void onClosed(WebSocket webSocket, int code, String reason) {
logger.log(Level.INFO, "Live session closed ...");
if (!sessionFuture.isDone()) { sessionFuture.completeExceptionally(...); } // else: only logged
}
public void onFailure(WebSocket webSocket, Throwable t, @Nullable Response response) {
logger.log(Level.SEVERE, "Error during live session", t);
if (!sessionFuture.isDone()) { sessionFuture.completeExceptionally(t); } // else: only logged
}
Impact
Found while building the Gemini Live API integration for langchain4j: the wrapper can't tell the application when a session ends. A listen-only voice agent is never notified that the connection dropped the only signal today is an exception on the next send.
Suggested fix
A backward-compatible overload of receive(...), with onError/onClose invoked from onFailure/onClosed after setup (terminal, mutually exclusive, nullable); the existing receive(Consumer) delegates to it:
public CompletableFuture<Void> receive(
Consumer<LiveServerMessage> onMessage, Consumer<Throwable> onError, Runnable onClose)
Open to a different shape (e.g. a listener interface) if you'd prefer.
Environment
com.google.genai:google-genai 1.62.0, and unchanged on current main (1.65.0-SNAPSHOT). Gemini Live API, Java.
- Lenguaje dominante
- Java
- Estrellas
- 398
- Forks
- 126
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 71
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 googleapis/java-genai
-
priority: p2 type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
googleapis/java-genai#1372 ·
Los mantenedores suelen responder en 1 día
-
Interactions API: GaosClientException.getMessage() only returns "400 . API error occurred" and omits the server error detailsPosiblemente ocupada @hemasekhar-p la tomó hace 24 días. Abiertopriority: p2 type: bug
googleapis/java-genai#1282 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Interactions API: store(false) omits "id", breaking Interaction and InteractionCompletedEvent deserializationPosiblemente ocupada @hemasekhar-p la tomó hace 24 días. Abiertopriority: p2 type: bug
googleapis/java-genai#1281 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Interaction.outputText() always returns Optional.empty() (SDK-computed field is never populated)Posiblemente ocupada @hemasekhar-p la tomó hace 24 días. Abiertopriority: p2 type: bug
googleapis/java-genai#1280 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Gen AI with structured output - `propertyOrdering` in Python vs. Java implementationsPosiblemente ocupada @hemasekhar-p la tomó hace 78 días. Abiertopriority: p3 type: feature request
googleapis/java-genai#1169 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de googleapis/java-genai
Issues similares
-
Update samples to Citrus 5.1.0Posiblemente ocupada @asuruceanu la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
snowflakedb/snowflake-kafka-connector#1610 ·
Los mantenedores suelen responder en 1 día
-
add multipart/form-data exampleAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
swagger-api/swagger-petstore#245 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
liquid-java/liquidjava#443 ·
Los mantenedores suelen responder en 2 días