Skip to content

Support separate GitHub Enterprise hosts for Copilot - #314366

Open
Stuart Lang (slang25) wants to merge 10 commits into
microsoft:mainfrom
slang25:copilot-ghe-separate-provider
Open

Stuart Lang (slang25) wants to merge 10 commits into
microsoft:mainfrom
slang25:copilot-ghe-separate-provider

Conversation

@slang25

@slang25 Stuart Lang (slang25) commented May 5, 2026 •

Copy link
Copy Markdown

Fixes #277435

Summary

Allow Copilot and other GitHub extensions to use different GitHub Enterprise hosts without introducing a second authentication provider identity.

  • Keep the existing github-enterprise provider as the single public provider.
  • Register every configured GHES host as a supported authorization server through the authIssuers API.
  • Route each request to an isolated per-host authentication engine and existing host-keyed keychain while preserving legacy keychain identifiers.
  • Add github.copilot.enterprise.uri for Copilot host selection, with blank-safe fallback to github-enterprise.uri.
  • Pass Copilot's authorization server through silent, interactive, default-account, MCP, domain, setup, and onboarding flows.
  • Qualify account identities from non-default hosts so accounts with the same login do not collapse in the workbench.
  • Add focused router coverage for host routing, aggregation, account translation, removal, unsupported issuers, and URI normalization.

Validation

  • extensions/copilot: npm run typecheck
  • extensions/github-authentication: TypeScript --noEmit check using the available compiler
  • extensions/copilot: 36 GitHub MCP tests passed
  • Final feature diff passes git diff --check

The focused extension-host runner could not complete locally, and root source/hygiene checks could not start because the root dependency restore is unavailable in this checkout (@github/[email protected]/missing root modules). CI remains the source of truth for those checks.

Create a dedicated GitHub Enterprise provider and URI setting for Copilot while preserving the existing shared provider for PR/Issues and other GitHub integrations.

Wire Copilot to the new provider with legacy URI fallback, update workbench setup flows, and cover the new behavior in targeted tests.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 5, 2026 11:02
@vs-code-engineering

vs-code-engineering Bot commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • extensions/github-authentication/package.json
  • extensions/github-authentication/package.nls.json
  • extensions/github-authentication/src/extension.ts
  • extensions/github-authentication/src/github.ts

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

Adds a Copilot-dedicated GitHub Enterprise authentication provider (github-enterprise-copilot) and a Copilot-specific enterprise URI setting (github.copilot.enterprise.uri) so Copilot can target a different GHES/GHE.com host than other GitHub extensions, while retaining legacy compatibility via fallback to github-enterprise.uri.

Changes:

  • Introduces a new github-enterprise-copilot auth provider and wires it through product config, onboarding/setup, and default account selection with legacy-provider compatibility.
  • Updates Copilot enterprise domain/MCP resolution to use the new provider and Copilot-specific URI setting, with fallback to the legacy URI.
  • Adds/updates targeted unit and extension tests to cover provider selection and URI fallback behavior.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/vs/workbench/services/accounts/browser/defaultAccount.ts Default account provider selection now recognizes legacy enterprise provider IDs and falls back to legacy enterprise URI setting.
src/vs/workbench/contrib/welcomeOnboarding/browser/onboardingVariationA.ts Onboarding enterprise sign-in telemetry/provider id updated; enterprise URI detection now falls back to legacy setting.
src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.ts Chat setup enterprise URI detection now falls back to legacy setting.
src/vs/workbench/contrib/chat/browser/actions/chatActions.ts Context key expression for “non-enterprise” Copilot users updated to exclude both enterprise provider IDs.
product.json Default chat agent enterprise provider id and provider URI setting switched to Copilot-specific values; registers new provider usage mapping.
extensions/github-authentication/src/github.ts Authentication provider registration now supports overriding provider id/label for GHES-based providers.
extensions/github-authentication/src/extension.ts Registers both enterprise providers (legacy + Copilot) with primary/fallback URI settings and dynamic re-init on config changes.
extensions/github-authentication/package.nls.json Adds localized description string for the new Copilot enterprise URI setting.
extensions/github-authentication/package.json Contributes new auth provider id and new github.copilot.enterprise.uri setting; restricts it in untrusted workspaces.
extensions/copilot/src/platform/endpoint/node/domainServiceImpl.ts Domain resolution now uses Copilot enterprise URI helper and recognizes enterprise provider via helper predicate.
extensions/copilot/src/platform/configuration/common/configurationService.ts Adds GitHubEnterpriseCopilot to the Copilot AuthProviderId enum.
extensions/copilot/src/platform/authentication/common/authentication.ts Adds constants + helpers for Copilot enterprise URI (with legacy fallback) and enterprise-provider detection.
extensions/copilot/src/extension/test/vscode-node/session.test.ts Updates session selection test to expect github-enterprise-copilot provider id.
extensions/copilot/src/extension/githubMcp/test/node/githubMcpDefinitionProvider.spec.ts Updates tests to use Copilot enterprise URI setting and adds coverage for legacy URI fallback + change events.
extensions/copilot/src/extension/githubMcp/common/githubMcpDefinitionProvider.ts MCP definition provider now reads Copilot enterprise URI with legacy fallback and reacts to both settings.
extensions/copilot/CONTRIBUTING.md Updates contributed product override examples for new provider id and Copilot enterprise URI setting.
Comments suppressed due to low confidence (1)

src/vs/workbench/services/accounts/browser/defaultAccount.ts:900

  • getEnterpriseUrl() uses nullish coalescing (??) to fall back to the legacy setting. If the Copilot-specific setting is explicitly set to an empty string (which the schema pattern allows), this will not fall back and will attempt new URL(''), throwing and causing enterprise endpoints to silently fall back to the non-enterprise URLs. Consider treating empty/whitespace strings as "unset" (e.g., use || or validate value.trim().length > 0 before constructing the URL) so the legacy fallback works as intended.
		const value = this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderUriSetting)
			?? this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderUriFallbackSetting);
		if (!isString(value)) {
			return undefined;
		}
		return new URL(value);
	}

Stuart Lang (slang25) and others added 2 commits May 5, 2026 12:14
Treat blank Copilot enterprise URIs as unset for legacy fallback, reuse the exported legacy URI constant, simplify the non-enterprise context expression, and add regression coverage for blank-string fallback.

Co-authored-by: Copilot <[email protected]>

@XavierMP14 XAVIERMP (XavierMP14) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Xx

@fdecollibus

Copy link
Copy Markdown

Sorry. do you plan to merge this fix? We need it

@IamTheKaaZZ

Copy link
Copy Markdown

Stuart Lang (@slang25) TylerLeonhardt , can this be forwarded to collaborators for review so this can get merged?

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e96d24e7-aae3-4062-946e-44f41c02fb2b
@digitarald Harald Kirschner (digitarald) changed the title Add a Copilot-specific GitHub Enterprise provider Support separate GitHub Enterprise hosts for Copilot Jul 29, 2026
@Arshalok

Copy link
Copy Markdown

Any update on merging this fix?

@swallerick

swallerick commented Sep 15, 2026 •

Copy link
Copy Markdown

TylerLeonhardt Just checking in. Merging this would be really helpful at my (fairly large) organization and I will be sure to provide feedback if I find any issues with this once it makes it to the Insiders release. I've been refreshing this daily for any updates.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub Enterprise should allow multiple servers

9 participants