Skip to content

Add a Copilot-specific GitHub Enterprise provider#314366

Open
slang25 wants to merge 7 commits intomicrosoft:mainfrom
slang25:copilot-ghe-separate-provider
Open

Add a Copilot-specific GitHub Enterprise provider#314366
slang25 wants to merge 7 commits intomicrosoft:mainfrom
slang25:copilot-ghe-separate-provider

Conversation

@slang25
Copy link
Copy Markdown

@slang25 slang25 commented May 5, 2026

Fixes #277435

Summary

  • Add a dedicated github-enterprise-copilot authentication provider and a new github.copilot.enterprise.uri setting for Copilot-specific enterprise auth
  • Switch Copilot enterprise auth, domain resolution, and MCP resolution to the new provider while keeping fallback to github-enterprise.uri for compatibility
  • Preserve the existing github-enterprise provider and legacy setting for GitHub PR/Issues and other GitHub integrations
  • Update setup, onboarding, and default account flows to recognize the new Copilot enterprise provider while honoring the legacy enterprise path
  • Add targeted coverage for provider selection and legacy URI fallback

Validation

  • Core typecheck: npm run compile-check-ts-native
  • Extension builds:
    • npm run gulp -- compile-extension:github-authentication
    • npm run gulp -- compile-copilot-extension-build
  • Targeted Copilot tests:
    • npm --prefix extensions/copilot run test:unit -- src/extension/githubMcp/test/node/githubMcpDefinitionProvider.spec.ts src/extension/test/vscode-node/session.test.ts
    • npm --prefix extensions/copilot run test:extension -- --grep "should use the Copilot enterprise provider if configured"
  • Hygiene: node --experimental-strip-types build/hygiene.ts <changed files>

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 <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 11:02
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering Bot commented May 5, 2026

📬 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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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);
	}

Comment thread src/vs/workbench/contrib/welcomeOnboarding/browser/onboardingVariationA.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.ts Outdated
Comment thread extensions/copilot/src/platform/authentication/common/authentication.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/actions/chatActions.ts Outdated
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 <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@XavierMP14 XavierMP14 left a comment

Choose a reason for hiding this comment

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

Xx

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

4 participants