Skip to content

fix(talk): bound browser voice session lifecycle - #117216

Merged
vincentkoc merged 11 commits into
mainfrom
fix/talk-transcript-browser-bound
Aug 1, 2026
Merged

vincentkoc merged 11 commits into
mainfrom
fix/talk-transcript-browser-bound

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Related: #116201

What Problem This Solves

Fixes an issue where browser Realtime Talk sessions could retain transcript-persistence work across repeated stop/restart cycles, and where a replacement transport could displace a healthy active call before the replacement had actually finished starting.

Why This Change Was Made

Browser Talk now uses bounded, lifecycle-owned transcript persistence and transactional transport replacement. Pending transports remain provisional until startup and activation succeed; terminal and late events are fenced; relay buffering is bounded; browser media acquisition is cancellable; and close/cancel/failure cleanup is idempotent and callback-safe.

This remains a browser lifecycle change. It adds no provider, configuration, or environment-variable surface. Google Live setup deadlines remain the narrow follow-up in #109020.

User Impact

Repeated Talk replacement, cancellation, overflow, or startup failure no longer grows detached browser work or silently retires a healthy call. Failed candidates release their media and ownership, while the current session remains usable.

Evidence

Exact head: 05b46b48a0f69011f4952d4d1abe861c2fc7870e

  • Focused browser Talk suite: 15 files, 194/194 tests passed.
  • Static proof: targeted oxfmt, oxlint, and git diff --check passed.
  • Blacksmith Testbox tbx_01kyy62cf1cabtqmc82np9f5ky: pnpm tsgo:core:test && pnpm tsgo:ui passed with exit 0. Run: https://github.com/openclaw/openclaw/actions/runs/30691282814
  • Structured autoreview: TruffleHog clean; no accepted P0 findings; patch rated correct at 0.98.
  • Exact feature-head ClawSweeper artifact: 4/6, proof sufficient, patch correct at 0.84, no findings. Maintainer accepts its recommended two-owner admission cap: one active and one draining session may coexist; further starts fail visibly until durable cleanup releases ownership.
  • Live OpenAI gpt-realtime-2.1 proof using operator-provided auth:
    • backend bridge connected;
    • 182,400 input audio bytes over 190 chunks;
    • 43,200 output audio bytes;
    • user transcript: Please reply with the single word: glacier.;
    • assistant transcript: glacier;
    • response completed with 0 late audio bytes;
    • browser WebRTC connected, applied the remote description, and negotiated audio.
  • Current-main refresh: signed merge commit with e1101d15b87d859f103d182aabf491f7ad59e6b9 as the second parent; the prospective merge against ea3b5df1723763d10b934dd6bcf574e89bc5e83f is conflict-free (merge tree a8e77dfc8180979af08e3dd13a1004bf7b60b0de).

AI-assisted implementation; maintainer-reviewed and live-validated.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@vincentkoc vincentkoc added the P1 High-priority user-facing bug, regression, or broken workflow. label Aug 1, 2026
@vincentkoc vincentkoc self-assigned this Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 1, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 4:54 AM ET / 08:54 UTC.

ClawSweeper review

What this changes

The PR bounds browser Realtime Talk session ownership, makes transport replacement transactional, cancels late media acquisition, and fences late relay, transcript, and connection events.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

The exact PR head is available locally and the proposed browser Talk lifecycle repair is backed by focused tests and a reported live OpenAI/WebRTC run; no concrete patch defect surfaced in source review. This is a member-authored, protected maintainer PR that deliberately establishes a two-owner admission policy for active and draining client voice sessions, so it remains open for explicit maintainer merge judgment rather than automated cleanup.

Priority: P1
Reviewed head: 05b46b48a0f69011f4952d4d1abe861c2fc7870e
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong reported live and focused proof supports a carefully tested lifecycle repair, with the remaining decision being the intended availability trade-off rather than an identified code defect.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: This is a member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless reports an exact-head live OpenAI audio/WebRTC round trip and focused lifecycle test results.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless reports an exact-head live OpenAI audio/WebRTC round trip and focused lifecycle test results.
Evidence reviewed 7 items Exact PR head and diff: The locally available PR head contains the 17-file browser Talk lifecycle change, including the session owner, transactional start path, and focused lifecycle tests.
Transactional replacement boundary: start() retains the committed transport while a candidate starts, commits only after a ready result, and restores the previous transport if activation fails.
Bounded owner policy: The new lifecycle owner counts each client/session key, permits one active and one draining owner, and rejects further starts before they can create another detached lifecycle.
Findings None None.
Security None None.

How this fits together

Control UI Realtime Talk asks the gateway to create a provider session, starts a browser relay/WebRTC/WebSocket transport, and sends finalized transcripts back through gateway RPC. The session object owns the active transport and its transcript queue, while each transport owns browser media and provider connection cleanup.

