Skip to content

chat: support configurable OpenAI BYOK voice mode - #338709

Closed
Megan Rogge (meganrogge) wants to merge 9 commits into
mainfrom
agents/enable-byok-gpt-live-voice-mode
Closed

Megan Rogge (meganrogge) wants to merge 9 commits into
mainfrom
agents/enable-byok-gpt-live-voice-mode

Conversation

@meganrogge

@meganrogge Megan Rogge (meganrogge) commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #338708

What changed

  • add the experimental agents.voice.useBYOKVoiceModel setting, whose string value is the OpenAI live model ID Voice Mode should use
  • keep OpenAI API-key entry in Models Management and confirm the configured model when a GPT-Live session connects
  • use OpenAI GPT-Live over WebRTC only when client BYOK is allowed, an OpenAI key exists, and that key can access the configured model
  • read the active OpenAI provider configuration only inside the Copilot extension host and preserve the complete SDP offer during session exchange
  • preserve the hosted MAI Voice Mode backend when the setting is empty, the key is missing, or the configured model is unavailable
  • keep the API key in the built-in Copilot extension host and exchange only the SDP offer/answer with the workbench
  • route GPT-Live client delegations through the existing VS Code/Copilot coding-agent flow
  • synchronize direct WebRTC audio and microphone state with the existing Voice Mode UI, push-to-talk lifecycle, and agents.voice.speakResponses

Reviewer 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 isClientBYOKAllowed policy 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

  1. Open Models Management, choose Add Provider → OpenAI, and enter an OpenAI project API key.
  2. Set "agents.voice.useBYOKVoiceModel": "<live-model-id>".
  3. Start Voice Mode. With access to that model, verify that VS Code confirms it is using the model from the OpenAI provider, then verify that speech input, remote audio, and coding-agent delegation work.
  4. Clear the setting or use a model ID that the key cannot access. Verify that Voice Mode uses the existing hosted backend.
  5. Toggle agents.voice.speakResponses while connected and verify that remote audio follows the setting.

Validation

  • npm run transpile-client — passed
  • npm run typecheck-client — passed
  • npm --prefix extensions/copilot run typecheck — passed
  • targeted core and Copilot extension ESLint — 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 passed
  • targeted GPT-Live/OpenAI provider tests — 8 passed
  • targeted Voice Mode unit tests — 199 passed
  • real OpenAI gpt-live-1 WebRTC verification — passed in the OSS Agents window; model notice appeared and Voice Mode remained connected

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]>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 16:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 2 Medium severity

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]>
@meganrogge Megan Rogge (meganrogge) added this to the 1.141.0 milestone Sep 29, 2026
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]>
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: a0463a4f Current: 1a27cf4c

Changed (1)

chat/aiCustomizations/aiCustomizationManagementEditor/DiscoverPluginsLoadingMore/Light
Before After
before after

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

@meganrogge Megan Rogge (meganrogge) changed the title chat: support OpenAI GPT-Live BYOK voice mode chat: support configurable OpenAI BYOK voice mode Sep 30, 2026
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]>
@meganrogge

Copy link
Copy Markdown
Collaborator Author

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:

  • npm run transpile-client — passed
  • ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/voiceClient/voiceClientService.test.ts — 44 passed
  • ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/voiceClient/voiceSessionController.test.ts — 157 passed
  • Targeted ESLint — passed
  • Live OpenAI GPT-Live verification — session started, input audio unmuted, and input transcript deltas received

@meganrogge

Copy link
Copy Markdown
Collaborator Author

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.

@vs-code-engineering vs-code-engineering Bot added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Oct 1, 2026
Megan Rogge (meganrogge) added a commit that referenced this pull request Oct 15, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

*question Issue represents a question, should be posted to StackOverflow (VS Code)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support OpenAI GPT-Live BYOK in Voice Mode

2 participants