Repository navigation
fix(voice-call): shutdown no longer leaves media connections open - #116536
Conversation
a6270f0 to
186df53
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 3:59 PM ET / 19:59 UTC. ClawSweeper reviewWhat this changesThe PR makes voice-call shutdown wait for and terminate active classic-media and realtime WebSocket connections, while concurrent stop calls share one completion promise. Merge readinessKeep this PR open for normal maintainer review. Current main still stops the webhook server without closing the plugin-owned classic-media and realtime WebSocket handlers, while this patch adds coordinated ownership and completion barriers for those paths; no concrete correctness or security defect was found in the reviewed change. Priority: P1 Review scores
Verification
How this fits togetherThe voice-call plugin receives provider webhooks and upgrades media or realtime connections into provider-backed audio sessions. Runtime shutdown flows through the tunnel and webhook server, which must drain those owned connections before a reload or stop reports completion. flowchart LR
A[Provider webhook or reload] --> B[Voice-call runtime]
B --> C[Webhook server]
C --> D[Classic media handler]
C --> E[Realtime voice handler]
D --> F[Media and transcription sockets]
E --> G[Realtime bridges and sockets]
C --> H[Completed shutdown]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +124, Tests +352. Total +476 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the coordinated handler-owned shutdown path after the remaining required checks complete and a voice-call owner confirms the lifecycle ordering remains the desired reload contract. Do we have a high-confidence way to reproduce the issue? Yes, from source and the added loopback lifecycle tests: current main closes the HTTP server without closing the media or realtime handler-owned upgraded sockets, and the patch exercises concurrent shutdown completion and socket termination. Is this the best way to solve the issue? Yes. Handler-owned socket closure coordinated through the webhook drain barrier is narrower and more maintainable than trying to infer or terminate those provider connections from the runtime layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7ba4df67ad4b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Related: #116201
What Problem This Solves
Fixes an issue where stopping or reloading voice-call could report completion while classic media or realtime WebSocket connections were still open. Concurrent stop callers could also return before the first shutdown finished.
Why This Change Was Made
The classic and realtime handlers now own and terminate their active sockets, while webhook shutdown keeps both handlers closed through the HTTP drain barrier. Intentional shutdown takes completed-state precedence, stale stream tokens are cleared, disconnect timers are cancelled, and concurrent callers share one completion promise.
User Impact
Voice-call shutdown and reload now finish deterministically without leaving media connections or provider bridges behind. No provider, configuration, or environment-variable surface changes.
Evidence
check:changedexplicit voice-call path gate passed, including production/test typechecks and type-aware lint.