feat: OAuth Enhancements - Multi-Account, YOLO Mode, Auto-Relogin#9972
feat: OAuth Enhancements - Multi-Account, YOLO Mode, Auto-Relogin#9972mguttmann wants to merge 15 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs FoundBased on my search, I found several related PRs that may be addressing similar or overlapping functionality:
These PRs appear to overlap with the OAuth Enhancements PR #9972, particularly around multi-account rotation, usage tracking, and authentication refresh functionality. |
|
Thanks for flagging the potential duplicates! Let me clarify the relationship: Relationship to existing PRs
Unique features in this PR
ScreenshotsSee the attached screenshots in issue #9971 showing:
Happy to adjust scope or coordinate with maintainers on any overlapping functionality! |
9f420f9 to
41fa182
Compare
Update - January 24, 2025Branch rebased and updated to latest Latest Fixes
All Features Working
Ready for review. |
Poor Adam... |
Update: Multi-Language FixAdded a fix for browser session refresh that now works regardless of Claude.ai language setting. Commit: c687571 - fix(auth): make browser session refresh language-agnostic Changes:
This was causing issues when Claude.ai was set to a non-English language - the "Authorize" button wasn't being clicked because the code was looking for the English text. |
|
@vanyauhalin I promise most of those lines are just me being thorough... and definitely not because I kept finding "one more small thing" to add 😅 Adam, if you're reading this: I brought coffee ☕ (virtually). Also, the multi-language fix alone should earn me some karma points - debugging Puppeteer clicking German buttons at midnight wasn't on my bingo card. But hey, at least it's not a mass-rename refactor! 🙈 |
|
What about OpenAI? (Antigravity could be a bonus) |
|
@kfiramar I don't use OpenAI, so no idea honestly - I'm a pure Claude user 🤷♂️ The multi-account rotation technically works for any OAuth provider, but the main use case (and the auto-relogin browser sessions) is specifically built around Claude Max subscriptions. |
Fix: Removed duplicate providers menu entryCommit: 907a28b After merging the latest upstream, the settings dialog had two "Providers" entries - our old hardcoded English one and the new upstream i18n-aware one (which shows "Anbieter" in German, "Providers" in English, etc.). Removed our duplicate entry since upstream now handles this properly with localization support. |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
Multi-Account OAuth Rotation: - Add Providers tab to Settings with account management UI - Support multiple OAuth accounts per provider with auto-rotation - Display Anthropic rate limits (5-hour, 7-day, Sonnet) - Account switching with instant rate limit updates - CLI: opencode auth usage command YOLO Mode: - Skip all permission prompts (respects explicit deny rules) - Session-only or persistent (saved to config.json) - OPENCODE_YOLO env var and --yolo CLI flag - Settings UI with warning and CLI usage info Auto-Relogin Browser Sessions: - Puppeteer-based browser session management - Store browser profiles per-account for isolated cookies - Setup: Opens visible browser for user login - Refresh: Headless token refresh on 401 errors - CLI: opencode auth browser setup/status/refresh/remove
Re-add rotating-fetch.ts and credential-manager.ts that were lost during rebase. Integrate createOAuthRotatingFetch in provider.ts to enable: - Automatic token refresh on 401/403 errors - Browser session auto-relogin via Puppeteer - Multi-account rotation and failover
UI Features: - Account rename with inline edit (click pencil icon) - Rebind button to re-authenticate without removing account - Display account labels instead of 'Account 1/2/3' - Settings menu reordered (Providers under Server section) CLI Commands: - opencode auth browser list/setup/refresh/remove - opencode auth rename [recordId] [name] Bug Fixes: - Fix puppeteer stealth plugin added multiple times (memory leak) - Add 30s timeout for browser launch to prevent app hanging - Add 2min timeout for auto-relogin operation - Improve browser cleanup with SIGKILL and lock file removal - Cache puppeteer instance to prevent repeated initialization
Ensures the abort timeout is always cleared, even when fetch fails.
Changed outer button to div with role=button to avoid nesting buttons, which caused crashes when clicking the rename icon.
…ing ones - Fixed bug where adding a second OAuth account would overwrite the first - Only reuse existing record if refresh token matches or context is explicit - Auto-generate label like 'Account 2' for new accounts - Also fixed Auto-Relogin section to show renamed account labels
- Auto-dismiss cookie banners before clicking authorize - Find authorize button by background color (primary button style) instead of text - Skip deny buttons by checking common deny patterns across languages - Works with any language setting (German, English, French, etc.)
Upstream now has an i18n-aware providers tab, so our hardcoded English 'Providers' entry was duplicating it.
907a28b to
2656048
Compare
|
Rebased on latest Changes made during rebase:
|
CI Status Update
Note on test failures:
All unit tests pass, including the new auth/oauth tests. The same E2E tests pass on the Changes since last update:
Ready for review. The E2E flakiness appears to be unrelated to the OAuth changes. |
…ings tabs - DELETE /auth/account was unreachable because DELETE /auth/:providerID matched first (treating 'account' as providerID). Moved literal route before the wildcard so it takes precedence. - Restored Providers and Models tab triggers in dialog-settings.tsx that were lost during merge. Aligned with upstream structure.
- Restore conditional source logic in provider loaders: only set source='custom' when provider isn't already loaded (preserves source='env' for env-loaded providers like Anthropic) - Add custom-provider-section with data-component attribute to settings-providers.tsx for E2E test compatibility - Fixes 'provider loaded from env variable' unit test failure - Fixes settings-providers E2E test failures (custom provider form tests)
Update – February 2, 2026Rebased on latest Bugs fixed in this update
CI Status
|
|
Closing this PR — splitting into two separate, focused PRs: one for Multi-Account + Auto-Relogin, and one for YOLO Mode. New PRs will be linked here once created. |
Summary
Combined PR for three OAuth/authentication enhancements for power users:
Closes #9971
Features
1. Multi-Account OAuth Rotation
opencode auth usage2. YOLO Mode
opencode --yoloorOPENCODE_YOLO=true3. Auto-Relogin Browser Sessions
opencode auth browser setup/status/refresh/removeChanged Files
App (Frontend)
dialog-settings.tsx- Add Providers tabsettings-providers.tsx- New provider management UIsettings-general.tsx- Add YOLO Mode sectionsession-context-tab.tsx- Add rate limit display and account switchingOpenCode (Backend)
auth/index.ts- Multi-account support, usage API, token managementauth/browser.ts- Puppeteer browser session managementauth/context.ts- Auth context utilitiesyolo/index.ts- YOLO mode state managementconfig/config.ts- Add yolo config fieldflag/flag.ts- Add OPENCODE_YOLO flagpermission/next.ts- YOLO auto-approve integrationproject/bootstrap.ts- Initialize YOLO on startupserver/routes/config.ts- YOLO API endpointsserver/routes/provider.ts- Browser session endpointsserver/server.ts- Auth usage and active account endpointsSDK