GeezerVison is showing github.com — fix(core): route GitHub Copilot requests to the stored endpoint before the model list loads by magro · Pull Request #62970 · anomalyco/opencode
Conversation
magro
commented
Nov 9, 2026
•
edited by opencodejr
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Closes #62959
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
The Copilot plugin starts its provider refresh with an empty state, so until the first background load has fetched the account endpoint and model list, the fallback routes use baseURL(), i.e. https://api.githubcopilot.com. A prompt sent right after a Location boots therefore goes to the public host, even for a GitHub Enterprise (ghe.com) or data-residency credential. It fails, and the Enterprise token is sent to a host it is not meant for.
The endpoint stored at login (apiEndpoint, else derived from enterpriseUrl) is available locally without a network request. This PR seeds the refresh's initial state with copilotBaseURL(credential.metadata), so the fallback routes use the account's endpoint from the start. The first load still replaces it with the freshly fetched endpoint as before.
Not covered: right after switching the active Copilot account, the previous account's endpoint stays in use until the new load finishes. That needs a change to ProviderRefresh and seemed out of scope for this fix.
How did you verify your code works?
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Added by the opencode bot (AI-generated).
Related: #55490
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found nothing blocking. I ran the reproduction script from #62959 from source on the base and on this branch:
- Base: while
/models was still pending, OpenCode connected to api.githubcopilot.com:443 and the run ended with HTTP 403.
- This branch: every prompt request went to the account's own endpoint, and nothing went to
api.githubcopilot.com.
The new test fails on the base and passes here, the rest of the Copilot plugin tests pass, and tsc -b on packages/core is clean.
Reading the credential at startup doesn't make a network call, because Copilot's sign-in method has no token-refresh step. Every later load with a sign-in credential sets the endpoint to the fetched one or the stored one, so the seeded endpoint is never dropped.
Public API: unchanged.
Related: #55490
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Superseded by #63146, which also covers account switches. Thanks!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|