Repository navigation
Support separate GitHub Enterprise hosts for Copilot - #314366
Stuart Lang (slang25) wants to merge 10 commits into
Conversation
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]>
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: TylerLeonhardtMatched files:
|
There was a problem hiding this comment.
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-copilotauth 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 attemptnew 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 validatevalue.trim().length > 0before 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);
}
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]>
|
Sorry. do you plan to merge this fix? We need it |
|
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
|
Any update on merging this fix? |
|
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. |
Fixes #277435
Summary
Allow Copilot and other GitHub extensions to use different GitHub Enterprise hosts without introducing a second authentication provider identity.
github-enterpriseprovider as the single public provider.authIssuersAPI.github.copilot.enterprise.urifor Copilot host selection, with blank-safe fallback togithub-enterprise.uri.Validation
extensions/copilot:npm run typecheckextensions/github-authentication: TypeScript--noEmitcheck using the available compilerextensions/copilot: 36 GitHub MCP tests passedgit diff --checkThe 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.