How to Fix codex exec in CI After Codex 0.169.0 Stops Loading MCP Servers
Codex 0.169.0 no longer trusts a fresh checkout in headless runs. Here is how to find broken CI jobs and when passing the trust flag is safe.
On this page 7 sections
Codex CLI 0.169.0 keeps project configuration and MCP servers disabled when codex exec runs in an untrusted directory, even with the workspace-write sandbox. If a CI job stopped loading your MCP servers, the trust flag brings them back. Use it only on repositories you control, and never on code from forks or unreviewed pull requests.
Backtrace tracks the changes in AI coding tools that quietly break pipelines. This guide is for DevOps engineers and platform teams who run codex exec in CI, and for security leads who need to decide when granting that trust is safe.
What Changed in Codex 0.169.0?
Codex 0.169.0 changed how codex exec decides trust. According to the release notes, it keeps project configuration and MCP servers disabled in untrusted directories, even with the sandbox set to workspace-write. A new flag lets you save trust explicitly for codex exec and codex review.
The change landed on November 13, 2026. The 0.169.0 release notes list it under bug fixes. The matching pull request is titled as a requirement for explicit project trust in non-interactive runs, which tells you the intent. A headless run should not assume that a checkout is safe.
The practical effect is easy to miss. A sandbox limits what a command can touch on disk and over the network. Trust answers a different question, which is whether the repository's own configuration is allowed to run at all. It is easy to treat the two as one setting. In codex exec they are now separate, and both codex exec and codex review accept the same flag, so a review job needs the same decision as a fix job.
How to Tell Whether Your CI Job Is Affected
Your job is affected if it runs codex exec in a fresh checkout and depends on the repository's Codex config or its MCP servers. Jobs that rely on no project-defined tools should see little change.
The symptom is quiet. The job still runs and the agent still answers. It just lacks the tools or settings the repo used to supply. A review agent might stop calling the internal documentation server, or a test-fixing agent might ignore the project's instructions.
Check each pipeline in this order.
- Search your workflows for every codex exec and codex review call.
- List which of those jobs rely on repo config or project MCP servers.
- Note whether the job checks out trusted branches or pull request code.
- Run one job on a branch with the new version and compare its tool list.
The symptom is documented. As summarized in a weekly digest of Claude Code, Codex and Gemini CLI changes, a CI job that has stopped loading your MCP servers needs the trust flag.
When Is It Safe to Pass the Trust Flag?
Pass the trust flag only when the code in the checkout is code you wrote or reviewed. It is safe for a protected main branch or a repository your team owns. It is not safe for a pull request from a fork or any branch where an outsider controls the files.
The reason is what the flag does. According to the Developers Digest write-up of 0.169, the flag saves trust for the project and future chats, including MCP commands outside the sandbox. It persists even with the ephemeral option. It does not override a project that was explicitly marked untrusted.
Read that again from an attacker's view. A repository can define an MCP server as a command. If you trust the checkout, that command runs outside the sandbox with your job's permissions. A pull request that edits the project config could then run code on your runner.
This is the same class of problem we covered in our explainer on how a hostile git config runs code through AI coding agents. The file that configures the tool is also a way to run commands. Treat every config file in an untrusted checkout as executable.
The persistence matters too. Because trust saves for future chats, a one-time grant on a shared runner may outlive the job that made it. Use fresh runners, or clear saved trust, so that a later job on the same machine does not inherit it.
How to Update a CI Job Safely
Update the job so that trust is granted by design, not by habit. Split your pipelines by how much you trust the code, and give each one the least access it needs.
- Pin the Codex CLI to a specific version instead of latest.
- Create one job for trusted branches that passes the trust flag.
- Create a separate job for pull request code that never passes it.
- Scope the job's token to the minimum permissions it needs.
- Use ephemeral runners so saved trust does not carry over.
- Log which trust mode each run used.
Pinning matters because this change broke jobs without any edit on your side. A floating version updates the behavior under you. A pinned version lets you read the release notes, test, then move on your own schedule.
Token scope is the second line of defense. If a trusted job is ever tricked into running a bad command, a narrow token limits the damage. Our guide to least privilege access for cloud teams shows how to size those permissions.
Record the trust mode in your job output. A single log line that says whether a run used the flag makes audits and incident reviews much faster. When something odd happens in a pipeline, the first question is what the agent was allowed to run, and the log should answer it.
For the untrusted job, accept the reduced capability. The agent can still read the diff and comment. It just will not run the repo's own tools. If you need a tool in both jobs, define it in configuration your CI controls rather than in a file the pull request can edit.
Are Other AI Coding Agents Tightening Trust Too?
Yes. Other coding agents shipped similar boundary fixes in the same week. The weekly digest reports that Claude Code v2.1.321 fixed four permission and sandbox gaps, and that Gemini CLI v0.68.0 included sandbox and path handling fixes. That is a pattern across vendors, not a one-off from OpenAI.
One of the Claude Code fixes shows the stakes. According to the digest, a copy or move into a directory was not checked against deny rules or the protected-file prompt. The file that was actually written never got the check. If you relied on deny rules to guard a path, that route was open until the fix.
The digest also lists a fix for MCP OAuth requests that sent secrets, such as refresh tokens, to another host when a server redirected them. That is a different bug with the same lesson. Agent tooling sits between your secrets and the network, so every boundary needs a deliberate owner.
Backtrace editors read these changelogs for what gets restricted before what gets added. The pattern across vendors is clear. Defaults are moving from convenient to cautious, and pipelines that assumed the old defaults will need review each time.
Start with an inventory of the agents your team runs in CI. For each, record the version, the config files it reads and the commands those files can launch. Our walkthrough on auditing AI coding agent configs for planted instructions gives you a checklist for that review.
How to Verify the Fix Before You Merge
Verify the change on a branch, with both a trusted and an untrusted case, before you merge it into your default pipeline. A passing trusted job alone proves little, because the point of the change is the untrusted case.
Run three checks and ask a second engineer to review the result. A second pair of eyes matters here because the failure is silent. Nothing crashes when trust is granted too widely.
- The trusted job loads the MCP servers and project config it needs.
- The untrusted job runs without them and still completes.
- A test pull request that edits the project config does not run code.
The third check is the one teams skip. Open a throwaway pull request from a fork-like account that adds a harmless command to the project config. Confirm that the untrusted job ignores it. If it runs, your split is not working, and you should find out before an outsider does.
Keep a note of the result in your pipeline docs. When the next Codex release changes behavior, you will want a baseline that says what a correct run looks like.
Conclusion
Codex 0.169.0 turned an implicit assumption into an explicit choice. A sandbox is not trust, and a headless run should not assume a checkout is safe. Pass the trust flag only for code you control, keep pull request code in a job that never gets it, and pin the version.
Your next step is to search your workflows for codex exec today. Fix the jobs that lost their MCP servers, then add the untrusted-case test so the fix stays honest. Backtrace will report when other agents change their trust defaults.