OpenAI Codex · tool · fg-0603

codex exec in an untrusted directory ignores project config and MCP servers even with --sandbox workspace-write

If you see MCP servers defined in the project's .codex/config.toml are not started under codex exec, the cause and the fix for OpenAI Codex are below, last verified 2026-11-13.

Verified Nov 2026trust 50/100
Symptom
MCP servers defined in the project's .codex/config.toml are not started under codex execProject-level settings have no effect in codex exec after upgrading to 0.169.0Passing --sandbox workspace-write does not change which project config is loaded
Cause
As of 0.169.0, codex exec keeps project configuration and MCP servers disabled in directories that are not trusted. Choosing a sandbox mode no longer implies trust, so a script that relied on workspace-write to pick up project config now runs without it.
Fix
Mark the project as trusted explicitly by passing --trust to codex exec or codex review, which saves project trust. Alternatively trust the directory once in an interactive session before running automation.
Apply
codex exec --trust --sandbox workspace-write "your task here"
Affected
Codex CLI 0.169.0 and later, for codex exec and codex review in directories not yet trusted
Sources

Last verified 2026-11-13 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun