Skip to content

fix(voice-call): keep active call when replacement setup fails - #117960

Merged
vincentkoc merged 3 commits into
mainfrom
fix/voice-call-provisional-close-20260802
Aug 2, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/voice-call-provisional-close-20260802

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Related: #116201

What Problem This Solves

Fixes an issue where an active voice call could be ended when a replacement realtime bridge reported an error synchronously during setup, before that replacement had become the call owner.

Why This Change Was Made

Replacement setup records whether an active predecessor exists before provisional bridge creation. A failed provisional bridge still cleans up its own socket, but cannot emit call.ended or hang up the provider while the live owner map still contains an active bridge. The long-lived callback captures only this primitive admission fact, not a predecessor bridge object, so repeated replacements cannot retain a bridge/session chain. Existing transactional transcript adoption and rollback remain unchanged.

User Impact

An established voice call remains available when a replacement realtime connection fails during creation, instead of being terminated by the failed replacement.

Evidence

  • Regression reproduced on current main: synchronous replacement onClose("error") ended the predecessor.
  • Corrected-head focused replacement tests: 3/3 passed.
  • Corrected-head synchronous-close lifecycle test: 1/1 passed.
  • Exact-head full CI and openclaw/ci-gate: passed.
  • P0 autoreview: clean, confidence 0.98.
  • oxfmt and git diff --check: clean.
  • Retention audit: the callback captures a boolean and performs a live map check; no predecessor bridge, provider, harness, or socket chain is retained.
  • The focused unit is the exact proof for a callback fired synchronously inside createBridge(). Live OpenAI failures occur later during connect(), so live smoke is orthogonal rather than a reproduction of this admission edge.

AI-assisted: yes. I reviewed the implementation and validation evidence.

@vincentkoc vincentkoc self-assigned this Aug 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: voice-call Channel integration: voice-call size: XS labels Aug 2, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 2, 2026 10:36
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 2, 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. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 6:50 AM ET / 10:50 UTC.

ClawSweeper review

What this changes

The PR keeps an existing realtime voice call active when a replacement bridge fails synchronously during setup, while preserving the failed bridge’s cleanup.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this maintainer-authored PR open for normal merge review. Current main can emit call.ended and hang up the provider when a replacement bridge closes with an error before it becomes the owner; the branch adds the missing predecessor-ownership guard and targeted regression coverage. Likely related people: vincentkoc (high confidence) and steipete (medium confidence).

Priority: P1
Reviewed head: b65d010408f23da0247a0f91d8459a6549dab759

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with direct regression coverage and no discrete correctness finding; final readiness depends on exact-head CI and normal maintainer lifecycle review.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-member PR, so the external-contributor real-behavior-proof gate does not apply; the focused regression test remains useful supplemental evidence.
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 maintainer-member PR, so the external-contributor real-behavior-proof gate does not apply; the focused regression test remains useful supplemental evidence.
Evidence reviewed 5 items Current-main failure path: On current main, an error close with no assigned provisional owner bypasses the non-owner return and emits a terminal call event plus provider hangup, even when a predecessor bridge already exists.
Proposed ownership repair: The PR records whether a predecessor existed before bridge creation and suppresses terminal handling only when that predecessor is still the active owner after a synchronous provisional error close.
Regression coverage: The updated test drives a second bridge creation that synchronously reports an error and throws, then verifies the predecessor still accepts speech, no provider hangup occurs, and no terminal call event is emitted.
Findings None None.
Security None None.

How this fits together

The Voice Call plugin accepts provider media events and creates a realtime bridge that owns the active call, transcripts, and provider hangup behavior. A replacement bridge can invoke lifecycle callbacks during construction, so termination must remain owned by the predecessor until the replacement is committed.

