Skip to content

feat: add --yolo flag to auto-approve all permission requests#20866

Closed
alexsiri7 wants to merge 2 commits intoanomalyco:devfrom
alexsiri7:feat/yolo-flag
Closed

feat: add --yolo flag to auto-approve all permission requests#20866
alexsiri7 wants to merge 2 commits intoanomalyco:devfrom
alexsiri7:feat/yolo-flag

Conversation

@alexsiri7
Copy link
Copy Markdown

Summary

Adds a --yolo CLI flag and yolo config option that auto-approves all permission requests without prompting the user. This is useful for CI/CD pipelines, scripting, and power users who trust their agent setup.

  • CLI flag: opencode --yolo run "do something"
  • Config option: { "yolo": true } in opencode.json
  • Environment variable: OPENCODE_YOLO=1

When enabled:

  • The permission service short-circuits in Permission.ask() before evaluating any rules, returning immediately (auto-approve)
  • The run command auto-approves (instead of auto-rejecting) any permission requests that reach the event loop
  • No pending permission requests are created

Files changed

  • packages/opencode/src/flag/flag.ts -- Added OPENCODE_YOLO flag with dynamic getter
  • packages/opencode/src/index.ts -- Added --yolo CLI option and middleware to set env var
  • packages/opencode/src/config/config.ts -- Added yolo boolean config option, sets env var when config is loaded
  • packages/opencode/src/permission/index.ts -- Short-circuit in ask() when yolo mode is active
  • packages/opencode/src/cli/cmd/run.ts -- Auto-approve (instead of auto-reject) permission requests when yolo is set
  • packages/opencode/test/permission/yolo.test.ts -- 6 tests covering yolo behavior

Closes #20864

Test plan

  • All 6 new yolo tests pass (bun test test/permission/yolo.test.ts)
  • All 86 existing permission tests still pass (bun test test/permission/)
  • TypeScript typecheck passes (bun turbo typecheck)
  • Manual testing: opencode --yolo run "list files" should auto-approve all tool calls
  • Manual testing: setting "yolo": true in config should have the same effect
  • Manual testing: OPENCODE_YOLO=1 opencode run "list files" should auto-approve

🤖 Generated with Claude Code

alexsiri7 and others added 2 commits April 3, 2026 12:32
Adds a --yolo CLI flag and yolo config option that auto-approves all
permission requests without prompting. When enabled, the permission
service short-circuits before evaluating any rules, and the run command
auto-approves (instead of auto-rejecting) any permission requests that
reach the event loop.

Can be activated via:
- CLI flag: opencode --yolo
- Config: { "yolo": true }
- Environment variable: OPENCODE_YOLO=1

Closes anomalyco#20864

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

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

Found several potentially related PRs:

  1. feat(permission): add YOLO mode to auto-approve all permission prompts #11833 - feat(permission): add YOLO mode to auto-approve all permission prompts

    • Directly related - implements similar YOLO mode functionality for auto-approving permission prompts
  2. feat: add --yolo flag for auto-approving permissions in web/serve mode #12684 - feat: add --yolo flag for auto-approving permissions in web/serve mode

    • Directly related - adds --yolo flag but specifically for web/serve mode
  3. feat: add --dangerously-skip-permissions flag #7137 - feat: add --dangerously-skip-permissions flag

    • Related approach - similar goal of bypassing permission requests, but uses different flag name
  4. feat(opencode): auto-approve safe bash commands using tree-sitter classification #20301 - feat(opencode): auto-approve safe bash commands using tree-sitter classification

    • Related - addresses auto-approval but with command classification approach instead of blanket approval
  5. fix: reject permission requests immediately in non-interactive mode #20832 - fix: reject permission requests immediately in non-interactive mode

    • Related context - handles permission request behavior in non-interactive environments

Recommendation: Check PRs #11833 and #12684 first as they appear to have similar or overlapping functionality. Consider whether they were closed/merged and if this PR supersedes them or addresses gaps.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 3, 2026
@github-actions github-actions bot closed this Apr 3, 2026
@jamie-dit
Copy link
Copy Markdown

The AI is broken, At somestage someone will have to merge a yolo mode

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.

Add --yolo flag to auto-approve all permission requests (headless/Docker use)

2 participants