cd /news/ai-agents/codex-config-toml-approvals-sandbox-… · home › topics › ai-agents › article
[ARTICLE · art-182462] src=besydr.com ↗ pub= topic=ai-agents verified=true sentiment=· neutral

Codex config.toml: approvals, sandbox, and the rules they do not keep

A benchmark of OpenAI's Codex coding agent found it broke rules stated in earlier sessions 49 times across 128 requests, according to the post's own testing, with that figure falling to 3 times when Besydr, a program that runs alongside the agent and learns from its sessions, was used. The post details how Codex's ~/.codex/config.toml controls the model, the approval_policy setting (on-request, never, or a granular table) and the sandbox_mode setting (read-only, workspace-write, or danger-full-access), noting that approval_policy = "untrusted" is retired and can prevent Codex from starting. Even in workspace-write mode, the .git, .agents, .codex and .aws paths stay read-only recursively, and network access is off inside the sandbox unless sandbox_workspace_write.network_access is enabled.

recommendation

Set approval_policy = "on-request" with sandbox_mode = "workspace-write" and keep network_access off, since the post measured 49 rule breaks in 128 Codex requests despite config-level controls.

more in playbook: Working with AI coding agents
by read5 min views5 publishedDec 5, 2026
Codex config.toml: approvals, sandbox, and the rules they do not keep
Image: Besydr (auto-discovered)

Codex config.toml sets three things that shape every session: the model, the approval policy that decides when Codex stops to ask you, and the sandbox that decides what its commands may touch. None of the three holds a rule you stated in words. This post walks the file, the settings that matter, and the gap they leave: in our Codex benchmark, Codex broke rules from earlier sessions 49 times in 128 requests, and 3 times with Besydr, a program that runs beside the agent and learns from its sessions.

Where the Codex config file lives #

Codex reads user-level configuration from ~/.codex/config.toml. A project can add overrides in .codex/config.toml, and for security Codex loads a project's .codex/ layers only when you trust the project. The CLI and the IDE extension share the same layers. The config basics page has the locations; the full reference lists every key.

An annotated config.toml #

A minimal Codex CLI config that keeps the default posture explicit:

approval_policy = "on-request"  # when Codex s to ask you
sandbox_mode = "workspace-write" # what its commands may touch

The file also picks the model and provider; the config reference lists the keys. The two settings shown are the core safety controls of the file, and they answer different questions.

Approval policy #

The Codex approval policy decides when the agent s for a human before running a command:

  • on-request : commands the sandbox allows run without approval; Codex asks when it wants to go beyond the sandbox, such as editing outside the workspace or reaching the network.
  • never : no approval prompts at all. This is what running Codex "full auto" means in practice: the agent works without asking, and the sandbox still decides what it can do. The flag form is--ask-for-approval never or-a never , and it combines with every sandbox mode.
  • A granular table, approval_policy = { granular = { ... } } , keeps some prompt categories interactive while automatically rejecting others.

One migration note: approval_policy = "untrusted" is retired and can prevent Codex from starting. The approvals and security page gives the replacement: sandbox_mode = "read-only" with approval_policy = "on-request" for interactive read-only use, or a per-project entry that preserves the stricter command-approval rule.

Sandbox modes #

The Codex sandbox is an OS-enforced limit on what executed commands can touch, independent of approvals:

Mode What commands may do
read-only Read files; no writes
workspace-write Read and write inside the workspace; edits outside it need approval
danger-full-access No sandbox limits

Even in workspace-write, protected paths stay read-only: .git (including a pointer file's resolved git directory), .agents, .codex and .aws, recursively. Network access is off by default in the sandbox; sandbox_workspace_write.network_access turns it on. Codex also supports named permission profiles — the built-ins are :read-only, :workspace and :danger-full-access — for reusable filesystem and network policies.

Common combinations #

The documentation names three postures:

Intent Flags or config Effect
Auto (the default preset) no flags, or --sandbox workspace-write --ask-for-approval on-request Reads, edits and commands in the workspace; approval outside it or for network
Safe read-only browsing --sandbox read-only --ask-for-approval on-request Reads and read-only commands; anything beyond can require approval
Full access --sandbox danger-full-access , or--dangerously-bypass-approvals-and-sandbox Reads, edits, commands and network without prompts

Pick the posture per task, not per machine: read-only for exploring an unfamiliar repository, the Auto preset for work you review, full access only where a container is the boundary.

What none of these settings does #

A sandbox answers "may this command touch that file". An approval policy answers "must it ask first". Neither answers "is this what the developer asked for". Codex rules you state in words live in AGENTS.md or in chat, and the Codex benchmark measured what happens to them: they are advice, and advice decays across sessions.

Of 128 requests, five projects Codex alone With Besydr
Rules from an earlier session broken 49 3
Corrections the developer typed 60 25

The config file cannot close that gap because it has no key for your sentences. A study of 20,574 coding-agent sessions (Tang et al., EMNLP 2026) found constraint violations in 49.49% of pushback episodes in CLI sessions — the kind of session Codex runs.

Besydr closes the gap in two ways. It learns rules from your corrections and repeats them in later requests; the benchmark attributes the rule retention above to that learning. And it adds the missing check through Codex's own hooks: a call that conflicts with your words can be denied, with your sentence as the reason. Two honest limits from the client documentation: Codex runs a hook only after you review and trust it in /hooks, and Codex's own documentation says its hooks are not a complete enforcement boundary, so a denied call is a strong default, not a guarantee. The benchmark post has every number and the AGENTS.md details; the local program is free with octomind and needs a licence with Codex after a trial.

Sources and method #

── more in #ai-agents 4 stories · sorted by recency
── more on @openai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/codex-config-toml-ap…] indexed:0 read:5min 2026-12-05 · —