Skip to content

feat: add yolo mode to auto-approve permission prompts#240

Merged
anandgupta42 merged 5 commits intomainfrom
feat/yolo-mode
Mar 18, 2026
Merged

feat: add yolo mode to auto-approve permission prompts#240
anandgupta42 merged 5 commits intomainfrom
feat/yolo-mode

Conversation

@anandgupta42
Copy link
Copy Markdown
Contributor

What does this PR do?

Adds --yolo flag to the run command and ALTIMATE_CLI_YOLO / OPENCODE_YOLO env var to auto-approve all permission prompts without interactive confirmation.

  • In headless run mode: auto-approves ("once") instead of auto-rejecting
  • In TUI mode (via env var): auto-approves without rendering the permission prompt
  • Explicit deny rules are still enforced — safety guaranteed by architecture (deny throws before events are published)

Type of change

  • New feature (non-breaking change which adds functionality)

Issue for this PR

Closes #239

How did you verify your code works?

  • bun run build — compiles successfully
  • bun run typecheck — passes
  • bun test — all pre-existing tests pass (13 pre-existing failures unrelated to this change)
  • Manual verification: altimate-code run --yolo "list files" auto-approves permissions

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • New and existing tests pass locally with my changes
  • I have updated documentation accordingly

@claude
Copy link
Copy Markdown

claude bot commented Mar 18, 2026

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

- Add `ALTIMATE_CLI_YOLO` / `OPENCODE_YOLO` env var flag
- Add `--yolo` as global CLI option (works with any subcommand)
- Add `--yolo` on `run` command for convenience
- Auto-approve (`"once"`) instead of auto-reject in headless mode
- Auto-approve in TUI via env var (skip permission prompt rendering)
- Global `--yolo` propagates to env var in middleware so all paths pick it up
- Explicit `deny` rules still enforced (safety by construction)
- Update permissions docs with Yolo Mode section

Closes #239

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment on lines +39 to +41
// altimate_change start - yolo mode: auto-approve all permission prompts
export const ALTIMATE_CLI_YOLO = altTruthy("ALTIMATE_CLI_YOLO", "OPENCODE_YOLO")
// altimate_change end

This comment was marked as outdated.

anandgupta42 and others added 4 commits March 17, 2026 22:38
- CRITICAL FIX: `Flag.ALTIMATE_CLI_YOLO` was a static `const` evaluated at
  module load time. `--yolo` CLI flag sets env var in middleware (after load),
  so the flag was always `false` via CLI. Now uses `Object.defineProperty`
  dynamic getter like other runtime-set flags.
- Add yolo mode handling to ACP agent (`acp/agent.ts`) — was missing,
  causing ACP clients to hang on permission prompts even with `--yolo`
- Replace unsafe `(opts as any).yolo` with `"yolo" in opts && opts.yolo`
- Add 26 adversarial tests covering:
  - Dynamic getter timing (the critical bug)
  - Env var parsing edge cases (empty, arbitrary strings, case)
  - Deny rules cannot be bypassed by yolo (safety by construction)
  - Case sensitivity of deny patterns
  - Multiple ruleset merge precedence
  - Error type distinction (`DeniedError` vs `RejectedError`)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CRITICAL FIX: `Flag.ALTIMATE_CLI_YOLO` was a static `const` evaluated at
  module load time. `--yolo` CLI flag sets env var in middleware (after load),
  so the flag was always `false` via CLI. Now uses `Object.defineProperty`
  dynamic getter like other runtime-set flags.
- Add yolo mode handling to ACP agent (`acp/agent.ts`) — was missing,
  causing ACP clients to hang on permission prompts even with `--yolo`
- Replace unsafe `(opts as any).yolo` with `"yolo" in opts && opts.yolo`
- Add 26 adversarial tests covering:
  - Dynamic getter timing (the critical bug)
  - Env var parsing edge cases (empty, arbitrary strings, case)
  - Deny rules cannot be bypassed by yolo (safety by construction)
  - Case sensitivity of deny patterns
  - Multiple ruleset merge precedence
  - Error type distinction (`DeniedError` vs `RejectedError`)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. **E2E tests** (6 new integration tests):
   - Deny rules throw `DeniedError` even with yolo env var set
   - Allow rules pass without asking (no yolo needed)
   - Ask rules wait for reply, resolved by yolo-style `"once"`
   - Multiple simultaneous permissions all resolved individually
   - Mixed deny + ask: deny throws, ask waits for reply
   - Config-driven permissions: yolo auto-approves `ask`, can't touch `deny`

2. **TUI yolo indicator** — `△ YOLO` warning in footer status bar
   when yolo mode is active, matching existing permission warning style

3. **Minor review fixes:**
   - Remove duplicate `--yolo` option from `run.ts` (inherited from global)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove "subcommand flag" section (duplicate --yolo removed from run.ts)
- Explain WHY deny rules are still enforced (thrown before events)
- Document env var precedence (ALTIMATE_CLI_YOLO overrides OPENCODE_YOLO)
- Mention TUI footer indicator

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anandgupta42 anandgupta42 merged commit f5b5a73 into main Mar 18, 2026
2 checks passed
@anandgupta42 anandgupta42 deleted the feat/yolo-mode branch March 25, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add yolo mode to auto-approve permission prompts

1 participant