Repository navigation
fix(live): handle goAway and voice activity notifications - #1878
Open
YuqiGuo105 wants to merge 1 commit into
Open
YuqiGuo105 wants to merge 1 commit into
YuqiGuo105 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Closes #1872.
Problem
GeminiLlmConnectiontreats valid LivegoAway,voiceActivity, andvoiceActivityDetectionSignalmessages as unknown-message errors. In particular, thegoAway.timeLeftwarning never reaches callers. Simply recognizing these messages in the connection is insufficient: the flow also discards contentless responses unless their metadata is explicitly preserved.Solution
goAwayandvoiceActivityfields toLlmResponseandEvent, following ADK Python's response fields. Preserve them through the flow, JSON round-trips, builders, and event equality.goAwayandvoiceActivitynotifications without reporting an error. Recognize the lower-levelvoiceActivityDetectionSignalwithout emitting an event, since it has no ADK event representation.This change exposes the warning; it does not implement automatic reconnection/session resumption or address SDK-level wire parsing issues.
Testing Plan
Automated tests
GeminiLlmConnectionTest,LlmResponseTest,EventTest,BaseLlmFlowTest, andRunnerTest.Runner.runLive.goAwaydoes not close the connection or prevent later responses.Validation on the latest fetched
main(dde4b23d), using Maven 3.9.16 and Temurin 25.0.3 (Java release 17):mvn -o -B -pl core -am clean testBoth main core test executions (
default-testandbasic) report 4,177 tests, 0 failures, 0 errors, and 35 skipped. The additional configured Vertex AI/Apigee/tracking-header executions also pass. These are repeated/configured executions, not distinct-test counts to be added together.The illegal-Optional-parameter check passes for all changed production files. Running that optional profile across all core sources previously reported 12 violations in seven unchanged files; those are outside this patch.
Manual End-to-End (E2E) Tests
Not performed against a real Gemini Live endpoint; automated tests use simulated messages and a fake transport/model. To verify manually:
Runner.runLivesession and inspect emitted events.goAwaywarning, verifyevent.goAway()preservestimeLeft, with no unknown-message error and no immediate client-initiated close.event.voiceActivity()carries the activity type without being classified as a final answer.Checklist