-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Description
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
- Create a user plugin that registers
auth.provider: "github-copilot"with a custom auth method - Run
opencode auth login github-copilot - The built-in OAuth flow runs instead of the custom method