Skip to content
Beta
All articles

Codex CLI 0.169.0: codex exec now needs explicit project trust

Codex CLI 0.169.0 keeps a repository's own config and MCP servers off in untrusted folders during codex exec. What changes for CI and when to use --trust.

By The SpanDock team

4 min read

A diagram of Codex configuration layers in a codex exec run: user and system config always load, while the repository's own .codex layer with its MCP servers, hooks and rules loads only after the project is trusted, now granted explicitly with --trust

Running a coding agent non-interactively is now routine: a CI job checks out a branch, runs codex exec with a task, and reads the result. That job often runs on code nobody has reviewed yet. Codex CLI 0.169.0, released on 13 November 2026, tightens what such a run trusts. In an untrusted directory, codex exec now keeps the repository's own configuration and MCP servers disabled, even when the run has write access with --sandbox workspace-write. Trust has to be granted explicitly with a new --trust flag. For most CI pipelines this is a safer default; for some, it is a behaviour change that will show up as a warning in the logs.

Why project configuration matters

Codex reads configuration from several layers. According to the configuration documentation, personal defaults live in ~/.codex/config.toml, and a repository can add its own .codex/config.toml. Those files can set the default model and provider, approval policies and sandbox settings, and MCP servers. Project files rank above the user's own configuration, so a repository's settings win where they overlap.

That is why Codex loads project .codex/ layers "only when you trust the project". For an untrusted project, it skips project-scoped layers, "including project-local config, hooks, and rules", while user and system configuration still load. An MCP server entry is a command Codex starts, so a repository that can define MCP servers can, in effect, ask the agent's host to run a program.

What changed in 0.169.0

The changelog entry is short: codex exec "keeps project configuration and MCP servers disabled in untrusted directories, even with --sandbox workspace-write", and --trust on codex exec or codex review explicitly saves project trust.

The pull request behind it, #60041, merged on 7 November, gives more detail:

  • In exec runs, untrusted project configuration and MCP servers stay disabled, even with --sandbox workspace-write, and Codex warns when project configuration has been disabled.
  • --trust saves project trust "for the current and future chats, including MCP commands outside the sandbox".
  • The trust grant persists even with --ephemeral, Codex refuses it for projects that are explicitly marked untrusted, and --trust can't be combined with --ignore-user-config.
  • The working directory is now passed as a configuration default, "so embedded server startup does not implicitly grant trust".

Neither the changelog nor the pull request describes exactly what earlier versions did in each case. The wording, "even with" write access and "does not implicitly grant trust", suggests that some non-interactive runs could end up treating a directory as trusted without anyone saying so. We haven't tested older versions, so treat that as a reading of the fix rather than a confirmed description of the old behaviour.

What it means for engineering and security leaders

The important part is the combination: unreviewed code, a non-interactive agent, and configuration that the code itself supplies. A pull request from a fork can add or change .codex/config.toml. If a CI job then runs Codex in that checkout and the project counts as trusted, the pull request decides which MCP servers start and which project hooks and rules apply. The pull request text says trust covers "MCP commands outside the sandbox", so the sandbox setting of the run is not the boundary for those commands.

After 0.169.0, that path needs a deliberate --trust. That moves the decision to where it belongs: the person who writes the workflow file, not the person who opens the pull request.

The same flag exists on codex review, which matters for teams that run automated reviews on incoming pull requests. A review job reads exactly the kind of code you haven't vetted yet, so the reasoning is identical: the repository under review shouldn't get to configure the reviewer.

It also helps to remember what still loads. User and system configuration apply whatever the project's trust, and on managed machines an organisation can enforce constraints through requirements.toml, which the documentation says can, for example, disallow approval_policy = "never" or sandbox_mode = "danger-full-access". Those layers belong to whoever owns the runner, which makes them the right place for settings every job needs.

Two details deserve attention.

  • Trust is saved, not just applied. --trust records trust for future chats, and the grant survives --ephemeral. On a fresh, disposable runner that hardly matters. On a persistent self-hosted runner, a workspace that was trusted once for a main-branch job may stay trusted when a later job checks out different code in the same place.
  • Pipelines that relied on project config will change behaviour. A job that expected the repository's MCP servers or model settings will now run without them and log a warning. The tempting fix is to add --trust everywhere. That restores the old exposure for untrusted code.

Practical takeaways

  • Upgrade CI images to Codex CLI 0.169.0 or later, and pin the version so the behaviour doesn't change under you.
  • Search the job logs for the new warning that project configuration was disabled, to find pipelines that depended on it.
  • Use --trust only for code you already trust, such as jobs on protected branches. Never add it to jobs that run on pull requests from forks or external contributors.
  • Prefer ephemeral runners for agent jobs on untrusted code, since saved trust outlives the run on persistent machines.
  • Move settings you need everywhere into user or system configuration on the runner image, which load regardless of project trust, rather than relying on the repository's .codex/config.toml.
  • Review .codex/ changes like workflow changes. A pull request that adds an MCP server entry is asking to run a program; it deserves the same scrutiny as a change to the CI definition.

For more on Codex's own protections, see credential masking and the network proxy in Codex, and for a related risk with instruction files, the AGENTS.md downloads folder hijack.

Sources

  1. ChatGPT & Codex changelog: Codex CLI 0.169.0 (13 November 2026)
  2. openai/codex pull request #60041: Require explicit project trust in non-interactive runs
  3. Codex documentation: Config basics (project config and trust)
Cookie categories

Details: Cookie Policy.