Skip to content

fix: keep claude-cli identity for GitHub Copilot (PR #976)#1216

Open
Vasanthdev2004 wants to merge 7 commits into
Gitlawb:mainfrom
Vasanthdev2004:fix/github-copilot-identity
Open

fix: keep claude-cli identity for GitHub Copilot (PR #976)#1216
Vasanthdev2004 wants to merge 7 commits into
Gitlawb:mainfrom
Vasanthdev2004:fix/github-copilot-identity

Conversation

@Vasanthdev2004
Copy link
Copy Markdown
Collaborator

Summary

Fix for PR #976 — GitHub Copilot whitelists claude-cli but may not whitelist openclaude-cli. This change keeps the upstream-compatible identity for GitHub Copilot connections.

Changes

  • Added getAPIProvider() === 'github' to the requiresCompatibilityIdentity check in src/utils/http.ts
  • GitHub Copilot now keeps using claude-cli identity (whitelisted)
  • Kimi Code keeps using claude-cli identity (already handled)
  • All other providers use openclaude-cli identity (new branding)

Why

Without this fix, PR #976 will break GitHub Copilot connections because:

  1. getAPIProvider() returns 'github' for Copilot
  2. shouldUseFirstPartyAuth() returns false (not 'firstParty')
  3. getProviderApiUserAgent() would send openclaude-cli/0.11.0
  4. Copilot might not whitelist openclaude-cli

Testing

After applying:

  1. Set OPENAI_BASE_URL=https://api.githubcopilot.com and GITHUB_TOKEN=<token>
  2. Run any query — should work with claude-cli identity
  3. Check logs for User-Agent: claude-cli/...

Related

jatmn and others added 7 commits May 1, 2026 18:18
Keep compatibility-sensitive claude-cli/claude-code user agents on MACRO.VERSION while adding a shared public build version helper for MCP-facing metadata.

Update MCP client metadata and MCP user-agent strings to report DISPLAY_VERSION where appropriate without reintroducing first-party version-gate regressions.

Add focused regression tests covering:
- public build version helper behavior
- API client user-agent compatibility behavior
Split Anthropic-owned endpoint user agents from provider-routed API traffic.

Keep compatibility-sensitive Anthropic requests on claude-cli/99.0.0 while using openclaude-cli with the current public build version for non-first-party/OpenAI-compatible connections.

Wire getAnthropicClient() to pass its providerOverride-aware first-party decision into the user-agent helper so per-request routing stays correct.

Expand focused tests to cover first-party compatibility traffic, Anthropic-owned endpoints under third-party env, non-first-party provider traffic, and explicit first-party override behavior.
GitHub Copilot whitelists 'claude-cli' but may not whitelist
'openclaude-cli'. Keep using the upstream-compatible identity
for GitHub Copilot until confirmed safe to switch.

Refs: PR Gitlawb#976
Copy link
Copy Markdown
Collaborator

@gnanam1990 gnanam1990 left a comment

Choose a reason for hiding this comment

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

Thanks for flagging the Copilot identity concern and putting up a focused fix — the routing split itself is clean and the tests pass locally (bun run build, bun test src/utils/http.test.ts src/utils/userAgent.test.ts all green).

I can't take this in its current form, for two reasons.

1. The Copilot identity change needs empirical proof, not an assumption.
openclaude is an independent community fork, and the entire point of the rebrand is to stop presenting the Anthropic claude-cli identity to external providers. Pinning Copilot back to claude-cli re-introduces exactly that fingerprint. The PR description says Copilot "may not whitelist openclaude-cli" and the code comment itself reads "...may not whitelist openclaude-cli — keep compatibility until confirmed." That is the open question stated as the justification — we'd be perpetuating the upstream identity on something explicitly not yet confirmed.

Separately, our own Copilot path doesn't appear to gate on the User-Agent at all: src/services/api/openaiShim.ts:99-104 sends Copilot-Integration-Id: vscode-chat / Editor-Version / Editor-Plugin-Version (mirrored in deviceFlow.ts and cache-probe.ts), and those are hard-applied to Copilot requests at openaiShim.ts:1827. So the premise that Copilot whitelists by the claude-cli UA string has no supporting evidence even in our own code.

Could you either: (a) provide a concrete repro — set OPENAI_BASE_URL=https://api.githubcopilot.com with a real Copilot token, send one request with openclaude-cli/... and one with claude-cli/..., and paste the HTTP status code + response body for each (a 401/403 on openclaude-cli vs 200 on claude-cli would settle it), or cite an authoritative Copilot API doc/issue requiring the UA; or (b) rework so Copilot uses the openclaude identity (and, if a header is genuinely required, set the appropriate Copilot integration header rather than the Anthropic CLI UA). If the repro shows Copilot really does reject openclaude-cli, I'm happy to revisit with that evidence.

2. Branch scope. This PR targets main but carries the six commits from #976, which is still open with changes requested and explicitly blocked pending the moonshot/KimiCode confirmation in its own description. Merging this would pull #976 in ahead of that. Please rebase so this contains only the Copilot change (and let's land it on top of #976 once #976 is unblocked), and add a test asserting the github provider emits the expected identity so the new branch is covered.

Appreciate the work here — happy to move quickly once there's a repro or the reworked approach.

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.

3 participants