Skip to content

User auth plugins cannot override built-in plugins in CLI auth flow #11475

Description

@JosXa

Problem

When attempting to override the built-in GitHub Copilot auth plugin with a user/external plugin, the override doesn't work for opencode auth login. The built-in plugin always takes precedence in the CLI.

Root Cause

Plugin.list() returns internal plugins first, then user plugins. The CLI auth commands in packages/opencode/src/cli/cmd/auth.ts use .find() which returns the first match. Since internal plugins come first, the built-in plugin always wins.

Meanwhile, ProviderAuth.methods() (used by TUI) uses fromEntries() which is last-wins, so user plugins can override there.

This inconsistency means:

  • TUI: User plugins can override built-in auth ✅
  • CLI: User plugins cannot override built-in auth ❌

Expected Behavior

User/external plugins should be able to fully override built-in auth behavior (e.g., a company plugin replacing the default GitHub Copilot OAuth flow with a custom enterprise auth).

Reproduction

  1. Create a user plugin that registers auth.provider: "github-copilot" with a custom auth method
  2. Run opencode auth login github-copilot
  3. The built-in OAuth flow runs instead of the custom method

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions