Checked: 2026-11-16 JST. Scope: codex-cli 0.169.0 (released 2026-11-13), macOS, isolated runs without authentication. Release notes, same-tag source, and local help were checked the same day.
In Codex CLI 0.169.0, codex exec disables untrusted project configuration and the MCP servers defined there. --sandbox workspace-write does not change that. When a script or CI job loses project MCP, check the configuration location and project trust; use --trust only for a repository you have reviewed.
Takeaways: distinguish project
.codex/config.tomlfrom user configuration.--trustpersists for later runs, even with--ephemeral. It does not override explicituntrusted. Review MCP startup commands before trusting a checkout.
Why does codex exec skip MCP or project configuration?
The official 0.169.0 release describes keeping project configuration and MCP disabled in untrusted directories. We checked PR #60041 and same-tag source. For basic non-interactive usage, see our codex exec guide at 0.163.0.
This chiefly concerns MCP from project configuration. In our untrusted cases, user-configured MCP and MCP passed with CLI -c still started. Reading this as disabling every MCP server would misdiagnose those cases. The official MCP documentation also limits project .codex/config.toml to trusted projects. The non-interactive documentation we fetched did not describe this version's --trust behavior, so we prioritized the pinned release, source, and help. Fetching the changelog Markdown failed.
Which trust states let project MCP start?
We ran these 12 cases once each without authentication. U0 means no saved trust; T1 means trusted; X1 means explicit untrusted. The middle 0/1 in the ID means without/with --trust. yes/no indicates a startup marker and saved trusted state. A saved yes for T1 can be an existing record, not a new write.
| Case ID | project MCP started | trusted saved | Exit code |
|---|---|---|---|
| U0-0-read-only | no | no | 1 |
| T1-0-read-only | yes | yes | 1 |
| X1-0-read-only | no | no | 1 |
| U0-0-workspace-write | no | no | 1 |
| T1-0-workspace-write | yes | yes | 1 |
| X1-0-workspace-write | no | no | 1 |
| U0-1-read-only | yes | yes | 1 |
| T1-1-read-only | yes | yes | 1 |
| X1-1-read-only | no | no | 1 |
| U0-1-workspace-write | yes | yes | 1 |
| T1-1-workspace-write | yes | yes | 1 |
| X1-1-workspace-write | no | no | 1 |
The two X1 + --trust runs failed with an instruction to update the trust setting first. The other ten ended with an unauthenticated model API request returning 401. Exit code 1 does not mean the task succeeded. We measured only MCP startup and configuration persistence before authentication. A harmless project setting, model = "trust-probe-model", appeared in the startup banner under the same trust conditions as MCP.
Where does --trust save trust, and does it persist?
The same-tag exec source resolves the user configuration path for trust persistence. With our default layout, it wrote the following to CODEX_HOME/config.toml. The normal default without a custom CODEX_HOME is ~/.codex/config.toml.
[projects."/absolute/path/to/repo"]
trust_level = "trusted"This illustrates the saved format, not a blanket trust policy. Run codex exec --trust "review this local task" only inside a reviewed repository. If you do not know why a project was explicitly marked untrusted, leave the setting in place.
What about --ephemeral and subdirectories?
--trust --ephemeral still saved trust. The next run started project MCP without --trust. A subdirectory of a trusted repo also worked. See Claude Code and Codex worktree setup for worktree preparation; we did not measure trust sharing across multiple worktrees.
| Auxiliary case | Observation |
|---|---|
| user / A1: user MCP, untrusted project | user MCP started; project MCP did not |
| CLI / A2: CLI -c MCP, untrusted project | CLI MCP started; project MCP did not |
| ephemeral / A3: --trust --ephemeral | started; saved trust |
| subdir / A4: subdirectory of trusted repo | started; used saved root trust |
| non-git / A5: non-git + --skip-git-repo-check, no trust / --trust | no startup / started and saved trust (2 runs) |
| review / A6: codex review --trust | started; saved trust |
| repeat / A7: --trust then another run without the flag | both started; trust retained (2 runs) |
There were nine auxiliary executions. The non-git directory also contained .codex/config.toml; do not generalize that case to every directory without configuration. codex review --trust was checked only for pre-authentication startup and persistence.
Can --sandbox workspace-write replace trust?
No. Neither read-only nor workspace-write started untrusted project MCP in our tests. Trust decides whether project configuration can be used; sandbox settings constrain execution. Help explicitly includes MCP commands outside the sandbox in the trust grant. Our dummy MCP could also write outside the fake repo but inside scratch. That is an auxiliary observation affected by the enclosing execution environment.
Related reading: Claude Code sandboxed Bash and unattended runs separates sandbox from approval. Inline MCP startup and folder trust covers the Claude Code side. These products do not have identical behavior.
How should scripts and CI diagnose this?
- Check
codex --versionagainst the tested version, 0.169.0. - Check the process's
CODEX_HOMEand the target path'strust_level. Do not dump complete settings or secret values into logs. - Locate the MCP definition: user configuration, CLI overrides, or project configuration. Claude Code MCP configuration explains the configuration-location distinction, but use this article's paths for Codex.
- Use
--trustonly after reviewing the repository and MCP startup commands. Do not automatically trust third-party forks. Moving MCP to user configuration or CLI arguments still requires reviewing the command that will run.
| Symptom | Check | Action |
|---|---|---|
| Only project MCP is missing | project trust and configuration location | trust only a reviewed repo |
| workspace-write makes no difference | sandbox versus trust | inspect trust separately |
| --trust is rejected | explicit untrusted | review the reason for that setting |
| A later run disables it again | CODEX_HOME and persistence | check whether the saved location changed |
| User MCP also fails | server-specific settings and errors | do not assume project trust is the cause |
What did we compare, and what remains untested?
The compare API between 0.168.0 and 0.169.0 included the fix's merge commit. We did not run the 0.168.0 binary. We did not adopt social posts' claims about older versions launching outside the sandbox.
We measured 12 main + 9 auxiliary = 21 executions on macOS with 0.169.0, excluding three P0 checks. Runs used a fake HOME and per-case CODEX_HOME, with no credentials or authentication. Only a dummy stdio MCP, with no networking or child commands of its own, was configured. The HOME-side canary MCP never started. Unauthenticated API requests occurred; successful model responses numbered zero.
Post-authentication tool lists and actual use, Linux, Windows, real CI runners, managed configuration, and interactive TUI were not measured. We checked only the existence of candidate system/managed paths, not their contents. This does not prove absence of every managed source. The 36-case exhaustive trust oracle is a finite specification model, not 36 measured CLI executions.
What are the frequently asked questions?
Why does codex exec skip project MCP?
In 0.169.0, project configuration is disabled in untrusted directories. In our isolated tests, project MCP did not start when project trust was unset.
Where does --trust save trust?
In our cases it saved trust_level = "trusted" under [projects."absolute path"] in CODEX_HOME/config.toml. It also applied to the next run.
Is --sandbox workspace-write enough?
No. In our 0.169.0 tests, an untrusted project MCP did not start with workspace-write either.
Does --ephemeral prevent trust from being saved?
Trust is saved even with --ephemeral. Session persistence and project trust persistence are separate. We checked the help text and measured this behavior.
Should every CI run include --trust?
Only use it after reviewing the checkout and MCP startup commands. Do not automatically trust third-party forks. We did not test a real CI runner.
Does --trust override explicit untrusted?
No. Our test returned an error asking us to update the trust setting first, and MCP did not start. Review why the project was marked untrusted before changing it.
Go deeper on this topic
SaaS integrations
Give AI the context to continue the work: source conversations, open tasks, and unresolved details, from adoption decisions to integration code.
Article 13 of 23 in this series.
Next reads
codex exec: stdin, JSONL, Sandboxes and Exit Codes Tested
Seven Codex CLI 0.163.0 probes cover stdin, stdout/stderr, JSONL, schema output, read-only, workspace-write and resume, with a documentation-based claude -p comparison.
AGENTS.md Security in Downloads: Claude Code and Codex Tested
Test Claude Code 2.1.312 and Codex 0.163.0 outside Git with harmless canaries, noninteractive trust limits and a read-only configuration inventory.
One SKILL.md for Claude Code and Codex: Paths and Startup Cost
Tested Claude Code 2.1.312 and codex-cli 0.163.0 in a temporary HOME: SKILL.md paths, startup description cost, and symlinks. Automatic selection and real turns are untested.
Use the topic hub as a map, then continue to the next article in the series. New here? Start at the home hub →
FAQ
Why does codex exec skip project MCP?
In 0.169.0, project configuration is disabled in untrusted directories. In our isolated tests, project MCP did not start when project trust was unset.
Where does --trust save trust?
In our cases it saved trust_level = "trusted" under [projects."absolute path"] in CODEX_HOME/config.toml. It also applied to the next run.
Is --sandbox workspace-write enough?
No. In our 0.169.0 tests, an untrusted project MCP did not start with workspace-write either.
Does --ephemeral prevent trust from being saved?
Trust is saved even with --ephemeral. Session persistence and project trust persistence are separate. We checked the help text and measured this behavior.
Should every CI run include --trust?
Only use it after reviewing the checkout and MCP startup commands. Do not automatically trust third-party forks. We did not test a real CI runner.
Does --trust override explicit untrusted?
No. Our test returned an error asking us to update the trust setting first, and MCP did not start. Review why the project was marked untrusted before changing it.