Skip to content

chat: enable OpenAI BYOK Voice Mode - #339150

Merged
Megan Rogge (meganrogge) merged 19 commits into
mainfrom
agents/pr-338709-review-fixes
Oct 15, 2026
Merged

Megan Rogge (meganrogge) merged 19 commits into
mainfrom
agents/pr-338709-review-fixes

Conversation

@meganrogge

@meganrogge Megan Rogge (meganrogge) commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #338708. Supersedes #338709.

Summary

Adds OpenAI GPT Live as a BYOK Voice Mode provider over WebRTC and hardens the full voice lifecycle across regular workbench chat and the Agents window:

  • Uses the configured OpenAI provider credentials and selected GPT Live model through the proposed speech provider API.
  • Keeps voice input bound to the chat input/session that owned the turn, including welcome-composer materialization and manual target changes.
  • Supports provider-authoritative barge-in: meaningful recognized speech interrupts active output; bracket-only ASR annotations do not.
  • Routes coding requests through the normal chat submission path and routes current approvals/question forms to their exact session, request, pending occurrence, and schema.
  • Keeps explicitly configured BYOK failures terminal and user-visible. It never silently changes the provider or billing path to hosted Voice Mode.
  • Handles cancellation, stale connection attempts, WebRTC lifecycle, audio muting/autoplay fallback, speaking state, and accessibility help.

Expected GPT Live Voice Mode behavior

Scenario Expected behavior
Start Voice Mode with a configured, available GPT Live model Connect directly to OpenAI over WebRTC and show which configured model/provider is in use.
No BYOK voice model is configured Use the existing hosted Voice Mode eligibility and connection path.
A configured model is unavailable, the API key is rejected, or provider validation fails Stop startup and show a sanitized error. Do not fall back to hosted Voice Mode. Clear agents.voice.useBYOKVoiceModel to opt back into hosted Voice Mode.
Speak a coding request Submit the transcript to the chat input that owned the turn. A short model-generated acknowledgement may be spoken after successful submission; this means accepted, not completed.
The agent completes or provides enabled progress Narrate the owning chat's response/progress without borrowing another chat's voice connection.
Barge in while GPT Live is speaking Meaningful recognized speech stops/suppresses current output and begins the new input turn. ASR annotations such as [mouth noise] alone do not interrupt playback.
Manually focus or create another chat/session while GPT Live remains active Preserve Voice Mode, suppress output associated with the old target, and resume output only after meaningful input captured for the new target. A reconnect clears this suppression state.
The active prompt is an approval Accept only a complete, unqualified supported reply for the current pending occurrence. Apply it through the normal confirmation path, then acknowledge only after successful application.
The active prompt is a question/form Match exact displayed option labels or numeric choices, accumulate multi-question answers, and submit only when the current schema is complete.
The prompt changes, resolves, or moves while speech is in flight Reject the stale answer and ask the user to answer the current prompt.
Spoken responses are disabled Keep remote output muted while preserving the voice connection and input behavior.
agents.voice.language is explicitly configured Canonicalize that supported language, use it for locale-gated client parsing, and instruct GPT Live to speak and interpret speech in that language when possible.
agents.voice.language is auto Resolve from the browser/VS Code display locale and provide that language to the GPT Live instructions and local routing safeguards.

Deliberately unsupported or out-of-scope behavior

  • Voice transcripts do not navigate between sessions. Phrases such as “switch to the chocolate session” are preserved and submitted as ordinary chat requests; Voice Mode does not invoke focus_session or silently move focus.
  • Voice transcripts do not receive special session-awareness routing. Questions such as “which session am I in?” or “how many sessions do I have?” are ordinary chat requests, not client-side get_session_info calls.
  • There is no free-form multilingual intent grammar. The client does not attempt to translate or infer navigation, approval, rejection, skipping, custom-answer, or conjunction keywords across languages.
  • GPT Live language configuration is an instruction, not a hard transcription-language guarantee. The proposed live-session API currently exposes no dedicated transcription-language field, so OpenAI remains responsible for speech-language recognition and may automatically detect the input language.
  • Model wording is not guaranteed verbatim. Acknowledgements and narration remain model-generated within the supplied instructions.
  • Request acceptance is not task completion. Voice Mode must not say or imply that coding work is finished merely because the request was submitted.
  • Background chats do not speak through the active connection.

Language and safety boundaries

  • English approval phrases are recognized only when the session display locale is English: approve, approved, accept, accepted, allow, yes, I approve, and I accept; rejection uses reject, deny, and no.
  • The session display locale used by these safeguards comes from the canonicalized agents.voice.language setting, or from the browser/VS Code display locale when the setting is auto.
  • Qualified, tentative, negated, duplicate, or stale consent never authorizes an action.
  • For every locale, displayed option labels are matched exactly and ASCII numeric positions such as 1 or 2 are supported.
  • English number words, ordinals, option N, and, other, and skip are enabled only for English locales.
  • Unsupported-language approvals are directed to the chat input rather than guessed.

