feat(xai): add native streaming TTS#103993
Conversation
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 8:59 AM ET / 12:59 UTC. Summary PR surface: Source +404, Tests +554, Docs +8, Config 0, Other 0. Total +966 across 11 files. Reproducibility: not applicable. This PR adds a new provider capability rather than fixing broken established behavior, and its exact-head live run validates the proposed streaming path. 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. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Authorize the exact-head plugin-local Do we have a high-confidence way to reproduce the issue? Not applicable: this PR adds a new provider capability rather than fixing broken established behavior, and its exact-head live run validates the proposed streaming path. Is this the best way to solve the issue? Yes. The patch reuses the canonical speech-provider streaming seam, keeps xAI-specific protocol logic in the xAI plugin, and confines Discord's MP3 requirement to streaming playback without altering buffered fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a66d2959e956. Label changesLabel justifications:
Evidence reviewedPR surface: Source +404, Tests +554, Docs +8, Config 0, Other 0. Total +966 across 11 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
Review history (3 earlier review cycles)
|
Expose streamSynthesize on the bundled xAI speech provider so Talk and Discord streaming playback can use xAI alongside batch REST synthesis. Adds ws runtime dependency, byte-cap enforcement, and provider tests.
Restrict streaming WS to api.x.ai, decode WebSocket payloads explicitly, refresh idle timeout on audio.delta, add lifecycle/security tests, and document the official xAI streaming contract plus non-realtime-voice scope.
cde93da to
f08d1fd
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready at exact head Repair completed:
Proof:
Hosted CI was explicitly relaxed for this landing; the PR reports no required checks. Known proof gap: no live Discord upload is claimed. Discord production code is unchanged, and its stream-to-buffer path is covered by 131 focused manager e2e tests. |
|
Merged via squash.
|
* feat(xai): add streaming TTS via wss://api.x.ai/v1/tts Expose streamSynthesize on the bundled xAI speech provider so Talk and Discord streaming playback can use xAI alongside batch REST synthesis. Adds ws runtime dependency, byte-cap enforcement, and provider tests. * fix(xai): harden streaming TTS per review feedback Restrict streaming WS to api.x.ai, decode WebSocket payloads explicitly, refresh idle timeout on audio.delta, add lifecycle/security tests, and document the official xAI streaming contract plus non-realtime-voice scope. * fix(xai): bound streaming TTS text deltas * fix(xai): require secure native TTS streaming endpoint * docs(tts): remove duplicate output formats section * fix(xai): preserve surrogate pairs in tts frames * fix(xai): bound streaming TTS websocket payloads * fix(xai): align TTS websocket decoding with ws types * fix(xai): pin native streaming TTS endpoint * test(xai): cover native streaming TTS live path * fix(xai): preserve streaming codec compatibility * style(xai): format streaming endpoint guard * docs(tts): describe xAI streaming output policy [skip ci] * fix(xai): own voice-note TTS format policy [skip ci] * docs(tts): keep provider summary concise [skip ci] * test(xai): use explicit placeholder credentials [skip ci] * test(xai): keep fixtures scanner-safe [skip ci] --------- Co-authored-by: TheAngryPit <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* feat(xai): add streaming TTS via wss://api.x.ai/v1/tts Expose streamSynthesize on the bundled xAI speech provider so Talk and Discord streaming playback can use xAI alongside batch REST synthesis. Adds ws runtime dependency, byte-cap enforcement, and provider tests. * fix(xai): harden streaming TTS per review feedback Restrict streaming WS to api.x.ai, decode WebSocket payloads explicitly, refresh idle timeout on audio.delta, add lifecycle/security tests, and document the official xAI streaming contract plus non-realtime-voice scope. * fix(xai): bound streaming TTS text deltas * fix(xai): require secure native TTS streaming endpoint * docs(tts): remove duplicate output formats section * fix(xai): preserve surrogate pairs in tts frames * fix(xai): bound streaming TTS websocket payloads * fix(xai): align TTS websocket decoding with ws types * fix(xai): pin native streaming TTS endpoint * test(xai): cover native streaming TTS live path * fix(xai): preserve streaming codec compatibility * style(xai): format streaming endpoint guard * docs(tts): describe xAI streaming output policy [skip ci] * fix(xai): own voice-note TTS format policy [skip ci] * docs(tts): keep provider summary concise [skip ci] * test(xai): use explicit placeholder credentials [skip ci] * test(xai): keep fixtures scanner-safe [skip ci] --------- Co-authored-by: TheAngryPit <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Closes #99660 by adding native xAI WebSocket streaming TTS through the existing speech-provider contract. Buffered xAI TTS, voice discovery, authentication, and telephony remain provider-owned.
Why This Change Was Made
wss://api.x.ai/v1/ttsprotocol with orderedtext.delta/text.doneinput andaudio.delta/audio.doneoutput.User Impact
xAI TTS can now stream through registered speech-provider callers. Discord receives portable MP3 voice-note bytes on both the stream and fallback paths; no xAI-specific codec policy remains in Discord. Telephony stays PCM. Audio-file callers keep all supported configured codecs.
Evidence
Exact head:
156879a36e6a449b0290d1c41416800e98f9e55aScope
[email protected]already belongs to the xAI plugin runtime on current main.No API keys, tokens, credentials, private paths, raw prompts, or raw agent logs are included.
Agent Transcript
Sanitized engineering worklog
wsruntime behavior, and current xAI protocol documentation.Strongest safe truth: the exact head is live-proven for native xAI voice discovery, buffered TTS, WebSocket streaming audio, and telephony. It is not claimed as a live Discord upload proof.