Repository navigation
Conversation
Realtime phone consults called runEmbeddedAgent, which skips the agent's configured runtime, so a Claude-CLI-only agent failed with 'No API key found for provider "anthropic"'. Consults now run as ordinary guest agent turns of the call session through runCommandFromIngress, as Discord voice does: the agent's runtime, the call's history and the normal tool policy apply. Plugin ingress admits a guest turn without messageChannel for a plugin that owns no channel, and accepts toolBindings only for the plugin's declared tools. The CLI runner carries toolBindings into the loopback grant, so voice_call stays bound to the active call.
Webhook handlers run outside the Gateway. Consults now run in the voice-call service context, which carries the in-process Gateway that agent tools such as sessions_send dispatch through.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
🟡 Changes recommended
Inbound calls using owner tool policy can bypass sender-based tool restrictions, while consults also mishandle session settings and routing.
7 open issues
Pass the remote caller as senderId for CLI policy enforcement · New Preserve voice tool-policy filtering in CLI MCP grants · New Avoid implicit primary-model override for voice responses · New Pass the session workspace and cwd to the agent turn · New Preserve the consult's resolved reply target · New Apply thinking defaults only after runtime capability resolution · New Keep consult verbose suppression out of persistent session state · New
What changed in this PR
Routes realtime Voice Call consults through normal agent turns so they can use the configured runtime, including Claude CLI without a provider API key, and retain session history. The classic phone responder reported in #188440 remains unchanged.
Changes:
- Adds an opt-in agent-turn consult runner and runs Voice Call consults in the service’s Gateway context.
- Supports channel-less guest ingress and carries declared tool bindings through CLI execution and loopback tool resolution.
- Adds focused regression tests and documents the new runtime behavior.
| File | Description |
|---|---|
src/talk/agent-consult-runtime.ts |
Adds the agent-turn consult runner. |
src/talk/agent-consult-runtime.test.ts |
Tests guest turn options and runner constraints. |
src/plugins/runtime/types-core.ts |
Defines plugin ingress options and guarantees. |
src/plugins/runtime/runtime-agent.ts |
Forwards admitted tool bindings. |
src/plugins/registry-runtime.ts |
Delegates ingress checks to the new admission helper. |
src/plugins/registry-runtime.channel-ingress.test.ts |
Tests guest admission and binding restrictions. |
src/plugins/registry-runtime-command-ingress.ts |
Validates plugin ingress authority and declared bindings. |
src/gateway/tool-resolution.ts |
Passes bindings into tool construction. |
src/gateway/mcp-grant-store.ts |
Adds tool bindings to loopback request context. |
src/agents/command/types.ts |
Adds plugin-specific ingress options. |
src/agents/command/attempt-execution.ts |
Carries bindings into CLI attempts. |
src/agents/command/attempt-execution.cli-mcp.test.ts |
Tests binding propagation to prepared CLI runs. |
src/agents/cli-runner/types.ts |
Includes tool bindings in CLI run parameters. |
src/agents/cli-runner/tool-authority.ts |
Preserves bindings in tool-authority preparation. |
src/agents/cli-runner/tool-authority.test.ts |
Updates authority-field coverage. |
src/agents/cli-runner/mcp-grant-context.ts |
Snapshots bindings into loopback grants. |
src/agents/cli-runner/mcp-grant-context.test.ts |
Tests binding snapshot isolation. |
extensions/voice-call/src/runtime.ts |
Selects agent turns within the service context. |
extensions/voice-call/src/runtime.test.ts |
Tests dispatch, service context, and cancellation. |
docs/plugins/voice-call/realtime-and-streaming.md |
Documents runtime selection, history, and guest authority. |
docs/plugins/sdk-runtime/config-and-utilities.md |
Documents channel-less ingress and binding rules. |
Review effort: Balanced
| agentRuntime, | ||
| logger: log, | ||
| agentId, | ||
| sessionKey, |
| // An ordinary agent turn of the call session: the agent's runtime (including | ||
| // Claude CLI), the call's history and the caller's guest tool policy apply. | ||
| runner: "agent-turn", |
| provider: agentProvider, | ||
| model, |
| { | ||
| message: prompt, | ||
| agentId, | ||
| sessionKey: params.sessionKey, |
| messageProvider: toolAuthorityOverlay.messageProvider, | ||
| runContext: { senderId: params.senderId ?? undefined }, |
| allowModelOverride: Boolean(params.provider || params.model), | ||
| provider: params.provider, | ||
| model: params.model, | ||
| thinkingOnce: thinkLevel, |
| model: params.model, | ||
| thinkingOnce: thinkLevel, | ||
| fastMode: params.fastMode, | ||
| verbose: "off", |
|
Codex review: needs real behavior proof before merge. What this changesRoutes realtime phone consultations through ordinary agent turns so they can use the agent’s configured CLI runtime. Example: A realtime phone consultation uses a Claude CLI agent without an Anthropic API key.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 15 items remain This PR addresses a current routing defect, but introduces caller-policy, session-state, and routing regressions that block merging. Priority: P1 Decision needed
Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe Voice Call plugin forwards spoken requests into the agent runtime; CLI agents receive tools through Gateway-issued MCP grants, and consultation results return as speech. flowchart LR
A[Phone caller] --> B[Voice Call plugin]
B --> C[Shared consultation runtime]
C --> D[Plugin ingress admission]
D --> E[Agent turn and CLI runtime]
E --> F[Gateway MCP tools]
E --> G[Spoken consultation result]
Technical reviewBest possible solution: Use the existing conversational runtime owner while preserving caller policy, resolved session context, transient output settings, and live call authority. Do we have a high-confidence way to reproduce the issue? Current source establishes the embedded-routing failure for CLI-only consultations; this read-only review ran no target code. Is this the best way to solve the issue? Ordinary agent turns are a suitable repair boundary, but the adapter must preserve the contracts already resolved by the shared consultation owner. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7b981e25b118. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: unit tests only. SecurityNeeds attention: Caller-policy enforcement regresses on the CLI path, and the expanded plugin authority contract needs current-head security approval. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +130, Tests +234, Docs +5. Total +369 across 21 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 3, 2026, 12:22 AM ET / 05:22 UTC. |
|
Closing in favour of #164229, which routes realtime consults through the admitted turn and CLI-candidate owners with the configured fallback chain. That approach should also cover voice-call once it is applied to the shared consult runtime, rather than adding a separate voice-call-only runner here. Related: #188440, #161885. |


Related: #188440 (this fixes the realtime consult path; the classic responder that #188440 reports is unchanged, see Gaps)
What Problem This Solves
Fixes: realtime phone consults fail with
No API key found for provider "anthropic"when the called agent runs on a CLI runtime such asagentRuntime: { id: "claude-cli" }.User Impact
User impact: a realtime Voice Call consult now runs on the agent's configured runtime, including a subscription-backed Claude CLI agent with no provider API key. Each consult is an ordinary turn of the call session, so later consults in the same call keep earlier ones, and the agent's normal tools (for example
sessions_sendto another agent) work undertoolPolicy: "owner". The caller stays a guest: owner-only tools stay refused, andvoice_callstays bound to ending the current call.The classic (non-realtime) phone responder is unchanged and still runs
runEmbeddedAgent; see Gaps.Why This Change Was Made
Realtime consults called
runEmbeddedAgent, which never selects a CLI runtime. Discord voice does not have this problem because it runs a normal agent turn (runCommandFromIngress). Consults now take that same path:consultRealtimeVoiceAgentacceptsrunner: "agent-turn": session preparation (fork, lineage, delivery) is unchanged, and the turn runs throughagentRuntime.runCommandFromIngressas a guest. Voice Call opts in; other consult callers keepembedded.messageChannel, and only as a guest. Owner elevation still requires the exact trusted plugin of the named channel.toolBindingsare accepted only for tools the calling plugin declares incontracts.tools. PublicagentCommandFromIngressstill strips both.toolBindingsinto the MCP loopback grant (they already reached embedded tools), sovoice_callkeeps its active-call binding on the CLI route.sessions_sendfailed with "Requester provenance requires trusted in-process Gateway dispatch."A CLI-dispatch alternative (
cliBackendDispatchon the embedded runner) was considered and rejected: it is a one-shot helper path without session history or the requester's normal tool policy.Evidence
Focused tests (all new tests fail on
origin/mainand pass here):src/talk/agent-consult-runtime.test.ts18/18: agent-turn consult shape (guest,deliver: false, one-shot thinking, bindings), and refusal of embedded tool-context adaptation.src/plugins/registry-runtime.channel-ingress.test.ts32/32: channel-less guest turn admitted; owner claim and foreign channel refused; foreign tool binding refused; bindings snapshotted.src/agents/command/attempt-execution.cli-mcp.test.ts5/5:toolBindingsreach the prepared CLI run.src/agents/cli-runner/{mcp-grant-context,tool-authority}.test.ts: bindings snapshotted into the loopback grant.extensions/voice-call/src/runtime.test.ts23/23: consults run as agent turns (an embedded call throws) inside the service context; a host-forced consult (consultPolicy: "always", called the wayscheduleForcedAgentConsultcalls it) runs as a guest agent turn and its owner's abort cancels the turn.Gateway e2e (real Gateway, real Voice Call plugin with the mock carrier, fixture realtime provider issuing two consults, agent on
anthropic/claude-opus-5-5withagentRuntime: claude-cli, stubclaudethat speaks stream-json and uses the real MCP loopback, second agent on the mock model):ownersafe-read-onlyturnInProcess=2)No API key foundin Gateway logToolSearchonlyToolSearchonlyread, web_fetch, memory_search, memory_get, voice_callvoice_call initiate_callend_callend_callgateway,automationssessions_sendto another agentaccepted; target model received the messageHost-forced consults (
realtime.consultPolicy: "always"; the fixture provider never calls the consult tool and emits two final caller transcripts, soscheduleForcedAgentConsultissues both consults):ownersafe-read-onlysendUserMessageturnInProcess=2)turnInProcess=2)No API key foundin Gateway logread, web_fetch, memory_search, memory_get, voice_callvoice_call initiate_callend_callend_callgateway,automationssessions_sendto another agentaccepted; target model received the messageBefore the service-context commit, the same e2e returned
Requester provenance requires trusted in-process Gateway dispatch.forsessions_send.Regression:
test/e2e/qa-lab/runtime/voice-call-gateway.ts(voice-call-cli-rpc-agent-tool) passes.After rebasing onto
origin/main2e24ab7, the six focused suites above and the fourtsgochecks were rerun and pass.Other checks:
pnpm tsgo:core,pnpm tsgo:extensions,pnpm tsgo:core:test,pnpm tsgo:extensions:test, oxlint on touched files, format check, docs markdown lint,git diff --check.Size against
origin/main: production +240/−105, tests +256/−22. The ingress admission check moved out ofregistry-runtime.tsinto its own module unchanged, with the guest and binding rules added there.Gaps
realtime forced agent consult failed), so the caller hears nothing. Unchanged here.generateVoiceResponse) still usesrunEmbeddedAgent; it relies on pre-compaction early-speech block hooks that the agent-turn API does not expose. Moving it needs a separate change.pnpm test:extension voice-call:manager.async-store.test.ts"checks registered steering admission and effects" (3 cases) fails identically onorigin/maincode on this host; all other files pass.check:line-cap-ratchet/check:test-lines-ratchetneedgit cat-file --batch -z(newer than this host's git 2.34); line growth was checked by hand and no grandfathered file grows.