feat(xai): stream TTS over native websocket#99883
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 4, 2026, 5:08 AM ET / 09:08 UTC. Summary PR surface: Source +344, Tests +289, Docs +3. Total +636 across 5 files. Reproducibility: not applicable. as a bug reproduction; this is a feature PR. Current-main source inspection confirms xAI lacks Review metrics: none identified. Stored data model 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: Merge only after redacted live xAI streaming TTS proof shows the native WebSocket path producing non-empty audio while preserving existing buffered TTS behavior. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a feature PR. Current-main source inspection confirms xAI lacks Is this the best way to solve the issue? Yes, with a proof gap: the provider-local AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eafe2a8d0bb6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +344, Tests +289, Docs +3. Total +636 across 5 files. View PR surface stats
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
Review history (4 earlier review cycles)
|
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
Closes #99660
What Problem This Solves
Fixes an issue where xAI could be used for buffered OpenClaw TTS, but streaming playback callers could not use xAI's native lower-latency streaming TTS WebSocket contract.
Why This Change Was Made
The xAI speech provider now exposes streamSynthesize through the documented native wss://api.x.ai/v1/tts WebSocket flow while leaving existing buffered synthesize and telephony paths on REST /v1/tts. The streaming path uses the Node runtime WebSocket client with xAI authorization headers, and it is restricted to the native xAI host so REST-compatible proxy base URLs are not silently treated as xAI WebSocket endpoints.
User Impact
Streaming TTS callers can receive xAI audio chunks as they arrive instead of waiting for a complete buffered audio response, while existing normal TTS attachment and telephony behavior remains unchanged.
Evidence
Commands / artifacts:
ode scripts/run-vitest.mjs extensions/xai/tts.test.ts extensions/xai/speech-provider.test.ts passed at current head: 2 files, 21 tests.
ode scripts/run-vitest.mjs src/plugins/contracts/extension-runtime-dependencies.contract.test.ts passed at current head: 1 file, 404 tests.
ode scripts/run-vitest.mjs test/scripts/plugin-package-dependencies.test.ts passed on the preceding head before the dependency-graph-removal commit: 1 file, 3 tests.
ode scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions.tsbuildinfo passed at current head.
ode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/xai/tts.ts passed after the lint follow-up; current-head sgo and dependency-contract proof also cover the final no-ws runtime-import shape.
ode_modules is a junction to the main checkout and pnpm tries to remove it without a TTY; current-head diff no longer includes dependency manifest or lockfile changes, and the focused plugin runtime dependency contract passed.