feat(xai): add realtime voice provider#91308
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 30, 2026, 3:36 PM ET / 19:36 UTC. Summary PR surface: Source +953, Tests +406, Docs +59, Config 0, Other 0. Total +1418 across 9 files. Reproducibility: not applicable. as a bug reproduction; this is a feature PR. The source-level check is high-confidence: current main lacks xAI realtime voice registration, while the PR head adds a relay-only provider. Review metrics: 3 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land a conflict-free xAI-owned Gateway-relay realtime voice provider through the existing Talk provider seams after exact-head relay proof and dependency approval, keeping browser/provider-WebSocket claims out unless reintroduced in code. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a feature PR. The source-level check is high-confidence: current main lacks xAI realtime voice registration, while the PR head adds a relay-only provider. Is this the best way to solve the issue? Yes on owner boundary, but not merge-ready yet. An xAI-owned AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5a89484eb31d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +953, Tests +406, Docs +59, Config 0, Other 0. Total +1418 across 9 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
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. How this review workflow works
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c40af38057
ℹ️ 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".
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes are blockedOpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph. Detected dependency graph changes:
Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:
Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed. To remove lockfile changes, restore them from the target branch: git fetch origin
git checkout 'origin/main' -- 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git pushIf this PR intentionally needs a dependency graph change, ask a repository admin or member of The action will approve the current head SHA ( |
|
@clawsweeper re-review Updated in
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Retrying because the previous targeted re-review run was cancelled during No additional code changes since the prior request. The PR body now includes the redacted live xAI Realtime proof and the review blockers are fixed in |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Dependency-guard evidence for maintainers at head Ran: node scripts/dependency-changes-report.mjs --base-ref upstream/main --markdown /tmp/openclaw-pr-91308-dependency-changes.md --json /tmp/openclaw-pr-91308-dependency-changes.jsonResult:
Intent: this is the review-requested move of existing The dependency-guard check still needs repo admin or |
…solution # Conflicts: # docs/.generated/plugin-sdk-api-baseline.sha256 # docs/web/control-ui.md
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Superseded by #106267 and landed in The canonical implementation uses the existing Talk gateway-relay contract, keeps provider policy inside the xAI plugin, and includes tested audio, tools, server-VAD barge-in, playback truncation, reconnect, and optional resumption. Exact-head release gate 29248320992 passed all 117 jobs; authenticated xAI live proof also passed. Closing this stale duplicate. Thank you, @jsi-tross, for the implementation exploration and live protocol proof. |
Summary
provider-websocketandgateway-relaytransports./v1/realtime/client_secretstoken and the browser connects towss://api.x.ai/v1/realtimewith thexai-client-secret.<token>WebSocket subprotocol.grok-voice-latestand voiceleo, and map cumulative inboundconversation.item.input_audio_transcription.updatedevents into Talk transcript updates for meeting/transcription surfaces.openclaw_agent_consultpath, including xAI bridge tool-result continuation for relay sessions.wsinto the xAI plugin runtime dependencies so installed plugin packages can load the realtime provider.Review follow-up
Fixed ClawSweeper baseUrl follow-up: xAI browser
provider-websocketsessions now reject custom/proxybaseUrlvalues before minting a client secret, and docs scope custombaseUrltogateway-relay.Fixed Codex review comment:
wsnow lives inextensions/xai/package.jsondependencies, andpnpm-lock.yamlwas refreshed.Fixed ClawSweeper blocker:
XaiRealtimeVoiceBridgenow advertisessupportsToolResultContinuation, with provider coverage plus existing relay working-result coverage.Added redacted live xAI Realtime proof for client-secret creation, WebSocket session setup, audio input, inbound transcript updates, function/tool call, tool output, and assistant audio output.
Real behavior proof
provider-websocketsessions using xAI ephemeral client secrets and Gateway relay still available for backend-owned sessions.522aa6fcb8on macOS with a keychain-backed xAI credential, plus the live xAI Realtime API atwss://api.x.ai/v1/realtime?model=grok-voice-latest.xai-client-secret.<token>subprotocol, streamed synthesized PCM16/24 kHz speech, committed the audio buffer, captured transcript events and a function call, submitted a function output, and received assistant audio. Also ran an isolated source Gateway on port19089and calledtalk.catalogagainst it.clientSecretCreated: true,websocketConnected: true,sessionUpdated: true,transcriptUpdated: true,transcriptCompleted: true,toolCallReceived: true,toolCallName: "openclaw_agent_consult",toolResultSent: true,assistantAudioDeltas: 4, anderrors: []. The Gateway catalog excerpt below shows xAI configured withsupportsBrowserSession: true,defaultModel: "grok-voice-latest", and transports["provider-websocket", "gateway-relay"].questionargument, accepted the tool output, and returned assistant audio. The source Gateway exposed the updated xAI realtime provider contract throughtalk.catalog.wsruntime dependency move for this head SHA.Live xAI Realtime session
Ran a one-off local proof harness using a keychain-backed xAI credential. The harness:
wss://api.x.ai/v1/realtime?model=grok-voice-latestwith thexai-client-secret.<token>subprotocol.session.updatewithvoice: "leo", PCM16 24 kHz input/output,audio.input.transcription.model: "grok-transcribe", and anopenclaw_agent_consultfunction tool.input_audio_buffer.append, committed the buffer, and requested a response.openclaw_agent_consultfunction call, sent a function output, and received assistant audio.Sanitized output:
{ "model": "grok-voice-latest", "voice": "leo", "clientSecretCreated": true, "websocketConnected": true, "sessionUpdated": true, "inputAudioBytes": 255216, "inputAudioChunks": 54, "inputCommitted": true, "transcriptUpdated": true, "transcriptCompleted": true, "transcriptSample": "Please call the OpenClaw agent consult tool and say real time proof complete.", "toolCallReceived": true, "toolCallName": "openclaw_agent_consult", "toolCallArgsKeys": ["question"], "toolResultSent": true, "assistantAudioDeltas": 4, "assistantAudioBytes": 72480, "responseDoneCount": 1, "errors": [] }Observed xAI event set included:
Source Gateway catalog proof
Ran the committed branch as an isolated source Gateway with
XAI_API_KEYsupplied from keychain:Startup proof:
talk.catalogrelevant response excerpt:{ "id": "xai", "label": "xAI Grok Voice", "configured": true, "modes": ["realtime"], "brains": ["agent-consult"], "supportsBrowserSession": true, "defaultModel": "grok-voice-latest", "transports": ["provider-websocket", "gateway-relay"], "inputAudioFormats": [ { "encoding": "g711_ulaw", "sampleRateHz": 8000, "channels": 1 }, { "encoding": "pcm16", "sampleRateHz": 24000, "channels": 1 } ], "outputAudioFormats": [ { "encoding": "g711_ulaw", "sampleRateHz": 8000, "channels": 1 }, { "encoding": "pcm16", "sampleRateHz": 24000, "channels": 1 } ], "supportsBargeIn": true, "supportsToolCalls": true }The temporary Gateway was stopped cleanly after the proof.
Verification
/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/run-vitest.mjs extensions/xai/realtime-voice-provider.test.ts src/gateway/talk-realtime-relay.test.ts/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/run-vitest.mjs ui/src/ui/realtime-talk-xai.test.ts ui/src/ui/realtime-talk-google-live.test.ts/opt/homebrew/Cellar/node/24.4.1/bin/node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.contracts-plugin.config.ts src/plugins/contracts/extension-runtime-dependencies.contract.test.ts/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions.tsbuildinfo/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfo/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.ui.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-ui.tsbuildinfo/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/xai/index.ts extensions/xai/realtime-voice-provider.ts extensions/xai/realtime-voice-provider.test.ts ui/src/ui/chat/realtime-talk.ts ui/src/ui/chat/realtime-talk-xai.ts ui/src/ui/realtime-talk-xai.test.tsnode_modules/.bin/oxfmt --check --threads=1 ui/src/ui/chat/realtime-talk.ts ui/src/ui/chat/realtime-talk-xai.ts ui/src/ui/realtime-talk-xai.test.ts extensions/xai/realtime-voice-provider.ts extensions/xai/realtime-voice-provider.test.ts/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/format-docs.mjs --checkgit diff --cached --check/opt/homebrew/Cellar/node/24.4.1/bin/node scripts/run-vitest.mjs extensions/xai/realtime-voice-provider.test.ts ui/src/ui/realtime-talk-xai.test.tsnode scripts/dependency-changes-report.mjs --base-ref upstream/main --markdown /tmp/openclaw-pr-91308-dependency-changes-latest.md --json /tmp/openclaw-pr-91308-dependency-changes-latest.json