Repository navigation
chat: support configurable OpenAI BYOK voice mode - #338709
Megan Rogge (meganrogge) wants to merge 9 commits into
Conversation
Keep the OpenAI project key in the Copilot extension host while Voice Mode exchanges WebRTC session descriptions and delegates coding work through the existing agent flow.\n\nFixes #338708\n\nCo-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The global command exposes billable BYOK authority, and several connection, interruption, configuration, and audio-state lifecycle regressions remain.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds OpenAI GPT-Live BYOK voice mode while retaining the hosted backend fallback.
Changes:
- Adds extension-host GPT-Live session creation and secure key handling.
- Adds WebRTC audio, microphone, transcription, and delegation handling.
- Integrates direct audio state with Voice Mode and adds tests.
| File | Description |
|---|---|
voiceSessionController.test.ts |
Updates the voice client mock. |
voiceClientService.test.ts |
Tests GPT-Live transport and delegation. |
common/voiceClientService.ts |
Adds the remote-audio state event. |
voiceSessionController.ts |
Adds BYOK availability and audio-state handling. |
browser/voiceClientService.ts |
Implements GPT-Live WebRTC support. |
micCaptureService.ts |
Exposes the microphone stream and synchronizes mute state. |
gptLiveSession.spec.ts |
Tests session creation and key isolation. |
gptLiveSession.ts |
Creates OpenAI GPT-Live sessions. |
byokContribution.ts |
Registers the GPT-Live bridge command. |
extensions/copilot/package.json |
Adds command-based extension activation. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Move session exchange behind an extension-identity-checked provider bridge, cancel stale connection setup, and honor runtime speech output configuration. Co-authored-by: Copilot <[email protected]>
Mark voice-only BYOK models as non-selectable so they remain manageable without appearing in chat model pickers. Co-authored-by: Copilot <[email protected]>
Use OpenAI BYOK only when the configured key exposes gpt-live-1; otherwise preserve the hosted Voice Mode transport. Co-authored-by: Copilot <[email protected]>
Use an explicit model ID setting to opt into OpenAI BYOK voice sessions, and keep voice-only models out of model management and chat model pickers.\n\nCo-authored-by: Copilot <[email protected]>
Show a provider-aware success notification after a new API key is securely persisted through Models Management.\n\nCo-authored-by: Copilot <[email protected]>
Confirm the configured OpenAI model after GPT-Live connects instead of showing a generic notification when any provider key is added.\n\nCo-authored-by: Copilot <[email protected]>
Read the active OpenAI provider key from its extension-host configuration, notify when the configured live model is available, and preserve the SDP terminator required by OpenAI.\n\nCo-authored-by: Copilot <[email protected]>
Defer GPT-Live session initialization until the voice controller has completed its connected-state setup, so hands-free listening enables the WebRTC microphone track. Guard the deferred initialization so it fires only once per connection.\n\nCo-authored-by: Copilot <[email protected]>
|
Fixed the GPT-Live startup ordering race in c082173. The live session now defers its session-init event until the voice controller finishes connected-state setup, allowing hands-free mode to enable the WebRTC microphone track. Validation:
|
|
Superseded by draft #339150: #339150. The replacement retains this feature and consolidates session ownership, permission/question routing, lifecycle, transport, and playback hardening. Its description includes the Voice Mode speech-behavior table, exact validation results (390 core tests plus 12 provider tests), and remaining live-verification limits. |
* chat: support OpenAI GPT-Live BYOK voice mode Keep the OpenAI project key in the Copilot extension host while Voice Mode exchanges WebRTC session descriptions and delegates coding work through the existing agent flow.\n\nFixes #338708\n\nCo-authored-by: Copilot <[email protected]> * chat: secure GPT-Live BYOK voice sessions Move session exchange behind an extension-identity-checked provider bridge, cancel stale connection setup, and honor runtime speech output configuration. Co-authored-by: Copilot <[email protected]> * chat: list GPT-Live in BYOK model management Mark voice-only BYOK models as non-selectable so they remain manageable without appearing in chat model pickers. Co-authored-by: Copilot <[email protected]> * chat: detect GPT-Live access before voice startup Use OpenAI BYOK only when the configured key exposes gpt-live-1; otherwise preserve the hosted Voice Mode transport. Co-authored-by: Copilot <[email protected]> * chat: configure the BYOK voice model Use an explicit model ID setting to opt into OpenAI BYOK voice sessions, and keep voice-only models out of model management and chat model pickers.\n\nCo-authored-by: Copilot <[email protected]> * chat: confirm BYOK API key addition Show a provider-aware success notification after a new API key is securely persisted through Models Management.\n\nCo-authored-by: Copilot <[email protected]> * chat: surface the active BYOK voice model Confirm the configured OpenAI model after GPT-Live connects instead of showing a generic notification when any provider key is added.\n\nCo-authored-by: Copilot <[email protected]> * chat: fix GPT-Live key and SDP handoff Read the active OpenAI provider key from its extension-host configuration, notify when the configured live model is available, and preserve the SDP terminator required by OpenAI.\n\nCo-authored-by: Copilot <[email protected]> * chat: arm GPT-Live listening after startup Defer GPT-Live session initialization until the voice controller has completed its connected-state setup, so hands-free listening enables the WebRTC microphone track. Guard the deferred initialization so it fires only once per connection.\n\nCo-authored-by: Copilot <[email protected]> * chat: harden BYOK voice session routing and playback Bind voice turns, confirmations, questions, and narration to their owning chat input. Harden cancellation, connection lifetimes, draft promotion, WebRTC playback, and workbench widget routing. Add explicit natural-consent phrases and concise contextual acceptance acknowledgements with focused regression coverage. Refs #338709 and #338708. Co-authored-by: Copilot <[email protected]> * chat: fix voice submission feedback and CI regressions Await composer submission results and distinguish edited input from accepted requests. Allow transient WebRTC recovery and invalidate partial form answers when pending schemas change. Isolate migration coverage from production registrations and apply repository formatting. Co-authored-by: Copilot <[email protected]> * chat: support GPT Live barge-in and session routing Preserve Voice Mode across voice-driven session navigation, route session awareness through authoritative Agents state, and interrupt GPT Live playback when meaningful provider transcripts indicate barge-in. Co-authored-by: Copilot <[email protected]> * chat: harden GPT Live voice startup and routing Keep configured BYOK failures terminal, remove language-specific session intent parsing, and make target changes suppress stale provider output safely. Repair provider and accessibility CI coverage. Co-authored-by: Copilot <[email protected]> * chat: apply voice language to GPT Live Use the configured or automatic Voice Mode language for GPT Live instructions and locale-gated client routing, while removing obsolete session-navigation guidance. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>


