opencode
opencode copied to clipboard
bug: multiple plugins registering auth for the same provider silently overwrite each other
When multiple plugins register authentication methods for the same provider (e.g., both opencode-antigravity-auth and opencode-websearch-cited register for google), only one plugin's methods are available. The other plugin's auth methods are silently discarded.
This affects both the CLI (opencode auth login) and the API (GET /provider/auth).
Root Cause
API (provider/auth.ts): Uses fromEntries() to build the methods map, which overwrites duplicate keys - last plugin wins.
CLI (cli/cmd/auth.ts): Uses .find() to get only the first matching plugin - first plugin wins.
Reproduction
- Install
opencode-antigravity-authandopencode-websearch-cited - Run
opencode auth loginand select Google - Only see "Google API key" - the Antigravity OAuth option is missing
Or via API:
curl -s http://127.0.0.1:7860/provider/auth | jq '.google'
# Returns only: [{ "type": "api", "label": "Google API key" }]
Expected
All auth methods from all plugins should be available for the same provider.
Fix
PR #6260