Codex --yolo mode: what it turns off, and where to run it

Last updated

What --yolo turns off, and where to run it

Codex by default

Codex's own OS sandbox

--yolo

--yolo in a flockvm VM

its own kernel

Codex by default A command from the agent

By default, "the agent runs with network access turned off". In a git repository, Codex recommends its Auto preset: workspace-write with on-request approvals.

Codex by default Approval policy

When Codex stops to ask you. With on-request, the model asks when it needs to: Codex asks before it edits outside the workspace or uses the network.

Codex by default Sandbox

What commands can touch: read-only, workspace-write or danger-full-access. In workspace-write, .git, .codex, .agents and .aws inside the workspace stay read-only.

Codex by default Your machine

Codex edits and runs commands in the workspace. A write to .git/hooks runs code after the session ends: workspace-write keeps .git read-only, --yolo doesn't.

--yolo A command from the agent

The flag turns off both of Codex's controls at once: it never asks before running a command, and it runs commands outside Codex's own OS sandbox, with full disk and network access.

--yolo Your machine

Without approvals and without a sandbox, Codex can do anything your user can do on that machine. Environment variables, .env files, ~/.ssh, cloud credentials and the Codex login in ~/.codex are all readable, and the network is open.

--yolo in a flockvm VM A command from the agent

No approvals and no sandbox, where OpenAI says to use the flag: "only inside an externally hardened environment".

--yolo in a flockvm VM The key in the VM

On flockvm, outbound IPv4 is open, and flockvm v1 has no per-VM egress allowlist and no secrets proxy. So the Codex login or API key in the VM can still leave with a followed injection: use one you can revoke.

--yolo in a flockvm VM A disposable VM

A VM on another machine is the "externally hardened environment" in its simplest form: the agent can wreck the VM, not your laptop, and you delete it afterwards.

--yolo in a flockvm VM Your laptop

Your laptop's files, keys and other projects aren't there, and each flockvm VM has its own kernel and can't reach the others.

What stands between a command the agent runs and your machine. Hatched: what the agent can reach. OpenAI's Codex documentation, checked on 5 November 2026.

Codex's YOLO mode is one flag:

codex --yolo

--yolo is the alias of --dangerously-bypass-approvals-and-sandbox. It turns off both of Codex's controls at once: it never asks before running a command, and it runs commands outside Codex's own OS sandbox, with full disk and network access. OpenAI's docs mark it "not recommended" and say to use it "only inside an externally hardened environment". The safe way to get the speed is to make that environment a machine you can throw away. Below: the flag, what replaced --full-auto, the config, what OpenAI says, and how to run it in a VM.

Quick answer

You want Run
No prompts, no sandbox (YOLO) codex --yolo, same as codex --dangerously-bypass-approvals-and-sandbox
The same, non-interactive codex exec --yolo "<task>"
No prompts, sandbox kept codex --sandbox workspace-write --ask-for-approval never
Fewer prompts, reviewed by a model codex --approve-for-me
YOLO as a saved profile approval_policy = "never" and sandbox_mode = "danger-full-access" in ~/.codex/yolo.config.toml, then codex --profile yolo

Checked on 5 November 2026 against OpenAI's developer commands, approvals and security and configuration reference pages, and Codex CLI 0.166.0 from npm. --yolo doesn't appear in codex --help in that version, but both codex --yolo and codex exec --yolo accept it, and OpenAI's command reference lists it.

What --yolo turns off

Codex keeps two controls apart, and the flag removes both:

  • The approval policy (--ask-for-approval, -a): when Codex stops to ask you. The flag takes on-request (the model asks when it needs to) or never; Codex 0.166.0 rejects untrusted and on-failure there. In config.toml, approval_policy = "untrusted" is no longer supported and on-failure is deprecated.
  • The sandbox (--sandbox, -s): what commands can touch. read-only, workspace-write or danger-full-access.

By default, OpenAI says, "the agent runs with network access turned off". In a git repository, Codex recommends its Auto preset, workspace-write with on-request approvals: it edits and runs commands in the workspace, and asks before it edits outside it or uses the network. In workspace-write, .git, .codex, .agents and .aws inside the workspace stay read-only.

