Repository navigation
fix(voice-call): terminate carrier calls after realtime startup failures - #118699
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 3, 2026, 10:12 AM ET / 14:12 UTC. ClawSweeper reviewWhat this changesThis PR makes realtime voice-call startup failures terminate the underlying carrier call and adds lifecycle regression coverage for construction failures, teardown exceptions, races, and bridge replacement. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep this maintainer-labeled PR open. The patch appears to repair a real lifecycle gap by moving carrier termination into the exactly-once error finalizer, but the supplied evidence is still a mocked loopback harness rather than independently inspectable after-fix runtime proof. Priority: P1 Review scores
Verification
How this fits togetherThe voice-call plugin receives a carrier media WebSocket, creates a realtime provider bridge, and records terminal state through the call manager. When bridge startup fails, the carrier provider must also receive a hangup request so the remote call does not remain active after the local session is removed. flowchart TD
A[Carrier call and media stream] --> B[Realtime WebSocket handler]
B --> C[Realtime provider bridge startup]
C --> D{Startup succeeds?}
D -->|Yes| E[Active bridge and audio session]
D -->|No or error terminal| F[Exactly-once call finalizer]
F --> G[Call manager terminal event]
F --> H[Carrier hangup API]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource +18, Tests +213. Total +231 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the canonical exactly-once finalizer approach, then attach a redacted after-fix lifecycle trace or terminal artifact showing that a realtime startup failure calls the carrier hangup exactly once without terminating a replacement bridge. Do we have a high-confidence way to reproduce the issue? Yes, from source and the added loopback lifecycle harness: an initial Is this the best way to solve the issue? Yes. Centralizing error hangup in the existing exactly-once terminal finalizer covers both synchronous and asynchronous startup failures while preserving the active-successor ownership guard; duplicating hangup calls at each failure site would reintroduce race risk. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c547f16506e6. 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
|
|
Merged via squash.
|
* origin/main: fix(onboard): keep referenced provider secrets out of plaintext (#118702) docs: show canonical agent roster configuration (#118722) fix(channels): generate catalog from package manifests (#118097) fix(zalouser): distinguish probe timeout from auth failure (#111336) improve(ui): cut E2E shard runtime by reusing the bundle (#118697) fix(cli): publish completion caches atomically (#118715) fix(whatsapp): honor disabled self-chat without widening group access (#118711) fix(voice-call): terminate carrier calls after realtime startup failures (#118699) fix(slack): isolate GovSlack media trust and delivery (#118695) fix(browser): wrap page-controlled action results (#118691) fix(security): sanitize JSON-escaped forged content boundaries (#118698) test(qa): prove real yielded-child completion and channel delivery (#118707) fix(doctor): honor explicit plugin-only migration authority (#118700) fix(security): detect child_process calls through aliases and computed members (#116304) test(gateway): avoid async facade mock race (#118708) fix(gateway): preserve final speech during transcription shutdown (#118693) fix(gateway): resume durable outbound delivery retries (#118694) fix(plugins): reject external public-artifact hardlinks (#118689)
* origin/main: (78 commits) fix(parallels): recover Windows poll transport failures (#118479) fix(channels): deny unauthorized Discord and Telegram binding access (#118704) fix(test): bound shared git inventory lookup (#111171) fix(onboard): keep referenced provider secrets out of plaintext (#118702) docs: show canonical agent roster configuration (#118722) fix(channels): generate catalog from package manifests (#118097) fix(zalouser): distinguish probe timeout from auth failure (#111336) improve(ui): cut E2E shard runtime by reusing the bundle (#118697) fix(cli): publish completion caches atomically (#118715) fix(whatsapp): honor disabled self-chat without widening group access (#118711) fix(voice-call): terminate carrier calls after realtime startup failures (#118699) fix(slack): isolate GovSlack media trust and delivery (#118695) fix(browser): wrap page-controlled action results (#118691) fix(security): sanitize JSON-escaped forged content boundaries (#118698) test(qa): prove real yielded-child completion and channel delivery (#118707) fix(doctor): honor explicit plugin-only migration authority (#118700) fix(security): detect child_process calls through aliases and computed members (#116304) test(gateway): avoid async facade mock race (#118708) fix(gateway): preserve final speech during transcription shutdown (#118693) fix(gateway): resume durable outbound delivery retries (#118694) ...
* origin/main: fix(onboard): keep referenced provider secrets out of plaintext (openclaw#118702) docs: show canonical agent roster configuration (openclaw#118722) fix(channels): generate catalog from package manifests (openclaw#118097) fix(zalouser): distinguish probe timeout from auth failure (openclaw#111336) improve(ui): cut E2E shard runtime by reusing the bundle (openclaw#118697) fix(cli): publish completion caches atomically (openclaw#118715) fix(whatsapp): honor disabled self-chat without widening group access (openclaw#118711) fix(voice-call): terminate carrier calls after realtime startup failures (openclaw#118699) fix(slack): isolate GovSlack media trust and delivery (openclaw#118695) fix(browser): wrap page-controlled action results (openclaw#118691) fix(security): sanitize JSON-escaped forged content boundaries (openclaw#118698) test(qa): prove real yielded-child completion and channel delivery (openclaw#118707) fix(doctor): honor explicit plugin-only migration authority (openclaw#118700) fix(security): detect child_process calls through aliases and computed members (openclaw#116304) test(gateway): avoid async facade mock race (openclaw#118708) fix(gateway): preserve final speech during transcription shutdown (openclaw#118693) fix(gateway): resume durable outbound delivery retries (openclaw#118694) fix(plugins): reject external public-artifact hardlinks (openclaw#118689)
Summary
Root cause and actual billing impact
On provider startup rejection, the voice owner emitted its local terminal event and deleted the call/index/max-duration safety timer, but never called the actual Twilio/Telnyx carrier hangup API. The carrier call remained active, billable, invisible, and unrecoverable. Bundled OpenAI voice providers intentionally reject invalid-key/timeout startup without firing
onClose, so the existing established-call error callback could not cover this path. Synchronous bridge construction failures and throwing close callbacks also left startup teardown incomplete.The existing plugin-owned exactly-once terminal finalizer now owns one carrier hangup for every actual error terminal. Synchronous startup and throwing cleanup converge on that same owner; stale/replaced bridges cannot terminate an active successor, and successful/normal terminal events never invoke erroneous hangups.
Real handler/dependency proof
Exact-head real localhost production-lifecycle proof
One focused execution drove the actual production
RealtimeCallHandlerthrough a genuinely registered localhost WebSocket upgrade and a synthetic recording carrier. Four provider-close failure modes each terminated the carrier exactly once and recorded exactly one terminal error; initial bridge construction failure likewise hung up exactly once. A stale predecessor failure never terminated the replacement call: its WebSocket remained open and speech succeeded. Carrier/network transport was deliberately synthetic; no real Twilio/Telnyx operation or external request occurred.{"result":"PASS","pullRequest":118699,"head":"19a1369d7be141015bd634e7c85b1e50d7def50a","proof":"actual production RealtimeCallHandler through registered localhost WebSocket upgrade and synthetic carrier","passed":6,"failed":0,"startupFailures":[{"providerClose":"no-callback","carrierHangups":1,"managerTerminalErrors":1},{"providerClose":"completed","carrierHangups":1,"managerTerminalErrors":1},{"providerClose":"error","carrierHangups":1,"managerTerminalErrors":1},{"providerClose":"throws","carrierHangups":1,"managerTerminalErrors":1}],"initialBridgeCreationFailure":{"carrierHangups":1,"managerTerminalErrors":1},"stalePredecessorFailure":{"carrierHangups":0,"managerTerminalErrors":0,"replacementSocket":"OPEN","replacementSpeak":"succeeded"},"realCarrierCalls":0,"externalNetworkRequests":0}Reproduction:
node scripts/run-vitest.mjs extensions/voice-call/src/webhook/realtime-handler.lifecycle.test.ts --reporter=json --silent=true --testNamePattern='hangs up a rejected startup exactly once|hangs up the carrier when its initial realtime bridge cannot be created|does not hang up a replacement when its stale predecessor rejects startup'.