Repository navigation
fix(voice-call): honor routed agent credentials for realtime calls - #125144
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 4:33 AM ET / 08:33 UTC. ClawSweeper reviewWhat this changesMoves voice-call realtime provider selection from plugin startup to per-call registration so inbound number routes use their selected agent’s credentials, plus renames an internal Node-version export. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readinessNo blocking source defect found. Current main still resolves realtime credentials at plugin startup before an inbound route exists; this branch moves that decision to the frozen call owner. The protected maintainer label and incomplete exact-head checks require maintainer handling before merge. Priority: P1 Review scores
Verification
How this fits togetherThe voice-call plugin receives a carrier stream, creates a call record from its inbound route, then opens a realtime provider bridge. Agent identity, provider readiness, credentials, instructions, and bridge behavior must all use that same call owner. flowchart LR
Carrier[Carrier stream] --> Route[Inbound number route]
Route --> Call[Register call]
Call --> Owner[Freeze routed agent]
Owner --> Provider[Resolve realtime provider and credentials]
Provider --> Bridge[Create voice bridge]
Bridge --> Result[Connected call or visible hangup]
Decision needed
Why: The protected maintainer label requires explicit handling, and only a maintainer can decide whether the documented external-service proof gap is acceptable for this credential-routing change. Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +423, Other 0. Total +427 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one registration closure at the call-lifecycle owner, accept its narrow net +4 production growth for explicit admission handling, and merge only after exact-head CI and maintainer acceptance of the stated live-proof gap. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: current main resolves credentials from the configured default before an inbound call has a routed agent, while the focused loopback test models two routed owners. This read-only review did not run the test. Is this the best way to solve the issue? Yes. Resolving the shared provider contract at the frozen call-registration boundary is preferable to retaining startup-time default-agent selection or adding a fallback across agents. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fb0e8b145e4c. 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
HistoryReview history (1 earlier review cycle)
|
7aa5ca4 to
6c685a2
Compare
|
Land-ready proof for exact head
Known gap: no external carrier number or live OpenAI/xAI credentials were available, so no real telephone call was placed. The loopback proof covers the runtime, manager, call registration, stream-token, and bridge ownership boundary; it is not external-live proof. |
|
Merged via squash.
|
…penclaw#125144) * fix(voice-call): select realtime provider per routed call * test(voice-call): track routing temp directory * fix(ci): stop counting node check as environment variable
Related: #125111 (comment)
What Problem This Solves
Fixes an issue where realtime phone calls routed by inbound number to a non-default agent could fail before the call arrived, or retain a provider selected for the wrong agent, when realtime credentials were agent-scoped.
Why This Change Was Made
Realtime provider readiness and selection now happen after call registration, at the effective per-call route. The frozen call owner drives provider selection, normalized provider config, bridge authentication, capabilities, instructions, and interruption policy through one canonical registration; there is no fallback across agents. Provider-admission failure ends and hangs up an initial call visibly, while a failed replacement preserves its active predecessor.
The product repair is intentionally limited to the voice-call plugin lifecycle. It does not change config, protocol, SQLite, Plugin SDK, provider contracts, or the separate browser capability finding from #125111.
The branch also includes one behavior-neutral repair for a red
maingate encountered during landing: a generated Node-version expression was exported with anOPENCLAW_-prefixed constant name and was therefore miscounted as a new environment variable. Renaming that internal export restores the 501/501 env-var budget without changing its generated bootstrap expression or raising a baseline.User Impact
Operators can route different phone numbers to agents that own different OpenAI or xAI realtime credentials. The plugin can start even when the top-level default agent has no realtime credentials, and a misconfigured routed agent now fails only its call instead of blocking the whole voice-call runtime or using another agent's provider selection.
Evidence
Pre-fix regression:
node scripts/run-vitest.mjs extensions/voice-call/src/runtime.test.ts -t "selects realtime provider readiness from the routed call owner"failed during runtime startup because readiness resolvedagentId: main, producingOpenAI realtime is not configured for mainbefore the routed call existed.Post-fix proof:
node scripts/run-vitest.mjs extensions/voice-call/src/runtime.realtime-routing.test.ts extensions/voice-call/src/runtime.test.ts extensions/voice-call/src/webhook/realtime-handler.test.ts extensions/voice-call/src/webhook/realtime-handler.lifecycle.test.ts extensions/voice-call/src/manager/events.inbound.test.ts src/talk/provider-resolver.test.ts— 93 tests passed across 2 shards.pnpm test extensions/voice-call— 649 tests passed across 61 files.node scripts/check-changed.mjs -- <10 changed paths>— passed the fail-safe all-lanes plan: env-var/max-lines/assertion ratchets, formatting, doctor/plugin boundaries, dead exports, temp-dir ownership, script erasability, database-first and sidecar guards, full core/UI/extension/script/root-test typechecks, full lint, and import cycles.pnpm ui:buildon the rebased head — passed at 337,983 startup-JS gzip bytes, 584 bytes below the unchanged 338,567-byte limit. No UI or performance-baseline edit was needed.node scripts/run-vitest.mjs src/gateway/worker-environments/bootstrap.test.ts test/openclaw-launcher-version.e2e.test.ts src/infra/runtime-guard.test.ts— 72 tests passed; the E2E lane rebuilt the current dist successfully.node --import tsx scripts/check-env-var-count.mts --base origin/main— 501/501 after the internal export rename; before the repair, currentmainreported 502/501.pnpm test extensions/voice-call/src/runtime.realtime-routing.test.ts -- --reporter=verbose— runtime started with no default-agent resolution, then two real loopback carrier WebSocket streams created thesales/OpenAI andsupport/xAI bridges and closed with no active calls.--max-priority P1) — clean for both the voice owner-boundary repair and the final main-gate/test-cleanup changes; no accepted/actionable findings.Proof gap: no external carrier number or live OpenAI/xAI credentials were available for this task, so no real telephone call was placed. The regression uses real runtime, manager, call registration, stream tokens, loopback WebSockets, and bridge connections with simulated agent-scoped credentials.
Production LOC: +93/-89 (net +4). Tests: +480/-57 (net +423).
AI-assisted: yes. The implementation was independently reviewed and the observable route behavior was validated against the contract above.