Repository navigation
fix(google): avoid duplicate turn completion after voice interruption - #133365
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 12:13 PM ET / 16:13 UTC. ClawSweeper reviewWhat this changesThe PR retains a Google Live interruption marker until its later completion event, preventing that completion from ending a newer browser Talk turn. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open. The source path supports this focused producer-bound repair and I found no actionable defect introduced by the patch; it remains paired with the open linked issue and has a protected maintainer label. Independent Google contract inspection was unavailable because network DNS failed and this worktree has no installed dependency tree. Priority: P1 Review scores
Verification
How this fits togetherGoogle Live Browser Talk translates provider WebSocket frames into transcript and terminal events for the shared browser turn emitter. The emitter assigns a turn identity to each event and releases it at terminal events. flowchart LR
A[Google Live API] --> B[Browser WebSocket transport]
B --> C[Interruption and transcript handling]
C --> D[Terminal event decision]
D --> E[Shared Talk event emitter]
E --> F[Browser Talk turns]
Decision needed
Why: The implementation is localized and covered, but direct provider-contract inspection was blocked in the review environment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +28. Total +36 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the guard in the Google browser producer, after confirming the provider’s interrupted-to-completion pairing from its contract or retained live trace; do not add a generic shared-emitter workaround. Do we have a high-confidence way to reproduce the issue? Yes, from source: send interrupted, an independently ordered finalized input transcript, then turnComplete on current main; the shared emitter will assign the input a new turn ID before that completion. I did not execute the scenario in this read-only review. Is this the best way to solve the issue? Yes, subject to provider-contract confirmation. The Google transport owns the provider-specific interruption/completion pair, whereas a shared-emitter guard would not know which completion belongs to the interrupted provider turn. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 279a12cf8b89. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Confirmed the provider contract directly and added the requested excerpt to the PR body. Current Google docs and installed SDK 2.18.0 both specify interrupted generation followed by its completion; input transcription remains independently ordered. The live trace confirms the separate pair 95 ms apart. This resolves the review's contract-confirmation/owner decision and completes its rank-up move. Retaining the Google-owned marker is the best fix: its +8 net lines preserve a fact that a generic emitter cannot infer. The regression first failed in both separate-frame orders; all 59 focused tests pass. The patch is identical after moving onto an independent main baseline, and fresh pinned Codex review has no actionable P0-P2 findings. No audible failure or physical-browser live proof is claimed. Exact head 168397b is green: https://github.com/openclaw/openclaw/actions/runs/33321485000 Native review artifacts validate. Proceeding through repository-native prepare/merge; no additional GitHub approval rule is enforced. |
|
Merged via squash.
|
Closes #133351
What Problem This Solves
Fixes an issue where Google Live Browser Talk would create an extra ended turn, or prematurely end the next input turn, when Google completed an already-interrupted response.
Why This Change Was Made
Google sends an interruption followed by completion of that same model turn. Input transcription is independently ordered and may arrive between those messages. The Google browser producer now retains the interruption fact until the matching completion and consumes that completion without emitting a second terminal event. Immediate cancellation, audio clearing, and transcript finalization are unchanged.
This belongs in the Google producer: a generic no-active-turn guard would still incorrectly end an intervening input turn. Gateway relay uses a different event producer and does not emit this duplicate pair. No auth, configuration, protocol, persistence, or provider deadline changes. Provenance: introducing commit unknown; the previous interruption test omitted the separate completion frame.
User Impact
Interrupted Google browser calls preserve Talk turn correlation. The evidence does not show lost saved transcripts or an audible defect, and this change makes no claim to improve speech recognition accuracy. No rendered UI changes.
Evidence
Two regression cases failed before the fix: completion before the next input, and completion after an independently ordered input. The same-frame control already passed. After the fix, all 59 Google browser tests passed across transcript finality, transport, control, video, and setup timeout coverage.
A live Google v1beta call using
gemini-3.1-flash-live-previewand SDK 2.18.0 reproduced the separate-frame sequence with synthetic speech. The provider emitted interruption at 4047 ms, completion at 4142 ms, the next input transcript at 5726 ms, then “Crystal” and a normal completion. Zero errors; clean close. Input-before-completion is supported by the specification and tested deterministically, but was not observed in that call. The live probe establishes the provider sequence; the actual browser producer and shared emitter are exercised by the regression tests.Contract checked directly: https://ai.google.dev/api/live#bidigeneratecontentservercontent and installed SDK types. Fresh pinned Codex review found no actionable P0-P2 findings. Scoped formatting and whitespace checks passed.
Production: +9/-1 (net +8), recording a provider-owned fact not previously retained. Tests: +59/-31, replacing the incomplete test with three ordering cases. The shared emitter, relay, and OpenAI paths are unchanged.
Provider contract confirmation
Maintainer verification addresses the review's unavailable-network limitation and rank-up request. Google’s current Live API reference, checked on August 30, states the interrupted generation sequence as
interrupted > turn_complete; the installed@google/genai2.18.0 declarations repeat: “in interrupted turn, it will go through interrupted > turn_complete.” The same reference says input transcription has no guaranteed ordering, which is why the marker remains through intervening input. The retained live trace independently confirms one interruption and its separate completion, 95 ms apart.Maintainer decision: retain the producer-local marker. Its eight net production lines record the required cross-frame fact; a shared-emitter guard would not protect an intervening input turn. Exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/33321485000