How to test

  1. Configure an OpenAI provider/API key in Models Management, select its GPT Live voice model, and start Voice Mode.
  2. In both a regular chat editor/sidebar and the Agents window, submit a coding request and verify the owning chat receives it.
  3. Interrupt active output with meaningful speech and verify playback stops; verify bracket-only annotations do not trigger interruption.
  4. Manually switch to or create another chat/session while Voice Mode is active. Verify stale output stays muted and a new spoken request targets the newly focused input.
  5. Say a session-navigation or session-awareness phrase and verify it is submitted as ordinary chat text rather than moving focus or invoking a session-info tool.
  6. Exercise current approvals with supported complete English phrases, then try qualified consent, a non-English approval, a stale prompt, and a duplicate reply.
  7. Exercise exact localized option labels, numeric choices, sequential forms, allowed/forbidden skipping, and custom answers.
  8. Configure an invalid/unavailable BYOK model and verify startup ends with a sanitized error and never opens the hosted connection.
  9. Clear the BYOK voice-model setting and verify the existing hosted Voice Mode path remains available.

Validation

Current head was merged with the latest main, rebuilt, and validated locally:

  • npm run build-fast -- --client-only — passed.
  • ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/common/voiceClient/voiceLiveInputRouter.test.ts --run src/vs/workbench/contrib/chat/test/browser/voiceClient/voiceClientService.test.ts --run src/vs/workbench/contrib/chat/test/browser/voiceClient/voiceSessionController.test.ts --run src/vs/sessions/test/browser/parts/panelPart.test.ts — 284 passed.
  • npm --prefix extensions/copilot run test:unit -- src/extension/byok/vscode-node/test/gptLiveSession.spec.ts src/extension/byok/vscode-node/test/byokContribution.spec.ts — 14 passed.
  • npm --prefix extensions/copilot run typecheck — passed.
  • npm --prefix extensions/copilot run compile — passed.
  • npm run typecheck-client — passed.
  • npm run eslint -- <all 12 modified TypeScript files> — passed with no errors or warnings.
  • git diff --check — passed.
  • Locale follow-up: npm run build-fast -- --client-only plus the focused VoiceClientService and VoiceLiveInputRouter tests — 96 passed; targeted ESLint, client typecheck, and diff checks also passed.
  • CI follow-up: repository formatting verification, targeted ESLint, an incremental client build, and all 20 VoiceLiveInputRouter tests passed after the formatting and CodeQL cleanups.

Total focused tests in the final local run: 298 passed, 0 failed.

The full GitHub Actions matrix for commit b5e086fb94d is currently running. Cross-platform CI and live microphone/provider behavior remain the authoritative validation for platform audio, external ASR accuracy, and model adherence.

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]>
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]>
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]>
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 044c74e4 Current: b9358ce2

Changed (1)

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

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

Submission acknowledgements, schema changes, and WebRTC/audio transitions still have correctness issues.

Review effort: Balanced
Findings: 5 Medium severity

Open (5)
What changed in this PR

Adds OpenAI BYOK GPT-Live Voice Mode with extension-host credential isolation, deterministic chat routing, audio lifecycle handling, accessibility guidance, and regression coverage.

Changes:

  • Adds the proposed live-session speech API and OpenAI session provider.
  • Hardens session ownership, approvals, questions, playback, and cancellation.
  • Expands Agents-window/workbench support and tests.