flowchart LR
  A[Provider media event] --> B[Voice-call webhook]
  B --> C[Existing realtime bridge]
  B --> D[Provisional replacement bridge]
  D --> E{Bridge setup succeeds?}
  E -->|Yes| F[Commit new call owner]
  E -->|No| G[Close provisional connection]
  C --> H[Existing call remains active]
  F --> H
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main and several exact-head jobs remain in progress, so the final merge result should be refreshed before landing.
  • Resolve merge risk (P1) - This changes the terminal-error ownership condition that governs provider hangup; maintainers should preserve the existing initial-bridge and successful-replacement behavior while accepting the replacement-failure repair.
  • Complete next step (P2) - This protected, maintainer-authored PR has a bounded repair and no mechanical review finding; it should proceed through normal owner review rather than an automated repair lane.
Agent review details

Security

None.

PR surface

Source +6, Tests +15. Total +21 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 1 +6
Tests 1 17 2 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 24 3 +21

Review metrics

Metric Value Why it matters
Terminal error condition 1 ownership condition narrowed The only production behavior change determines whether an error closes the provider call, so lifecycle review matters more than the small diff size.

Merge-risk options

Maintainer options:

  1. Confirm the lifecycle contract and land (recommended)
    Accept the focused guard after reviewing the exact-head result and confirming that initial bridge errors still terminate while replacement errors preserve the predecessor.
  2. Broaden boundary coverage first
    Add a focused assertion for the initial synchronous error path or successful replacement cleanup if maintainers want explicit proof beyond the existing replacement-failure regression.

Technical review

Best possible solution:

Land the predecessor-ownership guard after exact-head review confirms that initial bridge failures still terminate normally, while failed replacement setup leaves the established call and transcript owner intact.

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

Yes: current main’s synchronous onClose("error") path has no predecessor guard before the replacement bridge has an owner, and the PR test exercises that ordering directly.

Is this the best way to solve the issue?

Yes: preserving termination authority at the active bridge owner is the narrowest repair and avoids compensating downstream after a provisional replacement has already emitted lifecycle callbacks.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 session-state: The repair preserves the predecessor bridge and its transcript ownership while the provisional replacement rolls back.
  • add merge-risk: 🚨 availability: The changed onClose branch decides whether an error emits terminal state and hangs up the provider call.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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: A failed replacement connection can terminate an established voice-call workflow for an active user.
  • merge-risk: 🚨 availability: The changed onClose branch decides whether an error emits terminal state and hangs up the provider call.
  • merge-risk: 🚨 session-state: The repair preserves the predecessor bridge and its transcript ownership while the provisional replacement rolls back.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 maintainer-member PR, so the external-contributor real-behavior-proof gate does not apply; the focused regression test remains useful supplemental evidence.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Authored the current three-commit repair and is one of the most frequent contributors in the handler’s local history. (role: recent area contributor; confidence: high; commits: 67dc58cb62fb, b738c6e2d946, b65d010408f2; files: extensions/voice-call/src/webhook/realtime-handler.ts, extensions/voice-call/src/webhook/realtime-handler.test.ts)
  • steipete: The handler’s shortlog shows Peter Steinberger as the largest historical contributor, making this a useful ownership-routing contact for lifecycle invariants. (role: long-running area contributor; confidence: medium; files: extensions/voice-call/src/webhook/realtime-handler.ts)

Rank-up moves

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

  • Refresh the exact merge result after the branch catches up with current main and in-progress checks settle.

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 (1 earlier review cycle)
  • reviewed 2026-08-02T10:41:44.596Z sha b738c6e :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 2, 2026
@vincentkoc
vincentkoc merged commit 9cf1273 into main Aug 2, 2026
106 of 114 checks passed
@vincentkoc
vincentkoc deleted the fix/voice-call-provisional-close-20260802 branch August 2, 2026 10:54
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
…law#117960)

* commit 'ea6e83afd0af18b71226cf24c84ecf8a8eab042d':
  fix(voice-call): avoid retaining replaced bridges
  fix(voice-call): preserve predecessor on provisional close
  test(voice-call): cover provisional replacement close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: voice-call Channel integration: voice-call 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: XS 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