Skip to content

Conversation

@mguttmann
Copy link

Summary

Combined PR for three OAuth/authentication enhancements for power users:

  • Multi-Account OAuth Rotation - Use multiple Claude Max accounts with auto-rotation on rate limits
  • YOLO Mode - Skip all permission prompts for trusted workflows
  • Auto-Relogin Browser Sessions - Automatic token refresh via Puppeteer

Closes #9971

Features

1. Multi-Account OAuth Rotation

  • Providers tab in Settings with full account management UI
  • Display Anthropic rate limits (5-hour, 7-day, Sonnet) with real-time updates
  • Click to switch accounts, auto-rotate on rate limits
  • CLI: opencode auth usage

2. YOLO Mode

  • Skip ALL permission prompts (respects explicit deny rules)
  • Session-only or persistent mode
  • Settings > General > YOLO Mode section
  • CLI: opencode --yolo or OPENCODE_YOLO=true

3. Auto-Relogin Browser Sessions

  • Puppeteer-based with stealth plugin (bypasses Cloudflare)
  • Isolated browser profiles per account
  • Automatic headless token refresh on 401 errors
  • CLI: opencode auth browser setup/status/refresh/remove

Changed Files

App (Frontend)

  • dialog-settings.tsx - Add Providers tab
  • settings-providers.tsx - New provider management UI
  • settings-general.tsx - Add YOLO Mode section
  • session-context-tab.tsx - Add rate limit display and account switching

OpenCode (Backend)

  • auth/index.ts - Multi-account support, usage API, token management
  • auth/browser.ts - Puppeteer browser session management
  • auth/context.ts - Auth context utilities
  • yolo/index.ts - YOLO mode state management
  • config/config.ts - Add yolo config field
  • flag/flag.ts - Add OPENCODE_YOLO flag
  • permission/next.ts - YOLO auto-approve integration
  • project/bootstrap.ts - Initialize YOLO on startup
  • server/routes/config.ts - YOLO API endpoints
  • server/routes/provider.ts - Browser session endpoints
  • server/server.ts - Auth usage and active account endpoints

SDK

  • Regenerated with new auth endpoints

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

Based on my search, I found several related PRs that may be addressing similar or overlapping functionality:

  1. PR feat(auth): OAuth Marathon - multi-account credential rotation #8590 - feat(auth): OAuth Marathon - multi-account credential rotation

    • Directly related to multi-account OAuth rotation feature
  2. PR feat(openai-oauth) OpenAI OAuth multi account support #8536 - feat(openai-oauth) OpenAI OAuth multi account support

    • Multi-account OAuth support (though for OpenAI specifically)
  3. PR feat(usage): unified usage tracking with Copilot/Claude auth refresh #9545 - feat(usage): unified usage tracking with Copilot/Claude auth refresh

    • Related to auth refresh and usage tracking capabilities
  4. PR feat(tui): add /usage command and sidebar usage section #9301 - feat(tui): add /usage command and sidebar usage section

    • Related to the opencode auth usage CLI command mentioned in your PR

These PRs appear to overlap with the OAuth Enhancements PR #9972, particularly around multi-account rotation, usage tracking, and authentication refresh functionality.

@mguttmann
Copy link
Author

Thanks for flagging the potential duplicates! Let me clarify the relationship:

Relationship to existing PRs

Unique features in this PR

  1. YOLO Mode - Entirely new feature, not covered by any existing PR
  2. Auto-Relogin Browser Sessions - Puppeteer-based token refresh, not covered elsewhere
  3. Settings UI - Providers tab with full account management (screenshots attached to issue feat: OAuth Enhancements - Multi-Account, YOLO Mode, Auto-Relogin #9971)

Screenshots

See the attached screenshots in issue #9971 showing:

  • Providers tab with rate limit bars
  • Account switching with instant updates
  • YOLO Mode settings section

Happy to adjust scope or coordinate with maintainers on any overlapping functionality!

@mguttmann mguttmann force-pushed the feat/oauth-enhancements branch from dd4dd37 to 9f420f9 Compare January 23, 2026 07:41
Claude Agent added 2 commits January 24, 2026 00:20
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
@mguttmann mguttmann force-pushed the feat/oauth-enhancements branch from 9f420f9 to 41fa182 Compare January 23, 2026 23:21
Claude Agent added 4 commits January 24, 2026 00:47
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
@mguttmann
Copy link
Author

Update - January 24, 2025

Branch rebased and updated to latest dev (v1.1.34). All features tested and working.

Latest Fixes

  • Auth.set() bug fixed: Adding a second OAuth account now correctly creates a new account instead of overwriting the first one
  • Auto-Relogin labels: Renamed account labels now properly display in the Auto-Relogin section
  • Nested button fix: Removed invalid HTML (button inside button) that could cause UI crashes
  • Timeout fixes: Added proper timeout cleanup in finally blocks

All Features Working

  • Multi-account OAuth with auto-rotation on rate limits
  • Account rename (inline UI + CLI)
  • Browser session rebind
  • Auto-relogin with Puppeteer
  • YOLO mode

Ready for review.

Claude Agent added 5 commits January 24, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: OAuth Enhancements - Multi-Account, YOLO Mode, Auto-Relogin

1 participant