From 764d91fdfa6fb142e72ddcbade855b30e51dcbd3 Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza Date: Mon, 20 Jul 2026 06:52:05 -0300 Subject: [PATCH] fix(oauth): mirror ghe-copilot into the OAuth id map and MITM host list #7546 registered the ghe-copilot provider in src/lib/oauth/providers/index.ts but left it out of two mirrors that are asserted to stay in lock-step: - PROVIDERS in src/lib/oauth/constants/oauth.ts (the canonical id map), which made oauth-providers-config.test.ts fail three assertions at once; - MITM_TOOL_HOSTS, the client-safe projection of ALL_TARGETS, which made mitm-tool-hosts.test.ts fail its drift guard. Both reds reproduce on the pure release tip and turned every open PR's unit shards red, so this unblocks the whole queue. The test expectations are extended (not weakened) to cover the new provider. --- changelog.d/maintenance/ghe-copilot-registry-mirrors.md | 1 + src/lib/oauth/constants/oauth.ts | 1 + src/shared/constants/mitmToolHosts.ts | 3 +++ tests/unit/oauth-providers-config.test.ts | 5 +++++ 4 files changed, 10 insertions(+) create mode 100644 changelog.d/maintenance/ghe-copilot-registry-mirrors.md diff --git a/changelog.d/maintenance/ghe-copilot-registry-mirrors.md b/changelog.d/maintenance/ghe-copilot-registry-mirrors.md new file mode 100644 index 0000000000..1462537c32 --- /dev/null +++ b/changelog.d/maintenance/ghe-copilot-registry-mirrors.md @@ -0,0 +1 @@ +- fix(oauth): register `ghe-copilot` in the OAuth provider id map and the client-safe MITM host mirror, which #7546 left out of both — the gap turned the whole release branch red on `oauth-providers-config` and `mitm-tool-hosts` diff --git a/src/lib/oauth/constants/oauth.ts b/src/lib/oauth/constants/oauth.ts index 1a75643be7..4db9ef2f60 100644 --- a/src/lib/oauth/constants/oauth.ts +++ b/src/lib/oauth/constants/oauth.ts @@ -511,6 +511,7 @@ export const PROVIDERS = { KIMI_CODING: "kimi-coding", OPENAI: "openai", GITHUB: "github", + GHE_COPILOT: "ghe-copilot", GITLAB_DUO: "gitlab-duo", KIRO: "kiro", AMAZON_Q: "amazon-q", diff --git a/src/shared/constants/mitmToolHosts.ts b/src/shared/constants/mitmToolHosts.ts index f5634e53bd..53149c2492 100644 --- a/src/shared/constants/mitmToolHosts.ts +++ b/src/shared/constants/mitmToolHosts.ts @@ -17,6 +17,9 @@ export const MITM_TOOL_HOSTS: Record = { ], kiro: ["api.anthropic.com"], copilot: ["api.githubcopilot.com", "copilot-proxy.githubusercontent.com"], + // GHE Copilot has no fixed host: the enterprise domain is per-connection (gheUrl), so the + // canonical target declares an empty host list and nothing is added to the hosts file. + "ghe-copilot": [], codex: ["chatgpt.com"], cursor: ["api2.cursor.sh"], zed: ["api.zed.dev"], diff --git a/tests/unit/oauth-providers-config.test.ts b/tests/unit/oauth-providers-config.test.ts index 6f9ad3ebe3..2208c22b77 100644 --- a/tests/unit/oauth-providers-config.test.ts +++ b/tests/unit/oauth-providers-config.test.ts @@ -31,6 +31,7 @@ const { CODEBUDDY_CN_CONFIG, ZED_CONFIG, CURSOR_CONFIG, + GHE_COPILOT_CONFIG, GITHUB_CONFIG, GITLAB_DUO_CONFIG, GROK_CLI_CONFIG, @@ -59,6 +60,7 @@ const EXPECTED_PROVIDER_KEYS = [ "qwen", "kimi-coding", "github", + "ghe-copilot", "gitlab-duo", "kiro", "amazon-q", @@ -92,6 +94,7 @@ const EXPECTED_CONFIG_BY_PROVIDER = { qwen: QWEN_CONFIG, "kimi-coding": KIMI_CODING_CONFIG, github: GITHUB_CONFIG, + "ghe-copilot": GHE_COPILOT_CONFIG, "gitlab-duo": GITLAB_DUO_CONFIG, kiro: KIRO_CONFIG, "amazon-q": KIRO_CONFIG, @@ -129,6 +132,8 @@ const REQUIRED_FIELDS_BY_PROVIDER = { qwen: ["deviceCodeUrl", "tokenUrl", "scope", "clientId"], "kimi-coding": ["deviceCodeUrl", "tokenUrl", "clientId"], github: ["deviceCodeUrl", "tokenUrl", "userInfoUrl", "copilotTokenUrl", "clientId"], + // GHE Copilot derives its URLs at runtime from the per-connection gheUrl — only static fields. + "ghe-copilot": ["clientId", "scopes", "apiVersion", "userAgent"], "gitlab-duo": [ "baseUrl", "authorizeUrl",