Skip to content

fix(opencode): use public Copilot host for github.com - #51895

Open
dajiaohuang wants to merge 1 commit into
anomalyco:devfrom
dajiaohuang:copilot-public-api
Open

dajiaohuang wants to merge 1 commit into
anomalyco:devfrom
dajiaohuang:copilot-public-api

Conversation

@dajiaohuang

Copy link
Copy Markdown

Issue for this PR

Closes #45302

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

GitHub.com OAuth accounts can store enterpriseUrl: "github.com". The host builder treated that as a GitHub Enterprise domain and generated copilot-api.github.com. This routes github.com accounts to the public Copilot API and keeps the existing enterprise host behavior.

How did you verify your code works?

  • bun test test/plugin/github-copilot-models.test.ts from packages/opencode
  • bun run typecheck from packages/opencode

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@kvnloo

kvnloo commented Sep 28, 2026

Copy link
Copy Markdown

github.com OAuth accounts are sent to the enterprise-remapped Copilot host instead of api.githubcopilot.com.

Head 633fbe9c3fb448e7de17e9e70aabb6b88eca9681 is unchanged from the tested tip.

Fork leaf kvnloo#193 recorded fail→pass on packages/opencode/test/plugin/github-copilot-models.test.ts (8 pass, 1 fail with the assertion removed, 8 pass after restore).

That locks the public host for github.com accounts. It does not cover enterprise hosts.

@dajiaohuang

Copy link
Copy Markdown
Author

@kvnloo Thanks for the review and the fork-based verification! Acknowledged the issue: github.com OAuth accounts were being incorrectly routed to the enterprise Copilot host. I'll keep the existing enterprise-host behavior as-is (head unchanged) and focus the fix strictly on the public host routing for github.com accounts. Happy to discuss the fork/branch handling approach — if there's a preferred way to structure this (e.g., separate commits, test coverage for enterprise hosts), let me know.

This branch has not been deployed

No deployments
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.

Incorrect URL for Github Copilot API

2 participants