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

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
@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!

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
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