Fixes #338708
What changed
agents.voice.useBYOKVoiceModelsetting, whose string value is the OpenAI live model ID Voice Mode should useagents.voice.speakResponsesReviewer notes
The configured live model is intentionally not added to Models Management or chat model pickers. Models Management remains the place to securely add the OpenAI key; the new setting only stores a model ID.
The existing
isClientBYOKAllowedpolicy remains authoritative. The proposed speech-provider bridge retains extension identity so only the configured Copilot Chat extension can use the stored key to create a live session. The extension host returns only the OpenAI session ID and SDP answer, never the API key.Once BYOK has been selected, a live-session failure is surfaced instead of silently switching billing paths. Availability failures before selection continue through the existing hosted MAI backend.
How to test
"agents.voice.useBYOKVoiceModel": "<live-model-id>".agents.voice.speakResponseswhile connected and verify that remote audio follows the setting.Validation
npm run transpile-client— passednpm run typecheck-client— passednpm --prefix extensions/copilot run typecheck— passed./scripts/test.sh --run src/vs/workbench/contrib/chat/test/common/languageModels.test.ts— 68 passed./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/voiceClient/voiceSessionController.test.ts— 157 passedgpt-live-1WebRTC verification — passed in the OSS Agents window; model notice appeared and Voice Mode remained connected