-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat: OAuth Enhancements - Multi-Account, YOLO Mode, Auto-Relogin #9972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
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! |
dd4dd37 to
9f420f9
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
9f420f9 to
41fa182
Compare
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
Update - January 24, 2025Branch rebased and updated to latest Latest Fixes
All Features Working
Ready for review. |
Adds a new setting in Settings → General → Browser that allows users to choose whether clicking links should open them in the system's default browser (default) or within the desktop app.
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