diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts index 0f8cbd23f775..70c58b347a26 100644 --- a/packages/opencode/src/provider/provider.ts +++ b/packages/opencode/src/provider/provider.ts @@ -1579,6 +1579,8 @@ const layer = Layer.effect( for (const [id, provider] of Object.entries(database)) { const providerID = ProviderV2.ID.make(id) if (disabled.has(providerID)) continue + // GITHUB_TOKEN is commonly set for GitHub tooling; github-copilot must only activate through its OAuth plugin flow. + if (providerID === ProviderV2.ID.githubCopilot) continue const apiKey = provider.env.map((item) => envs[item]).find(Boolean) if (!apiKey) continue mergeProvider(providerID, { diff --git a/packages/opencode/test/provider/provider.test.ts b/packages/opencode/test/provider/provider.test.ts index 32d4e3a39b10..88bb3de0b210 100644 --- a/packages/opencode/test/provider/provider.test.ts +++ b/packages/opencode/test/provider/provider.test.ts @@ -121,6 +121,14 @@ it.instance("provider loaded from env variable", () => }), ) +it.instance("GITHUB_TOKEN does not activate github-copilot", () => + Effect.gen(function* () { + yield* setProcessEnv("GITHUB_TOKEN", "test-github-token") + const providers = yield* list + expect(providers[ProviderV2.ID.githubCopilot]).toBeUndefined() + }), +) + it.instance( "provider loaded from config with apiKey option", Effect.gen(function* () {