openai / openai/codex

Allow individual `prefix_rule` entries to require human approval while keeping `approvals_reviewer = "auto_review"` enabled globally

Open
#44,780 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI config enhancement sandbox
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI

What feature would you like to see?

I want automatic review for most actions, but want to manually approve every
SSH, rsync, and SCP command because they access remote servers and may transfer
sensitive data.

My current configuration:

approvals_reviewer = "auto_review"

prefix_rule(
    pattern = [["ssh", "rsync", "scp"]],
    decision = "prompt",
    justification = "Remote access requires manual approval",
)

The matching commands still go through auto-review instead of prompting me.
The justification does not enforce human review.

## Proposed behavior

Support an optional reviewer override:

prefix_rule(
    pattern = [["ssh", "rsync", "scp"]],
    decision = "prompt",
    reviewer = "user",
    justification = "Remote access requires manual approval",
)

- Without an override, use the globally configured reviewer.
- With reviewer = "user", require explicit human approval for each invocation.
- If multiple rules match, a human-review requirement should take precedence
  over automatic review; forbidden should still block execution.

- Shell-wrapper handling should preserve the requirement whenever Codex
  identifies a matching command inside a compound command.

## Current limitation

In codex-cli 0.153.4, adding reviewer = "user" fails with:

> Found reviewer extra named parameter(s) for call to prefix_rule

Switching the global reviewer to user disables automatic review for all other
actions. An instruction in AGENTS.md to ask first is not equivalent to an
enforced approval gate.

### Additional information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how prefix_rule entries are parsed and how approvals_reviewer is selected for matching CLI commands. Check the existing handling of prompt, auto_review, forbidden, and compound shell commands. Done means an optional reviewer override is accepted, human review takes precedence over automatic review for matching rules, forbidden still blocks execution, and relevant tests cover these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.