anomalyco / anomalyco/opencode

GITHUB_TOKEN incorrectly activates GitHub Copilot provider

Open
#44,113 0 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 22, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

When GITHUB_TOKEN is set for GitHub tooling, OpenCode also treats github-copilot as connected through generic environment authentication, even when no Copilot OAuth credential exists. opencode auth list consequently reports GitHub Copilot under Environment.

This bypasses Copilot-specific OAuth, model-discovery, and request-routing logic. Without the endpoint metadata returned by Copilot model discovery, gpt-5.6-sol is sent to /chat/completions, resulting in request failure every time.

The minimal expected behavior is to ignore GITHUB_TOKEN when automatically activating the github-copilot provider and require the existing Copilot OAuth flow. Generic environment authentication for other providers should remain unchanged.

Plugins

None; this concerns the built-in GitHub Copilot provider.

OpenCode version

dev at e00890c672 (1.18.21)

Steps to reproduce
  1. Use a clean OpenCode data directory with no stored github-copilot credential.
  2. Set a non-empty GITHUB_TOKEN.
  3. Run opencode auth list.
  4. Observe that GitHub Copilot is reported under Environment despite no Copilot OAuth login.
  5. Select a newer Copilot model such as github-copilot/gpt-5.6-sol.
  6. Observe that OpenCode uses the generic environment-token provider path instead of Copilot OAuth/model discovery, resulting in gpt-5.6-sol being sent to /chat/completions and failing.
Screenshot and/or share link

No response

Operating System

macOS and Linux

Terminal

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.