flowchart LR
  UI[Control UI Talk start] --> Session[Realtime Talk session]
  Session --> Gateway[Gateway session creation]
  Gateway --> Candidate[Provisional browser transport]
  Candidate --> Media[Microphone and camera]
  Candidate --> Provider[Relay or realtime provider]
  Candidate --> Commit[Activate after successful start]
  Commit --> Active[Active voice session]
  Active --> Cleanup[Bounded transcript drain and cleanup]
Loading

Decision needed

Question Recommendation
Should OpenClaw adopt the two-owner browser Talk admission cap—one active session plus one draining client-owned session—where further rapid starts fail visibly until cleanup completes? Accept the bounded admission policy: Merge after exact-head CI is green, keeping the explicit limit as the safety boundary for rapid restart churn.

Why: The cap is an intentional user-visible availability trade-off that prevents unbounded detached lifecycle work; source and tests establish its mechanics, but maintainers must own the product choice.

Before merge

  • Resolve merge risk (P1) - The intended two-owner cap can visibly reject another rapid Talk start while an old client-owned session is still draining; maintainers should explicitly confirm this bounded-failure trade-off before merge.
  • Resolve merge risk (P1) - GitHub currently reports the branch as behind current main; although supplied metadata says it is mergeable and the target files did not change across the inspected main interval, exact-head CI should finish on the refreshed merge result before landing.
  • Complete next step (P2) - A member-authored protected PR has no discrete repair finding, but maintainers must explicitly accept the user-visible two-owner admission policy and wait for current-head CI.
Agent review details

Security

None.

PR surface

Source +581, Tests +1486. Total +2067 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 8 796 215 +581
Tests 9 2052 566 +1486
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 2848 781 +2067

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/chat/realtime-talk-gateway-relay.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm the two-owner lifecycle contract (recommended)
    Accept the one-active-plus-one-draining admission cap and merge only after current-head checks confirm the refreshed branch.
  2. Refine the recovery experience first
    Add a clear in-product retry/recovery state if maintainers decide a rejected rapid restart is too disruptive for normal Talk use.
  3. Pause for product direction
    Do not land the lifecycle policy until an owner chooses the desired behavior under repeated rapid restarts.

Technical review

Best possible solution:

Keep one canonical browser session lifecycle: commit replacement transports only after startup, retain the prior usable call on candidate failure, and surface a clear bounded admission error until durable cleanup releases the retiring owner.

Do we have a high-confidence way to reproduce the issue?

Yes, from source and focused regression tests: repeated replacement, cancelled startup, overflow, and late-event paths are directly modeled at the browser Talk owner boundary, though this read-only review did not execute the suite.

Is this the best way to solve the issue?

Yes, with maintainer confirmation of the admission policy: ownership is recorded at the browser lifecycle boundary rather than inferred downstream, and the candidate transport remains provisional until it is safe to replace the active call.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 75830f027af8.

Labels

Label changes:

  • add merge-risk: 🚨 availability: The explicit two-owner cap can temporarily reject a new browser Talk start until durable cleanup finishes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: This protects an active browser voice workflow from resource retention and premature replacement under stop/restart churn.
  • merge-risk: 🚨 session-state: The patch changes ownership, persistence drain, and terminal cleanup for active and replaced voice sessions.
  • merge-risk: 🚨 availability: The explicit two-owner cap can temporarily reject a new browser Talk start until durable cleanup finishes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless reports an exact-head live OpenAI audio/WebRTC round trip and focused lifecycle test results.

Evidence

What I checked:

  • Exact PR head and diff: The locally available PR head contains the 17-file browser Talk lifecycle change, including the session owner, transactional start path, and focused lifecycle tests. (ui/src/pages/chat/realtime-talk.ts:167, 05b46b48a0f6)
  • Transactional replacement boundary: start() retains the committed transport while a candidate starts, commits only after a ready result, and restores the previous transport if activation fails. (ui/src/pages/chat/realtime-talk.ts:224, 05b46b48a0f6)
  • Bounded owner policy: The new lifecycle owner counts each client/session key, permits one active and one draining owner, and rejects further starts before they can create another detached lifecycle. (ui/src/pages/chat/realtime-talk-transcript-owner.ts:20, 05b46b48a0f6)
  • Focused regression coverage: The added lifecycle suite covers startup failure, cancellation, activation rollback, transcript overflow, owner admission, request deadlines, and late transcript events; the session suite also covers superseded client-owned allocation behavior. (ui/src/pages/chat/realtime-talk-lifecycle.test.ts:85, 05b46b48a0f6)
  • Foundation and related work: The merged durable transcript foundation supplies the shared bounded queue policy; this PR is the browser lifecycle adoption for the open umbrella report. (src/talk/voice-transcript.ts:15, fcb73388379a)
  • Main drift check: Current main is ahead of the PR base, but no changed Talk or gateway-client path was reported between the PR base and the supplied current-main SHA. A local merge-tree write probe could not run because the checkout filesystem is read-only; GitHub reports the PR mergeable. (75830f027af8)

