A project hook reported as persisted and trusted runs in codex exec without a dangerous trust-bypass flag, and the bypass flag is documented as something that should remain an explicit opt-in.
TL;DR: The--trustflag incodex execgrants explicit permission for project-level config files and MCP servers to load in directories not marked trusted by the user. Without it, CLI 0.169.0 blocks repo-level configuration in untrusted directories as a deliberate security response to a disclosed prompt-injection vulnerability.
Key Takeaways
- Untrusted directories block config loading: CLI 0.169.0 refuses to read project config or activate MCP servers in any directory not explicitly trusted.
--trustgrants explicit trust: Pass it tocodex execorcodex reviewto restore config and MCP server loading.- Sandbox is not the same as trust:
--sandbox workspace-writerestricts writes; it does not unlock project config. The two controls are independent. - CI scripts cloning repos need immediate updates: Add
--trustwith documented intent, or strip repo config before invoking Codex. codex reviewinherits the same trust model: Audit both command invocation paths.
Introduction
If you upgraded to CLI 0.169.0 and ran codex exec against a cloned external repo, your AGENTS.md customizations and MCP server definitions are now silently absent, with no error and no stack trace. Understanding why requires separating two concepts that were easy to conflate before this release: trust and sandboxing.
The --dangerously-bypass-hook-trust flag's documented existence confirms that hook-trust enforcement predated 0.169.0. What changed is that the trust decision, previously implicit, is now yours to make consciously.

What does --trust do, what does it not do, and how does it differ from --dangerously-bypass-hook-trust?
--trust grants permission to load project config and MCP servers from the current directory, while --dangerously-bypass-hook-trust overrides hook-execution trust only. They are independent controls that operate on separate enforcement layers.
Passing --trust marks the working directory as trusted for that invocation, restoring AGENTS.md loading and MCP server activation for both codex exec and codex review. Trust and sandboxing remain separate: --sandbox workspace-write restricts disk writes and says nothing about whether project config is safe to load.
Table 1: Codex exec flag comparison, trust vs. sandbox vs. hook-bypass
| Flag | Controls | Scope | Risk if misused |
|---|---|---|---|
--trust | Project config + MCP server loading | Full directory config surface | Loads adversarial AGENTS.md or MCP definitions |
--dangerously-bypass-hook-trust | Hook execution only | Hook dispatch layer | Runs hooks without user review |
--sandbox workspace-write | Filesystem write access | Disk writes only | Does not restrict config loading |
Even with a directory marked trusted in config.toml, codex exec has a documented bug where user hooks do not fire, confirming that trust and hook dispatch are distinct layers. --dangerously-bypass-hook-trust overrides the dispatch layer only and does not restore AGENTS.md loading.
How do you safely update CI pipelines that run codex exec against cloned third-party repositories?
Passing --trust without additional controls against a third-party repo is equivalent to executing arbitrary instructions from it. As a practical rule of thumb used in this guide: strip repo config before invoking Codex against genuinely untrusted sources, or use --trust only against repositories your organization controls.
Pattern 1, Strip-and-run (genuinely untrusted repos): Delete AGENTS.md and MCP server definition files before invoking codex exec. Run without --trust. You lose repo-level customization but avoid executing instructions from sources you don't control. This is the right pattern for third-party CI workflows.
Pattern 2, Explicit-trust (controlled repos): If your pipeline clones repos from known, audited sources such as internal forks or vendor repos your security team reviews, --trust is a reasonable explicit acknowledgment of risk. Document it inline with a comment naming the specific trust decision, and never use --trust as a default across all jobs.
Audit checklist (author synthesis): Search CI scripts for every codex exec and codex review invocation. Flag any running against directories not owned by your organization. Decide strip-and-run or explicit-trust per pipeline, and document the decision inline.

What does the hook-trust gap reveal about Codex's security model?
The trust UI gap that 0.169.0 addresses is not an isolated oversight in this release. Codex does not display any prompt asking users to review and trust hooks when a session is first created, a systemic gap documented independently of this change.
Both the hook-trust gap and the --trust flag change surface the same underlying issue: trust decisions in Codex were previously implicit or invisible to the user. The 0.169.0 release converts that invisible default into a decision engineers must make explicitly and document deliberately. Pipelines that appeared to work before 0.169.0 may have been running on bare Codex defaults, with every AGENTS.md and MCP server definition silently skipped. The change gives teams a clear signal to audit their invocations rather than interpret silence as success.
Frequently Asked Questions
Why is codex exec ignoring my AGENTS.md file after upgrading to 0.169.0? CLI 0.169.0 explicitly blocks AGENTS.md and MCP server loading in any directory not marked trusted. Add --trust for org-owned directories, or use the strip-and-run pattern for third-party repos.
Does --sandbox workspace-write enable project config loading in codex exec? No. Sandbox mode and trust are separate controls. --sandbox workspace-write restricts filesystem writes only; you need --trust independently to restore config loading.
What is the difference between --trust and --dangerously-bypass-hook-trust in codex exec? --trust unlocks project config and MCP server loading for a directory. --dangerously-bypass-hook-trust overrides hook dispatch only and does not restore AGENTS.md loading. They control separate enforcement layers.
How does the hook-trust gap relate to the --trust flag change? Both surface the same underlying issue: trust decisions in Codex were previously implicit or invisible. The --trust flag forces pipelines to make an explicit, documented trust decision rather than rely on undocumented default behavior.
Conclusion
CLI 0.169.0 did not introduce a new restriction. It made an existing one visible. Pipelines that appeared to work before may have been running on bare Codex defaults, with every AGENTS.md and MCP server definition silently skipped.
Audit every codex exec and codex review invocation in CI. For each one running against a directory your organization does not own, choose strip-and-run or explicit-trust and document the rationale inline. --trust is an attestation of a deliberate decision, not a general-purpose safety mechanism.
Learn from me

Claude Code in Practice, my Maven cohort. Master Claude Code from fundamentals to advanced orchestration: skills, subagents, hooks, MCP, and production automation. Join the next cohort →
Hire us
Traversaal.ai. We're a team of forward deployed engineers solving the toughest AI problems for Fortune 100 companies: document intelligence, agentic data platforms, and real-time web intelligence, deployed in production. Work with our team to deploy your next agentic ecosystem. Talk to Traversaal.ai →
Join us
Want to solve these problems with us? We're always looking for forward deployed engineers who want to ship production AI. jobs@traversaal.ai
