Skip to content

Enable BYOK in air-gapped scenarios/without GitHub auth - #317428

Merged
Dmitriy Vasyura (dmitrivMS) merged 25 commits into
mainfrom
dev/dmitriv/byok-air-gapped
May 21, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 25 commits into
mainfrom
dev/dmitriv/byok-air-gapped

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented May 20, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Pull request overview

This PR updates VS Code’s Copilot Chat integration to better support BYOK (bring-your-own-key) usage in air‑gapped / signed-out scenarios by avoiding hard dependencies on GitHub authentication for parts of the extension that don’t strictly require it.

Changes:

  • Adjusts sign-in UI surfacing and welcome messaging so BYOK availability suppresses GitHub-auth-specific warnings.
  • Adds “no GitHub auth” guards/fallbacks in Copilot extension components (model metadata fetch, embeddings, prompt JSON rendering).
  • Changes conversation feature activation logic to allow activation when non-Copilot (BYOK) chat models are present.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts Tweaks Accounts menu sign-in action label/visibility logic.
extensions/copilot/src/platform/endpoint/node/modelMetadataFetcher.ts Stops model metadata fetch when Copilot token acquisition fails (BYOK-only).
extensions/copilot/src/platform/embeddings/common/remoteEmbeddingsComputer.ts Adds early auth guard for remote embeddings requests.
extensions/copilot/src/extension/prompts/node/base/promptRenderer.ts Falls back to a stub endpoint when utility model resolution fails during JSON rendering.
extensions/copilot/src/extension/prompt/node/chatMLFetcher.ts Loosens Copilot token dependency for BYOK endpoints (but see comments).
extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts Prevents registering LM/embeddings features without a GitHub session.
extensions/copilot/src/extension/conversation/vscode-node/conversationFeature.ts Activates conversation features based on BYOK model presence; adds auth gating for search providers (but contains issues).
extensions/copilot/src/extension/conversation/vscode-node/chatParticipants.ts Avoids resolving the utility endpoint unless a quota fallback is needed.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts Skips CLI model fetch without a GitHub session.
extensions/copilot/src/extension/authentication/vscode-node/authentication.contribution.ts Alters permissive-auth upgrade flow behavior when signed out.
extensions/copilot/package.json Hides Copilot auth-related welcome messages when BYOK models are present.

Copilot's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/extension/conversation/vscode-node/conversationFeature.ts:222

  • Same typo here: anyGithubSession should be anyGitHubSession to match the authentication service API and avoid a compile error.
		// Don't register for no auth user or or BYOK-only users
		if (!this.authenticationService.anyGithubSession || this.authenticationService.copilotToken?.isNoAuthUser) {
			this.logService.debug('ConversationFeature: Skipping settings search provider registration - no GitHub session available');
			return;
  • Files reviewed: 11/11 changed files
  • Comments generated: 6

@dmitrivMS Dmitriy Vasyura (dmitrivMS) changed the title Enable BYOK if air-gapped scenarios wthiout GitHub auth Enable BYOK in air-gapped scenarios wthiout GitHub auth May 20, 2026
This was referenced May 20, 2026

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's findings

  • Files reviewed: 20/20 changed files
  • Comments generated: 2

@dmitrivMS Dmitriy Vasyura (dmitrivMS) changed the title Enable BYOK in air-gapped scenarios wthiout GitHub auth Enable BYOK in air-gapped scenarios/without GitHub auth May 20, 2026
@github-actions

github-actions Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Base: 827fd6c6 Current: 96ab5ab3

No screenshot changes.

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) enabled auto-merge (squash) May 20, 2026 23:39
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit d61f56e into main May 21, 2026
25 checks passed
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) deleted the dev/dmitriv/byok-air-gapped branch May 21, 2026 00:01
@vs-code-engineering vs-code-engineering Bot added this to the 1.122.0 milestone May 21, 2026
@agoswami84

Copy link
Copy Markdown

how to use this feature

@cf-rdegregory

Ryland DeGregory (cf-rdegregory) commented May 21, 2026 •

Copy link
Copy Markdown

how to use this feature

  1. Update to the latest insiders build
image
  1. Log out of GitHub in Insiders.
  2. Configure a BYOK model provider in chatLanguageModels.json.

@digitarald

Copy link
Copy Markdown
Contributor

Cross-posting from #246551 (comment)

Dmitriy Vasyura (@dmitrivMS) just landed this yesterday and today its ready for testing and your feedback in Insiders (download here, can be used side by side with your stable VS Code).

Start:

  1. Enable chat.allowAnonymousAccess and restart VS Code (Command: Developer: Reload Window)
  2. Make sure you have your favorite BYOK providers added, local or remote
  3. Done: Pick your BYOK model in VS Code chat and say Hi; no GitHub Copilot login needed.

Bonus: Set your BYOK model for chat.utilityModel and chat.utilitySmallModel, more details in our release notes on what they are used for.

Please help us test. File issues and/or comment if you had a chance to try this out.

Screenshot from my testing with OpenAI as BYOK provider:
Image

Dmitriy Vasyura (dmitrivMS) added a commit that referenced this pull request May 23, 2026
…#318092)

* Fix BYOK regression for non-OAuth Copilot token pathways

Introduce hasCopilotTokenSource on IAuthenticationService, defaulted to !!anyGitHubSession in BaseAuthenticationService and overridden to true in StaticGitHubAuthenticationService (proxy/HMAC, eval harness).

Replace PR-introduced anyGitHubSession guards added in #317428 at sites that gate on 'can we mint a Copilot token?' so the eval proxy pathway is no longer short-circuited:

- languageModelAccess._getToken

- authentication.contribution.waitForChatEnabled

- copilotCli (3 sites)

- remoteEmbeddingsComputer

Group-B sites that intentionally gate on a real signed-in GitHub user (conversationFeature search/intent provider registration, byokUtilityModel notification) keep using anyGitHubSession.

* PR feedback: clarify log message; fall back to empty embeddings in proxy scenarios

- Update languageModelAccess log to say 'Copilot token source' (matches the new gate).

- In remoteEmbeddingsComputer, return empty embeddings instead of throwing when the Dotcom path lacks a GitHub access token (proxy/HMAC eval harness), matching the rest of the function's empty-fallback behavior.
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jul 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

7 participants