File Description
src/​vscode-dts/​vscode.proposed.speech.d.ts Adds live-session API.
src/​vs/​workbench/​contrib/​speech/​test/​browser/​voiceLiveSession.test.ts Tests provider isolation.
src/​vs/​workbench/​contrib/​speech/​common/​speechService.ts Defines live-session contracts.
src/​vs/​workbench/​contrib/​speech/​browser/​speechService.ts Implements provider registration.
src/​vs/​workbench/​contrib/​chat/​test/​common/​voiceClient/​voiceQuestionAnswers.test.ts Tests malformed answers.
src/​vs/​workbench/​contrib/​chat/​test/​common/​voiceClient/​voiceLiveInputRouter.test.ts Tests deterministic routing.
src/​vs/​workbench/​contrib/​chat/​test/​common/​voiceChatService.test.ts Updates speech mock.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​voiceClient/​voiceToolDispatchService.test.ts Tests exact prompt dispatch.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​voiceClient/​voiceSessionController.test.ts Expands lifecycle coverage.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​voiceClient/​voiceInputUtils.test.ts Tests widget submission.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​voiceClient/​micCaptureService.test.ts Tests microphone state.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​accessibility/​chatAccessibilityHelp.test.ts Tests help content.
src/​vs/​workbench/​contrib/​chat/​common/​voiceClient/​voiceQuestionAnswers.ts Validates wire answers.
src/​vs/​workbench/​contrib/​chat/​common/​voiceClient/​voiceLiveInputRouter.ts Routes direct-provider input.
src/​vs/​workbench/​contrib/​chat/​common/​voiceClient/​voiceClientService.ts Extends voice contracts.
src/​vs/​workbench/​contrib/​chat/​browser/​widgetHosts/​viewPane/​chatViewPane.ts Routes submissions by widget.
src/​vs/​workbench/​contrib/​chat/​browser/​voiceClient/​voiceToolDispatchService.ts Hardens prompt responses.
src/​vs/​workbench/​contrib/​chat/​browser/​voiceClient/​voiceSessionController.ts Coordinates BYOK lifecycle.
src/​vs/​workbench/​contrib/​chat/​browser/​voiceClient/​voiceInputUtils.ts Centralizes voice submission.
src/​vs/​workbench/​contrib/​chat/​browser/​voiceClient/​voiceClientService.ts Implements GPT-Live WebRTC.
src/​vs/​workbench/​contrib/​chat/​browser/​voiceClient/​micCaptureService.ts Synchronizes microphone tracks.
src/​vs/​workbench/​contrib/​chat/​browser/​actions/​chatAccessibilityHelp.ts Documents BYOK interaction.
src/​vs/​workbench/​contrib/​agentsVoice/​test/​browser/​voiceModeOnboarding.test.ts Tests BYOK enablement.
src/​vs/​workbench/​contrib/​agentsVoice/​test/​browser/​voiceModeActions.test.ts Tests input ownership.
src/​vs/​workbench/​contrib/​agentsVoice/​common/​agentsVoice.ts Adds BYOK setting gate.
src/​vs/​workbench/​contrib/​agentsVoice/​browser/​agentsVoice.contribution.ts Registers setting and routing.
src/​vs/​workbench/​api/​common/​extHostSpeech.ts Bridges extension providers.
src/​vs/​workbench/​api/​common/​extHost.protocol.ts Adds speech RPC methods.
src/​vs/​workbench/​api/​common/​extHost.api.impl.ts Exposes proposed API.
src/​vs/​workbench/​api/​browser/​mainThreadSpeech.ts Registers main-thread bridge.
src/​vs/​sessions/​contrib/​chat/​test/​browser/​voiceBridge.test.ts Tests draft ownership.
src/​vs/​sessions/​contrib/​chat/​test/​browser/​newChatVoiceTarget.test.ts Updates composer contract.
src/​vs/​sessions/​contrib/​chat/​browser/​voiceBridge.contribution.ts Routes Agents-window input.
src/​vs/​sessions/​contrib/​chat/​browser/​newSessionComposerService.ts Aligns request options type.
src/​vs/​sessions/​contrib/​chat/​browser/​newChatWidget.ts Propagates send status.
src/​vs/​sessions/​contrib/​chat/​browser/​newChatVoice.ts Updates composer API.
src/​vs/​sessions/​contrib/​chat/​browser/​newChatInput.ts Reports voice submission status.
src/​vs/​sessions/​contrib/​chat/​browser/​chatView.ts Forwards send status.
extensions/​copilot/​src/​extension/​vscode-api.d.ts Includes speech proposal.
extensions/​copilot/​src/​extension/​byok/​vscode-node/​test/​openAIProvider.spec.ts Tests key invalidation.
extensions/​copilot/​src/​extension/​byok/​vscode-node/​test/​gptLiveSession.spec.ts Tests OpenAI transport.
extensions/​copilot/​src/​extension/​byok/​vscode-node/​openAIProvider.ts Retains active key.
extensions/​copilot/​src/​extension/​byok/​vscode-node/​gptLiveSession.ts Creates GPT-Live sessions.
extensions/​copilot/​src/​extension/​byok/​vscode-node/​byokContribution.ts Registers voice provider.
extensions/​copilot/​package.json Enables speech activation/API.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@meganrogge Megan Rogge (meganrogge) changed the title chat: enable and harden OpenAI BYOK Voice Mode chat: enable OpenAI BYOK Voice Mode Oct 1, 2026
@meganrogge Megan Rogge (meganrogge) added this to the 1.142.0 milestone Oct 1, 2026
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]>
Unblock PR CI while preserving both upstream composer tests and voice submission regressions. Validate the merged head through CI because local dependency restoration is blocked by npm feed authentication.

Co-authored-by: Copilot <[email protected]>
@alexr00 Alex Ross (alexr00) modified the milestones: 1.142.0, On Deck Oct 12, 2026
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]>
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]>
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]>
@meganrogge
Megan Rogge (meganrogge) marked this pull request as ready for review October 15, 2026 21:41
@meganrogge
Megan Rogge (meganrogge) enabled auto-merge (squash) October 15, 2026 21:43
Avoid a no-op regular expression in non-English voice choice parsing while preserving locale-gated behavior.\n\nCo-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support OpenAI GPT-Live BYOK in Voice Mode

6 participants