You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Task ID:t1543 | Status: open | Estimate:~4h Started: 2026-03-19 Tags:featurepluginauth
Description
feat: OAuth multi-account pool plugin for provider credential rotation — add pool module to opencode-aidevops plugin enabling multiple Anthropic OAuth accounts with automatic rotation on rate limits (429). Uses existing plugin auth hook + custom fetch wrapper. Includes /model-accounts-pool tool for account management.
Task Brief
t1543: OAuth Multi-Account Pool Plugin
Session Origin
Interactive session — user requested implementation after analysis of OpenCode PR #11832 (multi-account OAuth rotation). Determined that the existing OpenCode plugin API supports building this at the plugin layer without waiting for the upstream PR.
What
Add an OAuth multi-account pool module to the existing opencode-aidevops plugin (~/.aidevops/agents/plugins/opencode-aidevops/) that:
Registers a custom provider (anthropic-pool) via the plugin auth hook
Stores multiple OAuth credentials in ~/.aidevops/oauth-pool.json keyed by account email
Rotates credentials on rate limits (429) via a custom fetch wrapper
Manages token refresh automatically using refresh tokens
Provides /model-accounts-pool custom tool for account management (list, remove)
Mirrors all Anthropic models under the pool provider
Why
OAuth subscriptions (Claude Pro/Max) are significantly cheaper than API keys
Single-account OAuth hits rate limits mid-session with no recovery
Task ID:
t1543| Status: open | Estimate:~4hStarted: 2026-03-19
Tags:
featurepluginauthDescription
feat: OAuth multi-account pool plugin for provider credential rotation — add pool module to opencode-aidevops plugin enabling multiple Anthropic OAuth accounts with automatic rotation on rate limits (429). Uses existing plugin auth hook + custom fetch wrapper. Includes /model-accounts-pool tool for account management.
Task Brief
t1543: OAuth Multi-Account Pool Plugin
Session Origin
Interactive session — user requested implementation after analysis of OpenCode PR #11832 (multi-account OAuth rotation). Determined that the existing OpenCode plugin API supports building this at the plugin layer without waiting for the upstream PR.
What
Add an OAuth multi-account pool module to the existing
opencode-aidevopsplugin (~/.aidevops/agents/plugins/opencode-aidevops/) that:anthropic-pool) via the pluginauthhook~/.aidevops/oauth-pool.jsonkeyed by account emailfetchwrapper/model-accounts-poolcustom tool for account management (list, remove)Why
How
New file:
oauth-pool.mjsModule in
~/.aidevops/agents/plugins/opencode-aidevops/containing:ANTHROPIC_MODELS— model definitions mirroring built-in Anthropic providerloadPool()/savePool()— read/write~/.aidevops/oauth-pool.jsonauthorize()— PKCE OAuth flow (reuses client ID fromopencode-anthropic-auth)exchange()— code-to-token exchangerefreshToken()— refresh expired access tokenscreatePoolFetch()— fetch wrapper with rotation on 429/401poolAuthHook— theauthhook export for the plugincreatePoolTool()— the/model-accounts-pooltool definitionIntegration in
index.mjspoolAuthHookandcreatePoolToolfromoauth-pool.mjsconfighookPool file format (
~/.aidevops/oauth-pool.json){ "anthropic": [ { "email": "user@example.com", "refresh": "...", "access": "...", "expires": 1711234567, "added": "2026-03-19T...", "lastUsed": "2026-03-19T...", "status": "active", "rateLimitUntil": null } ] }Key design decisions
auth.json) — survives OpenCode updates, no conflict with built-in authfetchwrapper approach (notchat.headers) — gives full control over retry logicanthropic-pool— coexists with built-inanthropicproviderAcceptance Criteria
opencode auth login, select "Anthropic Pool", and add an account via OAuth/model-accounts-poollists all accounts with status (active, idle, rate-limited)/model-accounts-pool remove user@example.comremoves an account from the poolanthropic-poolprovider in the model pickerContext
/tmp/anthropic-auth/package/index.mjs(extracted during analysis)/tmp/package/dist/index.d.ts(extracted@opencode-ai/plugin@1.2.27)~/.aidevops/agents/plugins/opencode-aidevops/index.mjspackages/opencode/src/provider/provider.tslines 978-993Synced from TODO.md by issue-sync-helper.sh