Repository navigation
fix: end failed voice calls and preserve Gemini Live transcripts - #133157
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:40 AM ET / 07:40 UTC. ClawSweeper reviewWhat this changesThis PR ends failed browser voice calls, preserves finalized Google Live utterances during calls, and updates Code Mode recovery to the current tool-metadata owner. Merge readinessKeep this maintainer-labeled PR open for normal review. The introduced repairs align with the affected lifecycle owners and regression coverage; exact-head CI is still running and the Google provider contract could not be independently rechecked in this environment. Priority: P1 Review scores
Verification
How this fits togetherBrowser Talk acquires microphone tracks and routes a call through WebRTC, Google Live, or the Gateway relay. Terminal events retire the client session after accepted transcript writes drain, leaving an actionable status for the chat UI. flowchart LR
A[Browser microphone] --> B[Talk transport]
B --> C{Provider event}
C --> D[Google Live transcript handling]
C --> E[OpenAI control sideband]
D --> F[Talk session owner]
E --> F
F --> G[Gateway session history]
F --> H[Visible chat status]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +244, Tests +776, Docs +9. Total +1029 across 32 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge only after exact-head CI completes and the recorded Gemini 3.1 event trace is retained as evidence for the model-specific finality rule. Do we have a high-confidence way to reproduce the issue? Yes—source and focused regressions establish controlled failure paths for microphone termination, sideband failure, and missing Google finality flags. The reviewer did not execute them because this is a read-only checkout and the package-manager host cache is unavailable. Is this the best way to solve the issue? Yes. The patch centralizes microphone ownership, terminal outcomes, and per-role transcript finality at their shared owners instead of adding transport-specific cleanup guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f1d2c5b91f80. 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
|
|
Maintainer review complete on This is a sanitized projection of the observed SDK 2.18.0 events from two synthetic spoken turns. Audio payloads and session/auth metadata are omitted; the transcription objects contain no [
{
"milliseconds": 3345,
"event": "serverContent",
"inputTranscription": {
"text": "Please reply with the single word glacier."
}
},
{
"milliseconds": 3893,
"event": "serverContent",
"outputTranscription": {
"text": "Glacier."
}
},
{
"milliseconds": 4128,
"event": "serverContent",
"generationComplete": true
},
{
"milliseconds": 4733,
"event": "serverContent",
"turnComplete": true
},
{
"milliseconds": 7555,
"event": "serverContent",
"inputTranscription": {
"text": "Now reply with the single word crystal."
}
},
{
"milliseconds": 8076,
"event": "serverContent",
"outputTranscription": {
"text": "Crystal."
}
},
{
"milliseconds": 8299,
"event": "serverContent",
"generationComplete": true
},
{
"milliseconds": 8940,
"event": "serverContent",
"turnComplete": true
}
]The candidate OpenClaw provider separately emitted all four whole final transcripts while still connected, before close, with 97,952 output audio bytes, zero errors, and one close. Browser/provider regressions cover older finish-only input, independent role buffers, completion/interruption, and callback closure. The final voice run passed 533 tests across unit and native browser lanes; the Code Mode integration repair passed another 16 focused tests. Fresh pinned Codex autoreview found no actionable P0–P2 findings. No storage migration applies. Audited production LOC is +433/-303 (net +130), or +376/-246 after discounting 57 unchanged moved HTTP lines. Tests/support are +975/-85 and docs +9/-0. The growth supplies bounded Google transcript accumulation and single lifecycle/outcome owners; cross-transport cancellation, microphone loss, stale events, callback failure, and transcript-drain coverage remain in the PR. No review findings remain unaddressed. The signed-in physical-microphone proof limitation remains explicit in the PR body. |
|
Merged via squash.
|
|
Post-merge verification on c5c6199: the clean managed build, copied-state canary, unchanged shared/agent schema checks, activation, deep health, and HTTP UI checks passed. The running Gateway reports OpenAI realtime ready, and a fresh browser chat turn completed. Saved OpenAI OAuth still creates real GPT-Live calls and exchanges audio. Additional post-deployment stress results are mixed; these do not support a blanket reliability claim:
All four calls connected using the saved OAuth profile. Cleanup reported exactly one close, no provider-error callbacks, no late audio, and no connected peer after close. The distinct-word trace contained fresh input/turn events for the second utterance; the input fixture bytes were independently distinct. No deadline was increased and no failed assertion was relaxed to obtain a pass. Named follow-up: GPT-Live distinct-turn accuracy and intermittent missing second-turn completion. Investigate provider transcription/turn behavior versus relay media timing with captured wire/media evidence; the current observations do not establish the responsible owner. The landed fixes address microphone termination, terminal socket failure, and Google finalization; they do not claim to resolve this follow-up. The real signed-in Chrome microphone start also remained at “Connecting voice input…” after refresh, with no visible prompt or error; cancellation worked. Native Chromium fault-injection proof is retained separately and must not be described as a completed physical-microphone roundtrip. The deployment itself remains healthy. |
Closes #133116
Closes #133117
Closes #133118
What Problem This Solves
Fixes an issue where browser voice calls could remain logically open after their microphone stopped, GPT-Live control-socket failures looked like normal hangups, and successful Gemini Live conversations did not save complete utterances during the call.
Why This Change Was Made
Microphone acquisition, cancellation, and track lifetime now have one owner shared by WebRTC, Google Live, Gateway relay, and composer dictation. The existing terminal Talk event retires the client-owned logical session while accepted transcript writes drain; the actionable error remains visible. GPT-Live carries errors through its existing lease disposer and reports one terminal outcome after cleanup, preserving GA bridge ownership and normal stop behavior.
Google's browser and Gateway producers follow current Live transcription boundaries: Gemini 3.1 input arrives as a complete utterance without
finished; output fragments finalize at explicit transcription or generation completion/interruption. Older input fragments retain their explicit finality contract, including finish-only events. The browser uses bounded per-role buffers and the canonical transcription stream instead of a second model-text path.No provider switch, automatic reconnect, configuration option, schema/protocol version change, dependency, or credential-storage change.
User Impact
A lost microphone or GPT-Live control connection produces a visible failure and releases the call. Complete Gemini utterances are saved during a conversation rather than waiting until hangup or saving only a final fragment. Already-accepted transcript writes remain ordered before logical close, and stale callbacks cannot close a replacement call.
Evidence
Every repaired defect has a failing pre-fix reproduction. The initial stress baseline passed 784 tests across 44 files; the new fault cases exposed gaps in that coverage.
close:completedbefore the patch; the same probe now reportserrorthenclose:errorexactly once. Normal stop remainsclose:completed. Pending/in-flight/active/reservation counts return to zero in both paths.finishedflag, followed bygenerationCompleteandturnComplete. Replaying that trace failed in both pre-fix producers. Older fragmented/finish-only browser transcripts also failed pre-fix.External contracts personally inspected at OSS Codex
dde85b435b16994f956bce08e5fb796ed94c27fd: call transport, terminal WebSocket handling, and sideband ownership/recovery; Google Live events; Google ADK Gemini 3.x input finality; W3C capture lifetime.Known limits and follow-ups: actual signed-in Chrome speech could not complete because microphone acquisition remained pending; page start/cancel worked, but this is not microphone roundtrip proof. Codex's resumable sideband recovery remains a separate ownership-sensitive improvement. Google's explicit manual-VAD setting needs activity boundaries (an isolated live call without them produced no turn); separate interruption/completion frames can also create an empty diagnostic turn. GA sub-250 ms provider-VAD interruption, dictation append backpressure, and exceptional camera/meter consumer cleanup remain separate follow-up investigations.
Production LOC: +433/-303 (net +130); discounting 57 unchanged lines moved into the private HTTP helper gives +376/-246. Tests/test support: +975/-85; docs: +9/-0. Growth adds bounded canonical Google transcript accumulation (+63), one broker terminal-outcome owner (+45 including extraction overhead), logical-session retirement with shared retry policy (+16), and shared microphone ownership (+6). Removed duplicate media acquisition/cancellation cleanup, duplicate write/close retry loops, and the browser model-text transcript path. No config/default or persistence surface was added.
Provenance: the unconditional GPT-Live completed callback and separate startup error callback were added by #133019, verified against raw parent ff6634b of e41c5b8. The earlier generic socket-close behavior, microphone lifetime gap, and Google finality gap predate this repair; exact introducing commits are not established here.
Native browser fault proof on the repaired code (synthetic test account; before/after injected track-ended event, not pre-fix or physical-device screenshots):
Validation on the final frozen patch: 533 passed — OpenAI 70 tests/5 files, Google 80/3, UI 372/21, and native browser E2E 11/2. The new microphone scenario passed four subsequent runs. Its first run failed before Listening with no captured setup state; diagnostic capture was added, with no timeout or SDP change. That first failure remains unclassified. Fresh independent Codex review found no actionable P0–P2 findings after all production/test refactors. The real GPT-Live broker normal-stop and socket-loss probes passed again after helper extraction.
Local
check:changedfound and prompted repair of the dead export and stale composer mock. It also cannot complete type checking against this worktree’s shared stale dependencies: the UI declares pako 3.0.1 (bundled declarations), but the shared tree resolves pako 1.0.11 without types. The unrelated checkout was not reconciled. Clean hosted CI on the exact PR head is required before merge.Final static proof: all scoped lint/styles/format, max-lines/assertion ratchets, unused exports, and plugin production/test types pass. The final test-only spy-handle cleanup separately passed 25 input tests plus lint/format; it did not change the reviewed production bytes.
CI integration repair: the first hosted run failed build/types/lint because main’s #132932 moved
getPluginToolSideEffectOwnerKeybut left Code Mode recovery importing the former module. This branch refresh also updates that one import to the canonicalsrc/plugins/tool-metadata.tsowner, with no policy change. The existing recovery test reproduced three failures before correction; all 16 focused recovery/integration tests pass afterward. Voice implementation bytes are unchanged by the refresh.