Live API: no way to observe session close or connection errors after setup
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- Java
- Star
- 398
- Fork
- 126
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 71
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 googleapis/java-genai
-
ResponseStream.close() can block on the reader lock before closing the HTTP responseCó thể đã có người làm @hirematha đã nhận 1 ngày trước. Đang mởpriority: p2 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
googleapis/java-genai#1372 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Interactions API: GaosClientException.getMessage() only returns "400 . API error occurred" and omits the server error detailsCó thể đã có người làm @hemasekhar-p đã nhận 25 ngày trước. Đang mởpriority: p2 type: bug
googleapis/java-genai#1282 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Interactions API: store(false) omits "id", breaking Interaction and InteractionCompletedEvent deserializationCó thể đã có người làm @hemasekhar-p đã nhận 25 ngày trước. Đang mởpriority: p2 type: bug
googleapis/java-genai#1281 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Interaction.outputText() always returns Optional.empty() (SDK-computed field is never populated)Có thể đã có người làm @hemasekhar-p đã nhận 25 ngày trước. Đang mởpriority: p2 type: bug
googleapis/java-genai#1280 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Gen AI with structured output - `propertyOrdering` in Python vs. Java implementationsCó thể đã có người làm @hemasekhar-p đã nhận 79 ngày trước. Đang mởpriority: p3 type: feature request
googleapis/java-genai#1169 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của googleapis/java-genai
Issue tương tự
-
[BUG] micronaut-serde-oracle-jdbc-json brings a second OJDBC driver onto the runtime classpathCó thể đã có người làm @ZARAYACH đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
micronaut-projects/micronaut-serialization#1494 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 2 ngày
-
code-health feature/sync OS/Android QA/Test-Plan-Specified QA/Yes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
brave/brave-browser#60327 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
it-at-m/raumreservierung#383 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws/context-ontology-accelerator#325 ·
Maintainer thường phản hồi trong vòng 1 ngày