fix(copilot): support GitHub Enterprise host for auth and base URL#11527
Open
dwc1997 wants to merge 1 commit into
Open
fix(copilot): support GitHub Enterprise host for auth and base URL#11527dwc1997 wants to merge 1 commit into
dwc1997 wants to merge 1 commit into
Conversation
Collaborator
Resolve Copilot GitHub host from COPILOT_GH_HOST or config.yaml copilot.github_host, apply it to device login and gh token lookup, and derive a GHES Copilot base URL when no explicit COPILOT_API_BASE_URL is set.
047fbb0 to
1481be6
Compare
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.
What does this PR do?
This PR adds GitHub Enterprise Server (GHE) host support for the
copilotprovider flow.Specifically, it makes Copilot auth/runtime host-aware by resolving a GitHub host from:
COPILOT_GH_HOSTenv varconfig.yaml -> copilot.github_hostgithub.comThen it applies that host in two places:
gh auth tokenlookup (--hostname <host>for GHE)In addition, when
COPILOT_API_BASE_URLis not explicitly set, Copilot runtime base URL is auto-derived for GHE as:https://<host>/api/v3/copilot_internalThis keeps existing default behavior unchanged for
github.com, while enabling out-of-the-box GHE support.Related Issue
Fixes #11442
Type of Change
Changes Made
hermes_cli/copilot_auth.py:resolve_copilot_github_host()with env+config fallback chaingh auth tokenflow to pass--hostnamefor non-default hostshermes_cli/main.py:hermes_cli/auth.py:_resolve_copilot_base_url()for GHE base URL derivationresolve_api_key_provider_credentials("copilot")tests/hermes_cli/test_copilot_auth.pytests/hermes_cli/test_api_key_providers.pyHow to Test
export COPILOT_GH_HOST=ghe.example.comhttps://ghe.example.com/api/v3/copilot_internalwhen
COPILOT_API_BASE_URLis unset.COPILOT_API_BASE_URL=https://proxy.example/copilotScreenshots / Logs
N/A (auth/runtime routing + tests)