Skip to content

fix(provider): ignore GITHUB_TOKEN when activating github-copilot - #44231

Open
aniruddhaadak80 wants to merge 1 commit into
anomalyco:devfrom
aniruddhaadak80:copilot-env-token
Open

fix(provider): ignore GITHUB_TOKEN when activating github-copilot#44231
aniruddhaadak80 wants to merge 1 commit into
anomalyco:devfrom
aniruddhaadak80:copilot-env-token

Conversation

@aniruddhaadak80

Copy link
Copy Markdown

Issue for this PR

Closes #44113

Type of change

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

What does this PR do?

The models.dev catalog lists GITHUB_TOKEN as an env var for github-copilot, so the generic env activation loop treats any GITHUB_TOKEN (often set for GitHub tooling) as a Copilot credential and loads the provider with source env. That bypasses the Copilot OAuth plugin, model discovery, and endpoint routing, which sends models like gpt-5.6-sol to /chat/completions where they fail.

This skips github-copilot in the env activation loop so the provider only activates through its OAuth plugin flow. Generic env activation for all other providers is unchanged.

How did you verify your code works?

  • Added a regression test: with GITHUB_TOKEN set, github-copilot no longer appears in loaded providers (bun test test/provider/provider.test.ts -t GITHUB_TOKEN passes; it fails without the fix).
  • Ran bun run typecheck and the full test/provider/provider.test.ts suite locally.

Screenshots / recordings

Not a UI change.

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:

I found a potentially related PR:

Related PR:

This PR is related because it's addressing the same issue (#44113) from a different angle. PR #44114 appears to focus on enforcing OAuth for GitHub Copilot, while PR #44231 (the current PR) specifically fixes the problem by skipping GITHUB_TOKEN env activation for the github-copilot provider. These are both working to prevent the provider from being incorrectly activated via environment variables when GITHUB_TOKEN is set.

@aniruddhaadak80

Copy link
Copy Markdown
Author

The unit test and typecheck workflows are in action_required state - could a maintainer approve the workflow runs for this first-time contribution? Local verification: the regression test passes (and fails without the fix), full provider suite and typecheck are clean.

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.

GITHUB_TOKEN incorrectly activates GitHub Copilot provider

1 participant