Repository navigation
[AI-assisted] Improve active-run control in realtime voice calls - #84231
Conversation
|
Codex review: needs real behavior proof before merge. Latest ClawSweeper review: 2026-05-24 00:20 UTC / May 23, 2026, 8:20 PM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
PR Surface View PR surface stats
Summary Reproducibility: yes. for the review finding: source inspection of the PR head shows the exported args type now requires PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. Real behavior proof Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Keep the single consult-tool direction, but make Do we have a high-confidence way to reproduce the issue? Yes for the review finding: source inspection of the PR head shows the exported args type now requires Is this the best way to solve the issue? No, not yet. Reusing the existing consult tool is plausible, but the public SDK contract should stay compatible and current-head voice behavior proof needs to be refreshed before merge. Label changes:
Label justifications:
Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against fa39bef3893d. |
There was a problem hiding this comment.
Pull request overview
This PR adds a unified “active-run control” path for realtime voice calls so callers can request status, cancel, steer, or queue follow-ups while an embedded tool-backed run is still active (across browser-owned realtime, gateway relay, and Discord VC).
Changes:
- Add new gateway methods (
talk.client.steer,talk.session.steer) plus protocol schemas/tests for structured control results. - Introduce shared run-control logic (
src/talk/agent-run-control*) and wire it into browser realtime transports, gateway relay, and Discord voice flows. - Add focused tests across UI transports, gateway relay, protocol validation, and Discord VC.
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui/src/ui/realtime-talk-webrtc.test.ts | Adds WebRTC transport coverage for active-run control speech/interrupt behavior and control tool calls. |
| ui/src/ui/realtime-talk-google-live.test.ts | Adds Google Live transport coverage for active-run control speech/interrupt behavior. |
| ui/src/ui/realtime-talk-gateway-relay.test.ts | Ensures relay tool results are treated as terminal for consult calls (prevents double tool results). |
| ui/src/ui/realtime-talk-consult.test.ts | Adds tests for emitting tool progress, abort result submission, and steering routing/speech behavior. |
| ui/src/ui/chat/realtime-talk-webrtc.ts | Adds auto-control detection + control speech injection and response-create deferral logic for OpenAI WebRTC. |
| ui/src/ui/chat/realtime-talk-shared.ts | Adds shared browser helpers for steering/control tool handling + emits tool progress from chat tool events. |
| ui/src/ui/chat/realtime-talk-shared.browser-import.test.ts | Guards that browser bundle imports shared run-control helpers (not heavier runtime). |
| ui/src/ui/chat/realtime-talk-google-live.ts | Adds auto-control detection + control speech injection and control tool handling for Google Live. |
| ui/src/ui/chat/realtime-talk-gateway-relay.ts | Tracks consult calls by callId; treats server toolResult as terminal and prevents double submitToolResult. |
| src/talk/agent-run-control.ts | Implements core active-run control (status/cancel/steer/followup) against embedded runs + re-exports shared helpers. |
| src/talk/agent-run-control.test.ts | Adds unit tests for classification, tool arg parsing, status sources, cancel/steer/followup outcomes. |
| src/talk/agent-run-control-shared.ts | Adds shared classification, tool schema, status formatting, and result builders for run control. |
| src/talk/agent-consult-tool.ts | Exposes the new control tool alongside the consult tool under non-none policies. |
| src/talk/agent-consult-tool.test.ts | Updates tool policy tests to include the control tool. |
| src/talk/agent-consult-runtime.test.ts | Updates runtime tool exposure tests to include the control tool. |
| src/plugin-sdk/realtime-voice.ts | Exports run-control APIs/types via plugin SDK. |
| src/gateway/talk-realtime-relay.ts | Adds relay-side steering path, tracks active tool calls, broadcasts toolProgress, and submits provider cancel results. |
| src/gateway/talk-realtime-relay.test.ts | Adds tests for linked run clearing, steering progress emission, and cancel provider result submission. |
| src/gateway/server-methods/talk.test.ts | Adds handler tests for talk.client.steer and talk.session.steer routing/validation. |
| src/gateway/server-methods/talk-shared.ts | Updates default realtime instructions to reference the new control tool and steer endpoints. |
| src/gateway/server-methods/talk-session.ts | Adds talk.session.steer and includes control tool when creating realtime sessions. |
| src/gateway/server-methods/talk-client.ts | Adds talk.client.steer and includes control tool for client-owned realtime sessions. |
| src/gateway/server-methods-list.test.ts | Ensures new methods appear in the method listing. |
| src/gateway/protocol/schema/types.ts | Adds exported schema types for steer params and agent control result. |
| src/gateway/protocol/schema/protocol-schemas.ts | Registers new steer params and control result schemas. |
| src/gateway/protocol/schema/channels.ts | Defines steer params schemas and the structured control result schema. |
| src/gateway/protocol/index.ts | Adds validators/exports for steer params and agent control result. |
| src/gateway/protocol/index.test.ts | Adds validation tests for steer params and structured control results. |
| src/gateway/methods/core-descriptors.ts | Registers new gateway methods for scope resolution. |
| src/gateway/method-scopes.test.ts | Adds scope tests for the new methods. |
| extensions/discord/src/voice/segment.ts | Routes STT/TTS voice segments through active-run control before starting a new agent turn. |
| extensions/discord/src/voice/realtime.ts | Adds realtime VC active-run control tool handling, transcript routing, and duplicate control speech suppression. |
| extensions/discord/src/voice/manager.e2e.test.ts | Adds e2e coverage for Discord VC active-run control + consult preamble interruption. |
| extensions/discord/src/voice/agent-control.ts | Introduces shared Discord helper for deciding whether to handle a transcript as active-run control. |
| docs/web/control-ui.md | Documents steer endpoints for realtime Talk control. |
| docs/plugins/sdk-migration.md | Documents new steer endpoint and plugin-sdk realtime-voice capability update. |
| docs/nodes/talk.md | Documents steer semantics and structured rejections. |
| docs/gateway/protocol.md | Documents talk.session.steer and talk.client.steer. |
| docs/channels/discord.md | Documents Discord VC transcript classification for status/cancel/steer/followup while a run is active. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa0eac8309
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cfec255 to
2288fdb
Compare
Co-authored-by: Colin <[email protected]>
Co-authored-by: Colin <[email protected]>
Co-authored-by: Colin <[email protected]>
Co-authored-by: Colin <[email protected]>
Co-authored-by: Colin <[email protected]>
a8fd939 to
1c3f666
Compare
|
Verification for maintainer merge: Behavior addressed: realtime Talk/WebUI/Discord voice callers can ask for active OpenClaw run status, cancel an active run, steer it, or queue follow-up work while the consult is still running. Gateway relay cancellation now avoids synthetic forced-consult provider submits and ignores stale duplicate native final submits.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c3f666a18
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .catch((error: unknown) => { | ||
| emit( | ||
| { relaySessionId, type: "error", message: formatError(error) }, | ||
| { | ||
| type: "session.error", |
There was a problem hiding this comment.
Forward transcript when relay steering call fails
When auto-control intercepts a user transcript, this branch always returns, so a failure in steerTalkRealtimeRelayAgentRun(...) drops the utterance entirely. In the .catch(...) path we only emit a session.error event and never fall back to bridge.sendUserMessage(question), which means transient steering errors (RPC failure, runtime rejection, etc.) can cause user speech to be swallowed instead of handled normally.
Useful? React with 👍 / 👎.
Summary
This PR improves realtime voice calls while an embedded OpenClaw consult/tool-backed run is active.
talk.client.steerandtalk.session.steergateway methods that resolve the active realtime session and queue steering text into the active embedded runReal behavior proof
Behavior addressed: Active realtime voice calls can ask for status, cancel, steer, or queue follow-up work while an OpenClaw consult/tool-backed run is active, instead of leaving the caller with no way to influence work that is already running.
Real environment tested: Local OpenClaw dev gateway on macOS with the
aidenagent, OpenAI realtime provider, WebUI realtime voice, and Discord VC. The hard log evidence below comes from the gateway file log at/tmp/openclaw/openclaw-2026-05-19.log, redacted for user/channel ids and local paths.Exact steps or command run after this patch:
gpt-realtime-2bidi voice with consult policy enabled, started a tool-backed consult, then tested steer, status, and cancel while the consult was active.node scripts/run-vitest.mjs src/talk/agent-run-control.test.ts src/gateway/protocol/index.test.ts ui/src/ui/chat/realtime-talk-shared.browser-import.test.ts extensions/discord/src/voice/manager.e2e.test.ts ui/src/ui/realtime-talk-consult.test.ts ui/src/ui/realtime-talk-webrtc.test.ts ui/src/ui/realtime-talk-google-live.test.ts ui/src/ui/realtime-talk-gateway-relay.test.ts src/gateway/talk-realtime-relay.test.tsgit diff --checkEvidence after fix:
2026-05-19T09:17:36.345-04:00 res ok talk.client.create 1098ms2026-05-19T09:23:15.903-04:00 res ok talk.client.toolCall 71ms2026-05-19T09:23:55.788-04:00 res ok talk.client.toolCall 53ms2026-05-19T11:41:39.071-04:00 discord voice: realtime bridge starting mode=bidi provider=openai model=gpt-realtime-2 voice=cedar consultPolicy=always toolPolicy=owner autoRespond=true interruptResponse=true bargeIn=true2026-05-19T11:42:13.392-04:00 discord voice: realtime consult requested call=<redacted> voiceSession=agent:aiden:discord:channel:<redacted> supervisorSession=agent:aiden:discord:channel:<redacted> agent=aiden question=Look into the OpenClaw changes ...2026-05-19T11:42:25.260-04:00 discord voice: realtime active-run control handled mode=steer ok=true active=true reason=none ...2026-05-19T11:42:32.491-04:00 discord voice: realtime active-run control handled mode=status ok=true active=true reason=none ...2026-05-19T11:42:41.008-04:00 discord voice: realtime active-run control handled mode=cancel ok=true active=true reason=none ...2026-05-19T11:42:41.336-04:00 discord voice: realtime consult answer (0 chars) ...2026-05-19T11:42:41.819-04:00 discord voice: realtime assistant transcript (34 chars): Cancelled the active OpenClaw run.2026-05-19T11:42:44.405-04:00 discord voice: realtime assistant transcript (71 chars): All set. The run’s cancelled and nothing else is in progress right now.2026-05-19T11:26:20.798-04:00 discord voice: realtime consult requested call=<redacted> ...2026-05-19T11:26:25.776-04:00 discord voice: realtime active-run control handled mode=cancel ok=true active=true reason=none ...2026-05-19T11:26:25.856-04:00 discord voice: realtime model interrupt confirmed server:response.done status=cancelled {"type":"cancelled","reason":"client_cancelled"}2026-05-19T11:26:26.083-04:00 discord voice: realtime consult answer (0 chars) ...2026-05-19T11:26:27.015-04:00 discord voice: realtime assistant transcript (34 chars): Cancelled the active OpenClaw run.active-run control handled mode=steer ok=true active=true: 7active-run control handled mode=status ok=true active=true: 3active-run control handled mode=cancel ok=true active=true: 4model interrupt confirmed server:response.done status=cancelled: 16consult answer (0 chars): 4Cancelled the active OpenClaw run: 4Observed result after fix: Discord VC logs show a real active consult accepted steer/status/cancel control while active, cancel interrupted the realtime provider response, the consult returned no stale answer after cancel, and the caller received spoken cancellation/idle acknowledgements. WebUI client-owned transports are covered by focused tests and local manual testing, but the gateway file log only proves session/tool-call RPC activity for that path.
What was not tested: A full
pnpm build, fullpnpm check, and full test suite were not run in this session. No fresh live WebUI/Discord VC run was repeated after the final branch cleanup; the PR uses the live log evidence captured during branch testing plus focused automated tests on the final clean branch.Verification
node scripts/run-vitest.mjs src/talk/agent-consult-tool.test.ts src/talk/agent-run-control.test.ts src/gateway/protocol/index.test.ts src/gateway/talk-realtime-relay.test.ts src/gateway/server-methods/talk.test.ts ui/src/ui/realtime-talk-consult.test.ts ui/src/ui/realtime-talk-webrtc.test.ts ui/src/ui/realtime-talk-google-live.test.ts ui/src/ui/realtime-talk-gateway-relay.test.ts extensions/discord/src/voice/manager.e2e.test.ts extensions/google-meet/src/voice-call-gateway.test.ts extensions/voice-call/src/runtime.test.ts extensions/voice-call/src/webhook/realtime-handler.test.tsgit diff --check