624 words
3 minutes

Codex --approve-for-me: Keep Auto Review Inside a Workspace-Write Sandbox

2026-08-08
AI
Codex
/
AI
/
CLI
/
Troubleshooting

Codex 0.147.0 adds --approve-for-me, but the name is easy to overread. It routes eligible approval requests through automatic review; it does not turn the session into an unrestricted shell. The sandbox policy still decides which files, commands, and network actions are allowed.

For a low-friction project session, make that boundary explicit:

Terminal window
codex --sandbox workspace-write --approve-for-me

This gives the reviewer a workspace-write policy to evaluate against. It is materially different from bypassing both approvals and the sandbox.

Separate the approval reviewer from the sandbox#

Codex exposes two controls that answer different questions:

ControlQuestion it answersSafe way to reason about it
--sandbox workspace-writeWhat can the session change without leaving the workspace boundary?Keep it explicit for repository work.
--ask-for-approval on-requestWho should decide when an action needs approval?Use it when a human should remain in the loop.
--approve-for-meCan eligible approval requests go through automatic review?Use it only when the task and workspace are already trusted.
--dangerously-bypass-approvals-and-sandboxShould both guardrails be bypassed?Treat it as a separate, high-risk mode.

The new flag changes the reviewer path, not the filesystem boundary. If a prompt or script needs access outside the workspace, automatic review does not make that request harmless; it changes how an eligible request is evaluated.

The official Codex sandboxing documentation describes the approval policies and sandbox modes. Read those settings together instead of treating “approve” and “sandbox” as synonyms.

Verify that the installed CLI supports the flag#

Release availability and the binary installed on a machine can differ. Check the local help and version before adding the flag to a shared script:

Terminal window
codex --version
codex --help | rg -- '--approve-for-me|--sandbox|--ask-for-approval'

If --approve-for-me is absent, update the CLI through the package or distribution channel used by that environment. Do not silently replace it with an unrestricted bypass flag just to make the command start.

For a human-reviewed session, omit the new flag and keep the approval policy visible:

Terminal window
codex --sandbox workspace-write --ask-for-approval on-request

The exact default policy can depend on the invocation context and configuration, so a team script should state the intended mode rather than rely on an inherited setting.

Handle non-interactive commands separately#

The Codex 0.147.0 release also removes the deprecated codex exec --full-auto path. For a scripted exec task, use the documented sandbox option instead of carrying the old alias forward:

Terminal window
codex exec --sandbox workspace-write "Run the repository's read-only checks and summarize failures."

That command still needs a task-appropriate policy. workspace-write permits the kind of repository edits many coding tasks require, but it does not mean that a script should be allowed to modify deployment credentials, system files, or unrelated directories. Keep destructive operations out of unattended prompts and review the exact command before adding automatic approval.

Add a small safety check to team workflows#

Before enabling automatic review in CI or a shared development script, record the intended boundary in the command or wrapper:

Terminal window
set -euo pipefail
codex --sandbox workspace-write --approve-for-me \
"Inspect the current workspace, make only the requested source changes, and run the listed tests."

The wrapper should also define the working directory, avoid passing secrets in the prompt, and keep generated output inside a disposable checkout when the task is not fully trusted. Automatic review is a convenience for predictable work; it is not a substitute for narrowing the prompt or protecting the repository.

FAQ#

Does --approve-for-me disable Codex’s sandbox?#

No. The sandbox mode remains a separate control. Pair the flag with an explicit policy such as --sandbox workspace-write, and do not confuse it with --dangerously-bypass-approvals-and-sandbox.

Is --approve-for-me the replacement for codex exec --full-auto?#

Not exactly. The release removes the deprecated exec --full-auto path and documents --sandbox workspace-write for that workflow. --approve-for-me controls automatic review for eligible approvals; it does not define the full sandbox policy.

Why does the flag work on one machine but not another?#

The installed CLI versions or configuration may differ. Run codex --version and search the local help output before assuming that a shared wrapper is portable.

References:

Codex 0.147.0 release notes

Codex sandboxing

Codex CLI reference

Codex --approve-for-me: Keep Auto Review Inside a Workspace-Write Sandbox
https://laplusda.com/en/posts/codex-cli-approve-for-me/
Author
Zero
Published at
2026-08-08
License
CC BY-NC-SA 4.0
Was this article useful?

Report a typo or broken link, or suggest a related topic.