Repository navigation
fix(ui): avoid voice session expiry while waiting for microphone access - #133384
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:57 PM ET / 16:57 UTC. ClawSweeper reviewWhat this changesThe PR acquires Browser Talk microphone input before allocating a provider session, then hands that input to WebRTC, Google Live, or gateway-relay transport. Merge readinessThis maintainer-authored, maintainer-labeled PR stays open for exact-head checks and normal merge handling; source and test review found no introduced blocking defect. Priority: P1 Review scores
Verification
How this fits togetherBrowser Talk turns a Control UI start action into microphone permission, provider-session allocation, and one browser voice transport. The change prevents permission waits from consuming short-lived provider activation windows. flowchart LR
A[Start Browser Talk] --> B[Request microphone]
B --> C[Prepared microphone input]
C --> D[Create provider session]
D --> E[Select voice transport]
E --> F[Voice call connected]
Decision needed
Why: The item is maintainer-authored and carries the protected maintainer label, so automated cleanup must not decide its final disposition. Before merge
Agent review detailsSecurityNone. PR surfaceSource +47, Tests +56, Docs +4, Other 0. Total +107 across 27 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: Land the single prepared-input lifecycle after exact-head CI: no net-neutral alternative preserves the shared cancellation, late-grant release, and three-transport handoff contract. Do we have a high-confidence way to reproduce the issue? Yes, by holding Is this the best way to solve the issue? Yes. The session lifecycle owner now acquires and owns the microphone once, while transports only adopt it, eliminating the previous three acquisition paths without changing provider TTLs or configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eed74eefd336. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Maintainer review complete for c09107d. The latest ClawSweeper review has no patch findings or additional rank-up repairs; its remaining requirement is exact-head CI and normal maintainer landing. The subsequent commit changes only the three stale E2E expectations revealed by hosted CI. A fresh independent review of the complete final change has no actionable P0–P2 findings. Root cause and owner: the browser session allocated a short-lived provider credential before waiting for microphone permission. The canonical session owner now prepares one input and transfers it to WebRTC, Google Live, or Gateway relay, removing three separate acquisition paths. Eight regressions fail before the repair; 284 voice tests, both microphone-lifetime browser scenarios, and all 11 start/stop/WebKit/camera/backpressure sibling scenarios pass afterward. The real-clock local broker also proves the 60-second expiry failure. Synthetic fixtures are not physical-microphone or authenticated-provider proof. I accept the net +21 production lines (+127/-106, including factory relocation) for the single prepared-input ownership boundary. Tests/support are +466/-384; docs +4; the assertion baseline shrinks from seven to two at the former owner. No auth, configuration, TTL, schema or protocol surface changes. The restart follow-up is #133387; its selected repair simplifies private client lifecycle rather than adding a transactional Gateway protocol. The hosted assertion-safety failure was fixed by removing redundant casts, documenting existing transport assumptions and reducing the old baseline. The later browser shard failure was corrected by asserting zero allocations on denied input and checking release of the first microphone during stop/restart; that shard now passes. Landing remains gated on completion of the current exact-head CI run: https://github.com/openclaw/openclaw/actions/runs/33323580069. Update: exact-head CI is now fully green. I also read the refreshed ClawSweeper review for c09107d; its +21-line ownership-growth decision is accepted for the reasons above, and its CI condition is satisfied. Proceeding through native prepare/merge. |
|
Merged via squash.
|
…ss (openclaw#133384) * fix(ui): acquire voice microphone before session allocation * chore(ui): document moved voice transport assertions * test(ui): assert microphone-first browser voice lifecycle
Closes #133359
What Problem This Solves
Fixes an issue where users starting Browser Talk could lose the connection before it began if granting microphone access took longer than the provider's activation window. OpenAI's pending-offer broker and Google's new-session token both allow 60 seconds; the browser previously allocated that session before requesting microphone access.
Why This Change Was Made
The browser session now acquires one microphone before allocating a provider session and transfers that same input controller to WebRTC, Google Live, or Gateway relay. One pending-startup owner handles cancellation and replacement. Denial allocates nothing, late grants are released, allocation failures release the microphone, and microphone loss during allocation rejects the candidate. Transport factories move into their own existing-responsibility module; per-transport microphone acquisition and cancellation branches are removed.
This repairs startup ordering rather than increasing provider TTLs or adding refresh/retry paths. Authentication, provider selection, configuration, persistence, and protocol contracts are unchanged. The documented browser permission prompt may wait indefinitely; Codex's WebRTC start contract likewise takes an already-prepared SDP offer (
codex-rs/app-server-protocol/src/protocol/v2/realtime.rs:279andcodex-rs/codex-api/src/endpoint/realtime_call.rs:129, directly inspected in openai/codex).Provenance: the ordering is present in the inspected baseline and its preceding startup-guidance fix; the introducing commit is unknown. #117490 corrected Google's exposed expiry units but did not change microphone acquisition order.
User Impact
A first-time microphone prompt can remain open without spending the voice connection token's lifetime. Cancelling or denying it does not create a provider session. This applies to all three supported browser transports, with no new setting or operator action.
Evidence
Invalid or expired realtime session token; it released all reservations and made zero upstream calls. This used synthetic credentials and SDP, not a live authenticated provider call.talk.client.createrequests while waiting, then exactly one after permission is granted and the UI reaches Listening. This is a synthetic browser/Gateway fixture, not a live provider call. Hosted CI exposed three stale sibling assertions that still expected allocation before microphone permission; they now assert zero allocation/close on denial and two captures with old-input release on stop/restart. No runtime change was needed for that correction.The following inspected synthetic captures show the fixed flow. The RPC assertions above prove allocation order; screenshots alone do not. Visible startup guidance was introduced in #133353, so these are pending/ready flow evidence rather than a new rendering change.
Production: +127/-106, net +21, including the factory relocation. Tests/test support: +466/-384, net +82. Docs: +4. Assertion baseline: +1/-1, reducing the old owner allowance from seven to two. The production increase establishes the canonical prepared-input handoff and single startup-resource owner; it replaces three separate acquisition paths. No generated files, dependencies, or runtime configuration surfaces change.
Remaining limits: live provider recognition accuracy and physical microphone/OS permission behavior are not established by these deterministic tests. Replacement tests preserve the previous browser transport; server-side provider replacement activation is tracked separately in #133387 and is not claimed repaired here. No changes to Google manual-VAD behavior are included.