--yolo drops all of that. When the flag was added in June 2025 (PR #1384), it set the never approval policy and the full-access sandbox together, so that commands run "without any sandbox" and you are never prompted. OpenAI's security page sums it up as "No sandbox; no approvals". Two side effects: with --yolo, web search defaults to live results instead of OpenAI's cache, and since Codex 0.90.0, codex exec --yolo skips the check that you are inside a git repository instead of failing.

The CLI's own help text for the long flag (0.166.0): "EXTREMELY DANGEROUS. Intended solely for running in environments that are externally sandboxed".

--full-auto vs --yolo

They were never the same thing, and only one is left.

  • --full-auto was the low-friction mode with the sandbox. OpenAI deprecated it in Codex 0.128.0 (30 April 2026): in the interactive CLI it "just resolves to the default permissions", so it was removed there (PR #20133). Codex 0.147.0 (7 August 2026) removed it from codex exec too, with the advice "use --sandbox workspace-write instead". In Codex 0.166.0, both codex --full-auto and codex exec --full-auto fail with unexpected argument '--full-auto'.
  • --yolo is still there, and removes the sandbox as well as the prompts.

If an old script or tutorial uses --full-auto, replace it with --sandbox workspace-write, plus --ask-for-approval never if nobody will be there to answer. Don't replace it with --yolo: that gives the agent more than the old flag did.

Codex 0.147.0 also added a middle option, --approve-for-me (alias --not-so-yolo). OpenAI describes it as "automatic approval review with on-request approvals and the workspace-write sandbox": the sandbox stays, and approval requests go to an automatic reviewer instead of you. It can't be combined with --sandbox or --yolo. Automatic review uses extra model calls, so it can add to your Codex usage.

Prompts and sandbox, flag by flag

Prompts and sandbox, flag by flag
FlagPromptsSandbox
--full-auto (removed)The low-friction modeStrength: Kept
--sandbox workspace-writeSkipped with --ask-for-approval neverStrength: Kept
--approve-for-meAnswered by an automatic reviewer instead of youStrength: Kept
--yoloNone: it never asksGap: Removed
OpenAI's command reference and the Codex CLI from npm, checked on 5 November 2026. --full-auto was deprecated in Codex 0.128.0 (30 April 2026) and removed from codex exec in 0.147.0 (7 August 2026); its replacement is --sandbox workspace-write.

Set it in config.toml

There is no yolo key. The two settings the flag combines live in ~/.codex/config.toml:

# ~/.codex/config.toml: the default for every session (not recommended)
approval_policy = "never"
sandbox_mode    = "danger-full-access"

A safer pattern is a profile you choose on purpose. Profile files sit next to config.toml as $CODEX_HOME/<name>.config.toml, and --profile <name> (-p) layers one on top of your config:

# ~/.codex/yolo.config.toml
approval_policy = "never"
sandbox_mode    = "danger-full-access"
codex --profile yolo

For no prompts with the sandbox kept, and network on, use this instead:

# ~/.codex/unattended.config.toml
approval_policy = "never"
sandbox_mode    = "workspace-write"

[sandbox_workspace_write]
network_access = true

A project's own .codex/config.toml only loads once you trust that project. OpenAI documents --sandbox danger-full-access and the bypass flag side by side as the way to run "with network access without approval prompts", and adds: "Use caution before doing so."

What OpenAI says about it

In OpenAI's own words, across its docs and the CLI:

  • The security page's table: "No sandbox; no approvals (not recommended)".
  • The command reference: "Only use inside an externally hardened environment", and for codex exec, "only use inside an isolated runner".
  • On prompt injection: it "can cause the agent to fetch and follow untrusted instructions". Treat web results as untrusted.
  • On containers: when Codex's Linux sandbox can't start inside Docker, OpenAI says to make the container the isolation boundary and run Codex with --sandbox danger-full-access or the bypass flag inside it. But even then, "a malicious project can exfiltrate anything available inside the devcontainer, including Codex credentials", so use it only with trusted repositories.

So the question is not whether to use --yolo, but where. The box has to keep the agent away from your files, and you have to assume anything inside the box can leave.

What can go wrong

Without approvals and without a sandbox, Codex can do anything your user can do on that machine:

  1. Destruction: a wrong rm, a git reset --hard, a migration run against the wrong database.
  2. Secret leaks: environment variables, .env files, ~/.ssh, cloud credentials and the Codex login in ~/.codex are all readable, and the network is open.
  3. Prompt injection: an issue, a README or a live web result can carry instructions, and nothing stops a command it suggests.
  4. Persistence: a write to .git/hooks or ~/.bashrc runs code after the session ends. workspace-write keeps .git read-only; --yolo doesn't.

Run it in a disposable VM

A VM on another machine is the "externally hardened environment" in its simplest form: the agent can wreck the VM, not your laptop, and you delete it afterwards. On flockvm, each task gets its own Firecracker microVM in France, with Codex preinstalled on the Agent image.

  1. Create a VM from your laptop:

    flockvm vm create codex-1 --size default --wait
    
  2. SSH in. You log in as user, which has passwordless sudo:

    flockvm vm ssh codex-1
    
  3. Sign Codex in, inside the VM. The VM has no browser, so use device code login, codex login --device-auth (beta; turn on device code login in your ChatGPT security settings first), and finish it in your laptop's browser. Or use an API key: printenv OPENAI_API_KEY | codex login --with-api-key, with a project key that has a spend limit. API key usage is billed at OpenAI's API rates.

  4. Clone with a deploy key scoped to one repository, then run the task in tmux so it survives a dropped connection:

    tmux new -s codex
    codex --yolo
    

    Or non-interactive: codex exec --yolo "fix the failing tests and commit".

  5. Pause or delete the VM when the work is done, and revoke the key if anything looked wrong:

    flockvm vm pause codex-1       # keep it, memory included
    flockvm vm delete codex-1 --yes
    

The full setup, from the deploy key to choosing the approval mode, is in the Codex docs. To run several tasks at once, one VM each, see Codex parallel tasks. For a company rollout, with keys you can revoke, a locked requirements.toml and Codex in GitHub Actions, see Codex CLI for enterprise teams.

What the VM does and doesn't stop. Your laptop's files, keys and other projects aren't there, and each VM has its own kernel and can't reach the others. Outbound IPv4 is open, except private ranges, cloud metadata, other VMs, the host and SMTP port 25, and flockvm v1 has no per-VM egress allowlist and no secrets proxy. So the Codex login or API key in the VM can still leave with a followed injection: use one you can revoke.

Claude Code's equivalent

Claude Code's flag is --dangerously-skip-permissions, the bypassPermissions mode. It removes the prompts but leaves Claude Code's built-in /sandbox on if you enabled it, refuses to run as root, and still honors deny rules. Every way to turn it on, and what still applies, is in Claude Code's --dangerously-skip-permissions.

When flockvm is the wrong pick

  • You just want fewer prompts on your laptop. Keep the sandbox: --sandbox workspace-write --ask-for-approval never, or --approve-for-me. That is often enough for code you trust, and costs nothing extra.
  • You want OpenAI to host it. OpenAI's security page describes Codex Cloud as running "in isolated OpenAI-managed containers", with nothing for you to set up.
  • Your team already standardizes on dev containers. OpenAI documents that pattern, with its caveat about credentials, and it keeps everything on your machine.

flockvm fits when you want --yolo speed on code you don't fully trust, without your laptop involved, or many tasks at once, each in its own VM, billed per second. Start your 7-day free trial: card required, nothing charged for 7 days.

Where to get the speed

What do you want?

Fewer prompts on your laptop

Keep the sandbox

Use --sandbox workspace-write --ask-for-approval never, or --approve-for-me. That is often enough for code you trust, and costs nothing extra.

Read that part

OpenAI to host it

Codex Cloud

OpenAI's security page describes Codex Cloud as running "in isolated OpenAI-managed containers", with nothing for you to set up.

What your team already uses: dev containers

A dev container

OpenAI documents that pattern, with its caveat about credentials, and it keeps everything on your machine. Use it only with trusted repositories.

Read that part

--yolo speed on code you don't fully trust

A disposable VM

Without your laptop involved, or many tasks at once, each in its own VM, billed per second: that is where flockvm fits.

Read that part

The cases of this section, one pick each.

FAQ

What is Codex YOLO mode?

Running Codex with --yolo, the alias of --dangerously-bypass-approvals-and-sandbox: no approval prompts and no sandbox. OpenAI marks it "not recommended" outside an externally hardened environment.

Is --yolo the same as --full-auto?

No. --full-auto kept the sandbox and was removed (deprecated in 0.128.0, gone from codex exec in 0.147.0). --yolo removes the sandbox too. The replacement for --full-auto is --sandbox workspace-write.

How do I set YOLO mode in config.toml?

There is no single key: set approval_policy = "never" and sandbox_mode = "danger-full-access". Put them in a profile file such as ~/.codex/yolo.config.toml and start with codex --profile yolo, so it is never your default by accident.

Does --yolo work with codex exec?

Yes: codex exec --yolo "<task>". OpenAI's reference says to use it "only inside an isolated runner".

Does Codex have network access in YOLO mode?

Yes. Without the sandbox, commands reach the network like any other program on the machine, and web search uses live results. By default, without --yolo, network access is off.

Is there a middle ground between prompts and --yolo?

Two. --sandbox workspace-write --ask-for-approval never keeps the sandbox and skips the prompts. --approve-for-me keeps the sandbox and lets an automatic reviewer answer approval requests.

Run your agents in their own microVMs

flockvm gives each coding agent a Firecracker microVM that pauses with its memory and resumes, billed per second. France is live, and you can start with a 7-day free trial.

Start your 7-day free trial

Card required. Nothing charged for 7 days.