Add a Copilot-specific GitHub Enterprise provider#314366
Open
slang25 wants to merge 7 commits intomicrosoft:mainfrom
Open
Add a Copilot-specific GitHub Enterprise provider#314366slang25 wants to merge 7 commits intomicrosoft:mainfrom
slang25 wants to merge 7 commits intomicrosoft:mainfrom
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 <223556219+Copilot@users.noreply.github.com>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @TylerLeonhardtMatched files:
|
Contributor
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 <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #277435
Summary
github-enterprise-copilotauthentication provider and a newgithub.copilot.enterprise.urisetting for Copilot-specific enterprise authgithub-enterprise.urifor compatibilitygithub-enterpriseprovider and legacy setting for GitHub PR/Issues and other GitHub integrationsValidation
npm run compile-check-ts-nativenpm run gulp -- compile-extension:github-authenticationnpm run gulp -- compile-copilot-extension-buildnpm --prefix extensions/copilot run test:unit -- src/extension/githubMcp/test/node/githubMcpDefinitionProvider.spec.ts src/extension/test/vscode-node/session.test.tsnpm --prefix extensions/copilot run test:extension -- --grep "should use the Copilot enterprise provider if configured"node --experimental-strip-types build/hygiene.ts <changed files>