Likely related people:

  • vincentkoc: The PR series and prior Talk lifecycle history identify Vincent Koc as the principal contributor to browser voice ownership and replacement behavior. (role: feature owner and recent area contributor; confidence: high; commits: 05b46b48a0f6, 8fdcdaba76cf, a2679ca314; files: ui/src/pages/chat/realtime-talk.ts, ui/src/pages/chat/realtime-talk-transcript-owner.ts)
  • Peter Steinberger: Recent history on the central Talk session file includes Peter Steinberger’s current-main maintenance commits, making this a useful adjacent routing contact. (role: recent adjacent UI contributor; confidence: medium; commits: 90ae3c253f, 25bb1da3a7; files: ui/src/pages/chat/realtime-talk.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain explicit maintainer confirmation of the two-owner admission policy.
  • Wait for the remaining current-head CI lanes before landing.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-08-01T04:52:19.357Z sha 2d284d1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T05:00:00.717Z sha 25b04ce :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T05:19:37.858Z sha 25b04ce :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T05:26:55.527Z sha 2defe13add3fa51f8aeacf8af254bf331cf8fc8a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T05:47:58.996Z sha 2defe13add3fa51f8aeacf8af254bf331cf8fc8a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T05:54:48.054Z sha 2defe13add3fa51f8aeacf8af254bf331cf8fc8a :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the fix/talk-transcript-persistence-bound-clean branch from 0546c98 to b786f4a Compare August 1, 2026 05:32
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 1, 2026
Base automatically changed from fix/talk-transcript-persistence-bound-clean to main August 1, 2026 05:49
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the fix/talk-transcript-browser-bound branch from 2defe13 to c4eda63 Compare August 1, 2026 08:15
@vincentkoc vincentkoc changed the title fix(talk): fence browser transcript persistence fix(talk): bound browser voice session lifecycle Aug 1, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 1, 2026 08:15
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head c4eda63d217a128ec1cc0302f615bd4167a6ee4b is ready. The PR body now includes focused, remote typecheck, autoreview, current-main merge-tree, and live OpenAI audio/WebRTC evidence.

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

* origin/main: (41 commits)
  test(ci): update memory helper routing expectation (#117295)
  fix(canvas): emit successful control results in JSON mode (#117297)
  fix(imessage): settle native inbound reply delivery (#117282)
  fix(agents): reject invalid UTF-8 LSP responses (#117271)
  fix(line): centralize card and template message alt text (#117280)
  fix(release): validate candidates before Docker publication (#117252)
  fix(media): validate provider-owned generated media downloads (#117281)
  fix(feishu): restore custom HTTPS API domains (#117278)
  fix(models): reuse prepared plugin metadata (#117131)
  fix(agents): stop fallback after delivered-but-failed attempts (#114628)
  fix(memory): reuse targeted session corpus snapshot (#117247)
  fix(matrix): reconcile durable sends after response loss
  test(release): repair full validation regressions (#116931)
  fix(linux-canvas): report socket watcher fallback (#109502)
  fix(codex): preserve authoritative turn completion (#117185)
  fix(canvas): preserve widgets across derived-name collisions (#117132)
  fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (#117206)
  fix(msteams): prevent duplicate final replies (#116398)
  fix(doctor): session SQLite restore installs an empty session index over the valid archive (#117221)
  fix(plugins): preserve workspace plugins across CLI and control UI (#117265)
  ...
@vincentkoc

Copy link
Copy Markdown
Member Author

Exact refreshed head: 05b46b48a0f69011f4952d4d1abe861c2fc7870e.

The branch now preserves the ten signed lifecycle commits under a signed merge from current main. Exact-head focused proof is green: 194/194 browser Talk tests, targeted formatting/lint/diff checks, clean structured autoreview, and a live gpt-realtime-2.1 backend plus browser WebRTC audio round-trip with zero late audio.

I accept the prior ClawSweeper artifact's recommended two-owner admission policy: one active and one durable-draining client-owned session may coexist; additional starts fail visibly until cleanup releases ownership. This bounded failure is preferable to unbounded detached session retention.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 1, 2026
@vincentkoc
vincentkoc merged commit 03698f9 into main Aug 1, 2026
120 of 123 checks passed
@vincentkoc
vincentkoc deleted the fix/talk-transcript-browser-bound branch August 1, 2026 09:00
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/pr-117216:
  fix(talk): satisfy lifecycle test contracts
  fix(talk): make transport startup transactional
  fix(talk): cancel pending media acquisition
  fix(talk): retire pending transport on overflow
  fix(talk): reserve replacement ownership first
  fix(talk): separate pending and active transports
  fix(talk): make transport replacement transactional
  fix(talk): release owner after startup failure
  fix(talk): fence late browser voice events
  fix(talk): bound browser transcript ownership
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant