codex - 💡(How to fix) Fix Codex CLI always uses sandbox [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#18113Fetched 2026-04-17 08:32:41
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2unlabeled ×1

Root Cause

This blocks workflows that require git writes/xcodebuild/network during automated loops, because the process behaves as sandboxed even when launched with unsandboxed/danger-full-access settings.

Code Example

[profiles.unsandboxed]
sandbox_mode = "danger-full-access"
approval_policy = "never"
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

0.121

What subscription do you have?

Plus

Which model were you using?

gpt-5.4

What platform is your computer?

macOS Darwin 25.3.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Terminal.app

What issue are you seeing?

codex exec ignores explicit sandbox override flags.

I run: env -i HOME="$HOME" USER="$USER" SHELL=/bin/zsh PATH="/opt/homebrew/bin:/usr/bin:/bin"
/opt/homebrew/bin/codex -p unsandboxed --sandbox danger-full-access -m gpt-5.4 exec "echo ok"

The command returns ok, but session logs show the resolved sandbox policy is still read-only.

What steps can reproduce the bug?

  1. Run the command above in a normal terminal.
  2. Inspect the session log generated for that run.
  3. In my case: ~/.codex/sessions/2026/04/16/rollout-2026-04-16T11-01-34-019d9586-36be-7d22-90cd-94cb0289e8c3.jsonl
  4. turn_context shows: "sandbox_policy":{"type":"read-only"}

What is the expected behavior?

With -p unsandboxed --sandbox danger-full-access, resolved sandbox policy should be danger-full-access (or at minimum not read-only).

Additional information

This blocks workflows that require git writes/xcodebuild/network during automated loops, because the process behaves as sandboxed even when launched with unsandboxed/danger-full-access settings.

Project is marked as trusted and I have this in config.toml for unsandboxed profile: ``` [profiles.unsandboxed] sandbox_mode = "danger-full-access" approval_policy = "never"

extent analysis

TL;DR

The issue can be resolved by ensuring the codex command correctly applies the specified sandbox policy, potentially by adjusting the configuration or command flags.

Guidance

  • Verify that the config.toml file is being read correctly by the codex command, and that the unsandboxed profile is being applied as expected.
  • Check the documentation for the codex command to ensure that the -p and --sandbox flags are being used correctly, and that they override any default or configured sandbox policies.
  • Inspect the session log to confirm that the turn_context shows the expected sandbox policy, and investigate any discrepancies between the configured and resolved policies.
  • Consider testing the codex command with different sandbox policies and flags to isolate the issue and determine the correct configuration.

Example

No code snippet is provided as the issue is related to command flags and configuration.

Notes

The issue may be specific to the gpt-5.4 model or the Plus subscription, and further investigation may be required to determine the root cause.

Recommendation

Apply workaround: Adjust the command flags or configuration to ensure the correct sandbox policy is applied, as the issue seems to be related to the codex command not respecting the specified sandbox policy.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING