Repository navigation
fix(voice-call): native-delegation realtime calls cannot hang up or open cleanly - #165715
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed October 6, 2026, 3:08 AM ET / 07:08 UTC (Revision 12). ClawSweeper reviewWhat this changesThe voice-call plugin adds call-scoped delegated hang-up, optional speech-idle termination, delayed verbatim outbound greetings, and service-lifecycle repairs. Merge readiness⛔ Needs changes before merge - 1 item remains This PR remains useful: current main still lacks delegated hang-up and delayed native-delegation greetings. No blocking code defect was identified, but the previous request for real delegated hang-up evidence remains unresolved. Priority: P2 Review scores
Verification
How this fits togetherThe voice-call plugin connects carrier phone calls to realtime voice providers and delegates selected requests to the OpenClaw agent. It manages audio playback, conversation transcripts, and carrier call termination. flowchart TD
A[Carrier phone call] --> B[Realtime voice bridge]
B --> C[Greeting and speech activity controls]
B --> D[Delegated OpenClaw agent]
D --> E[Active call and service authority guard]
E --> F[Call manager]
C --> F
F --> G[Carrier hang-up]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +354, Tests +901, Docs +13, Generated 0. Total +1268 across 24 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep call control with the existing service and CallManager, with delegated authority restricted to ending the active call and silence termination remaining opt-in. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the affected path: native-delegation providers receive no function tools, and current main supplies no call-scoped hang-up binding. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes, the repair reuses existing tool bindings and the service-owned CallManager rather than creating competing call control. The optional idle setting also preserves the existing default. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 48b40f4909f6. LabelsLabel changes: No label 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
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
5a37d55 to
f83dcb9
Compare
eb62f51 to
56eb6da
Compare
56eb6da to
ac65199
Compare
fc73e0b to
bf0a8d4
Compare
…pen cleanly Realtime voice models that use native agent delegation (GPT-Live) cannot call the end-call tool or any custom tool, so outbound calls could not hang up, and the opening line was spoken over the callee with an improvised prefix. - Add optional realtime.idleHangupMs: the host ends the call when neither side has spoken for that long; in-flight consults pause the timer, and silent paced model frames do not count as speech. - Outbound calls speak the initial message verbatim and only after the callee first speaks, with a 3 s fallback for silent pickups/voicemail. - Realtime consults get voice_call bound to the active call through trusted tool bindings; only end_call for that call is allowed, and the service registration is revalidated at the hang-up effect. Other actions, foreign call ids, ended calls, and retired registrations are rejected before any carrier effect. - Far-side speech while no model audio plays no longer cancels an in-flight consult, and a stale plugin registration can no longer retire the running voice-call runtime mid-call. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017KYf18XrvyNu6uCLG874jq
bf0a8d4 to
80f3b82
Compare
|
Merged via squash.
|
…pen cleanly (openclaw#165715) Realtime voice models that use native agent delegation (GPT-Live) cannot call the end-call tool or any custom tool, so outbound calls could not hang up, and the opening line was spoken over the callee with an improvised prefix. - Add optional realtime.idleHangupMs: the host ends the call when neither side has spoken for that long; in-flight consults pause the timer, and silent paced model frames do not count as speech. - Outbound calls speak the initial message verbatim and only after the callee first speaks, with a 3 s fallback for silent pickups/voicemail. - Realtime consults get voice_call bound to the active call through trusted tool bindings; only end_call for that call is allowed, and the service registration is revalidated at the hang-up effect. Other actions, foreign call ids, ended calls, and retired registrations are rejected before any carrier effect. - Far-side speech while no model audio plays no longer cancels an in-flight consult, and a stale plugin registration can no longer retire the running voice-call runtime mid-call. Claude-Session: https://claude.ai/code/session_017KYf18XrvyNu6uCLG874jq Co-authored-by: mbelinky <[email protected]>
What Problem This Solves
Fixes: on realtime phone calls with a voice model that uses native agent delegation (GPT-Live over ChatGPT OAuth), the call cannot hang up and the outbound opening line is spoken over the callee with an improvised prefix, because that model cannot call the end-call or custom tools the voice-call plugin relies on.
User Impact
User impact: operators on the subscription (OAuth) voice route get calls that end on their own after silence, an opening line that is spoken verbatim once the callee has answered, and hang-up through the OpenClaw agent, limited to the current call. In-call key presses (DTMF) are deliberately out of scope here; they will come in a separate PR once delivery to a real IVR is proven.
New optional
realtime.idleHangupMs(unset keeps today's behaviour). Hold music is not speech, so pick a value longer than expected holds.Outbound realtime calls on native-delegation models now wait for callee speech (3 s silent-pickup fallback) before the opening line. Function-tool providers and inbound calls keep the current greeting behaviour.
The realtime consult agent gets
voice_callbound to the active call; onlyend_callfor that call is accepted, and the service registration is revalidated at the hang-up effect. Other actions, foreign call ids, ended calls, and retired registrations are rejected before any carrier effect.Config surface: plugin budget 4490 → 4491 for the single optional
realtime.idleHangupMskey (off by default); there is no existing setting that expresses a host-side speech-idle limit.Speech-idle activity follows what is actually heard: every audible inbound caller frame, and every audible assistant frame when the pacer plays it out to the carrier (not when the provider delivers it), so neither a long caller nor buffered assistant playback is cut off.
Why This Change Was Made
Native-delegation models expose no tool surface to the voice bridge, so call control has to live on the host (idle timer, verbatim greeting) and in the consult agent (scoped
voice_call). Live testing also showed two defects that the same path hit: far-side speech cancelled the consult even when nothing was playing (phone menus repeat their prompt), and a tool run could activate a stale plugin registration, which retired the running voice-call runtime mid-call and leftvoicecall.initiatefailing with "runtime generation was superseded". Both are fixed here.Evidence
Focused suites (
--maxWorkers=1):realtime-call-control.test.ts+realtime-handler.test.ts81 passed;index.lifecycle,index.call-scope,command-service,realtime-call-session-control,telephony-audio,runtime,config,agent-consult-runtimeall green (see per-file timings in the diff description).Live calls (Twilio, GPT-Live
gpt-live-1-codexvia OAuth, test gateway on this branch): opening line spoken verbatim only after the callee spoke; speech-idle hang-up ended a finished call withendReason=timeout10 s after the last words; after the model-output RMS gate, continuous paced audio no longer counts as speech.Authority proof (
index.call-scope.test.ts, through the registered tool and a realCallManager, spying on the carrier provider'shangupCall): boundend_callreachesmanager.endCallexactly once; foreign ids, other actions, ended calls, and retired/replaced registrations are rejected with no effect; a hang-up admitted before consult cancellation completes once.Owner phone round on this branch (Twilio, GPT-Live, mobile): opening waited for the callee and was verbatim; silent pickup started after the fallback; speech-idle hang-up ended the call.
oxfmt,git diff --check, line-cap and max-lines ratchets pass.tsc -p tsconfig.extensions.jsonreports no diagnostics in touched files (80 pre-existing elsewhere). Targeted oxlint could not run locally: itsprepare-extension-package-boundary-artifactsprerequisite timed out.CI: the only red check,
check-test-types-core-4, fails insrc/flows/doctor-health.migration-refusal.test.ts, which this PR does not touch (inherited from main). The full voice-call suite on this head passes: 52 files, 632 tests.Notes for reviewers
realtime-call-session-control.tsholds the greeting and speech-idle controllers;tool-call-scope.tsholds the consult-scoped tool guard.🤖 Generated with Claude Code
https://claude.ai/code/session_017KYf18XrvyNu6uCLG874jq