feat: YOLO Mode - Skip All Permission Prompts (CLI + Desktop)#9073
feat: YOLO Mode - Skip All Permission Prompts (CLI + Desktop)#9073mguttmann wants to merge 19 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potential duplicate: PR #7137: feat: add --dangerously-skip-permissions flag This PR appears to be directly related as it implements a Note: PR #6968 mentions "Autonomous Mode" in the documentation context but appears less directly related to the implementation. |
|
Thanks for flagging PR #7137! Comparison of the two implementations:
Summary:
If PR #7137's simpler approach is preferred, the maintainers could merge that instead. However, this PR provides a more complete solution that addresses all related feature requests (#8463, #7928, #1813) with full parity between CLI and Desktop. Happy to consolidate or adjust based on maintainer feedback! |
|
This is such a needed addition IMO, thanks for pushing it! |
|
Update: This feature has been moved to PR #9069 (Multi-Account OAuth) where it logically belongs. See my comment below for details. |
imo not the scope of this pr, should be a different one |
000d521 to
96e2bab
Compare
|
Good catch @iljod! You're absolutely right - the delete account functionality doesn't belong in this PR. I've moved it to PR #9069 (Multi-Account OAuth) where it logically belongs. The delete feature is needed for managing multiple OAuth accounts, not for YOLO mode. Changes made:
This PR now focuses purely on YOLO mode functionality. |
96e2bab to
8a79f4f
Compare
Non-network errors seen in logs: - AI_APICallError (402 deactivated_workspace) - AI_APICallError (500 server_error) - AI_LoadAPIKeyError / OpenAI API key is missing - ProviderInitError - ConfigInvalidError - ProviderAuthOauthCallbackFailed - NotFoundError - EditBuffer is destroyed
- Add getUsage() to fetch OAuth account status and health - Add fetchAnthropicUsage() to fetch Claude Max rate limits from Anthropic API - Add GET /auth/usage endpoint to expose usage data
- Add DialogAuthUsage component with rate limit visualization - Display Anthropic 5-hour and 7-day limits with progress bars - Show OAuth account status, cooldown state, and request counts - Add button in sidebar to open the dialog
- Add AuthUsageCommand to display rate limit info in terminal - Show account status, cooldown state, and request counts - Display Anthropic rate limits when available
The AI SDK's convertToModelMessages() does not accept 'step-start' as a valid UIMessagePart type. This caused AI_InvalidPromptError during session compaction. - Remove step-start from being added to UIMessage parts - Simplify the filter since step-start is no longer included - Fixes compaction breaking sessions with context overflow
Implements comprehensive multi-account OAuth support with automatic rate limit rotation, manual account switching, and a new Settings menu for the desktop app. - Add `Auth.OAuthPool.setActive()` to manually switch active OAuth account - Add `Auth.OAuthPool.snapshot()` returns `activeID` for credential selection - Update `rotating-fetch.ts` to prefer `activeID` while keeping auto-rotation - Update `fetchAnthropicUsage()` to respect `provider.active[namespace]` - Update `getAccounts()` to correctly identify active account - Add `POST /auth/active` endpoint to switch active OAuth account - Returns updated `anthropicUsage` for immediate UI updates - New `DialogSettings` component with tabbed interface - **Providers Tab**: View connected providers, add new providers with search - **Provider Detail View**: Account list, usage stats, switch functionality - **About Tab**: GitHub, docs, Discord links, keyboard shortcuts - Inline provider search without leaving settings context - Add Anthropic Rate Limits section in session context panel - Shows 5-hour, weekly (all models), weekly (sonnet) usage bars - Account switch buttons when multiple accounts configured - Only visible when current session uses Anthropic provider - `opencode auth usage`: Shows individual usage per OAuth account - `opencode auth switch`: Interactive command to switch active account - `opencode auth list`: Shows account count per provider - All provider lists now sorted alphabetically - `packages/opencode/src/auth/index.ts`: Core OAuth pool functions - `packages/opencode/src/auth/rotating-fetch.ts`: Credential selection - `packages/opencode/src/server/server.ts`: API endpoint - `packages/opencode/src/cli/cmd/auth.ts`: CLI commands - `packages/app/src/components/dialog-settings.tsx`: New settings UI - `packages/app/src/components/session/session-context-tab.tsx`: Context panel - `packages/app/src/pages/layout.tsx`: Settings button integration 1. Request uses `activeID` (manually selected or first available) 2. On 429 rate limit → account gets cooldown, moved to back 3. Next request automatically uses next available account 4. Manual switch via UI/CLI updates `provider.active[namespace]` Currently only Anthropic provides OAuth usage statistics. Other providers show multi-account switching but no usage bars. Contributions welcome for additional provider support.
- Add Auth.OAuthPool.removeRecord() to remove individual OAuth accounts - Add DELETE /auth/account API endpoint for Desktop app - Update CLI 'opencode auth logout' to select specific accounts - Add delete button with confirmation in Desktop Provider settings
- Move auth endpoints to provider routes - Add delete account functionality to dialog-auth-usage - Fix duplicate imports in layout.tsx - Fix message-v2.ts convertToModelMessages call - Regenerate SDK types
229b338 to
3d4cedf
Compare
Rebased to latest devThis PR has been rebased to build on top of PR #9069 (Multi-Account OAuth) and adapted to the latest upstream changes. Changes in this update:
Features:
Depends on:
Ready for review! |
YOLO mode allows users to skip all permission prompts for tools and file edits. This is useful for automated workflows or when users fully trust the AI's actions. Features: - --yolo CLI flag for one session - OPENCODE_YOLO=true env var - 'yolo' config option for permanent setting - 'opencode yolo' subcommand for managing YOLO mode - API endpoints: GET/POST /config/yolo - Respects explicit 'deny' rules in permission config Warning: YOLO mode is dangerous and should be used with caution.
3d4cedf to
835a373
Compare
Update: Rebased onto latest dev (v1.1.30+)Branch has been rebased onto the updated #9069 (Multi-Account OAuth). Structure:Features:
Files:
Typecheck passes ✅ | Build passes ✅ Depends on #9069 being merged first. |
- Add YOLO Mode section with Session Only and Always Enabled options - Use original working config.ts approach (separate config.json, no Instance.disposeAll) - Buttons are mutually exclusive as expected - Warning box and CLI usage info included
|
Closing in favor of combined PR with all features (Multi-Account, YOLO Mode, Auto-Relogin) |
Which PR? |
Summary
Comprehensive implementation of YOLO mode that allows users to skip all permission prompts. This addresses multiple community requests (#8463, #7928, #1813) with a complete solution for both CLI and Desktop.
Closes #9070
Features
CLI Support
opencode --yolooropencode --dangerously-skip-permissionsOPENCODE_YOLO=true opencodeopencode yolo status/enable/disableDesktop App Support
New Settings → Danger Zone tab with:
~/.config/opencode/config.jsonConfig File Support
{ "yolo": true }Works in both project-level
opencode.jsonand global~/.config/opencode/config.json.Technical Implementation
packages/opencode/src/yolo/index.ts): Centralized state managementpermission/next.ts): Auto-approves inPermissionNext.ask()when YOLO enabledGET/POST /config/yolofor runtime controldenyrules are still respected even in YOLO modeFiles Changed
packages/opencode/src/yolo/index.tspackages/opencode/src/cli/cmd/yolo.tspackages/opencode/src/permission/next.tspackages/opencode/src/server/routes/config.tspackages/opencode/src/flag/flag.tspackages/opencode/src/config/config.tspackages/opencode/src/index.tspackages/app/src/components/dialog-settings.tsxTesting
Manually tested:
--yoloflagopencode yolocommandsRelated Issues
This PR provides a comprehensive solution that addresses:
--dangerously-skip-permissions(aka YOLO mode) #8463:--dangerously-skip-permissionsflag ✅