GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@magro magro commented Nov 9, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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?

  • Added a test that connects an Enterprise credential, keeps every HTTP request pending, and asserts that a fallback model routes to https://copilot-api.acme.ghe.com. It fails on dev (https://api.githubcopilot.com) and passes with the change.
  • bun run test test/plugin test/github-copilot in packages/core (611 pass), bun run typecheck and bun run lint at the root.
  • The original failure was observed in production on 2.2.6, see github-copilot (Enterprise): first prompt after Location boot sends the Enterprise token to api.githubcopilot.com #62959.

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.

All reactions
@magro
fix(core): route GitHub Copilot requests to the stored endpoint befor…
501afe2
…e the model list loads
opencodejr[bot]
opencodejr Bot reviewed Nov 9, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

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.

All reactions
@magro

magro commented Nov 10, 2026

Copy link
Copy Markdown
Author

Superseded by #63146, which also covers account switches. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@magro magro closed this Nov 10, 2026
@magro
magro deleted the copilot-enterprise-endpoint branch November 10, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

github-copilot (Enterprise): first prompt after Location boot sends the Enterprise token to api.githubcopilot.com

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@magro
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.