Codex is not able to write to repo root .agents directory

Resolved 💬 4 comments Opened Feb 12, 2026 by vincentmorneau Closed Feb 13, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What issue are you seeing?

I've moved all my agent and skill files under my repo root directory at $REPO_ROOT/.agents/ as recommended by https://developers.openai.com/codex/skills.

Now I can't ask Codex to edit those files. It's stuck and spins in circle. Must have something to do with permissions on . directories.

It starts working when I set the sandbox_mode = "danger-full-access" but that is not desirable.

What steps can reproduce the bug?

Relevant config.toml properties

approval_policy = "never"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]
network_access = true

[shell_environment_policy]
inherit = "all"
ignore_default_excludes = false

What is the expected behavior?

Codex should be able to edit my skills.

Additional information

  • macOS Tahoe 26.2
  • codex --version : codex-cli 0.98.0

View original on GitHub ↗

4 Comments

etraut-openai contributor · 6 months ago

Sandbox policies prevent files within .agents subdirectories from being written without user approval. Allowing an agent to update its own instructions represents a security issue, so it's important that all such modifications are done with express consent from the user.

The issue is that you've specified approval_policy = "never", which means that all such approvals will be automatically disallowed.

vincentmorneau · 6 months ago

That makes sense, thank you. I changed my approval policy and now Codex is able to edit the .agents files, albeit with lots of manual approvals. As the author of those .agents files for a large enterprise, it can be a bit of an inconvenience to have to manually approve edits as we augment our instructions and skills.

Am I doing this right?

Feel free to close the issue.

souljorje · 4 months ago

@vincentmorneau you can add this to your local .codex/config.toml to make .agents it writable

[sandbox_workspace_write]
writable_roots = [
  "<absolute path to the project>/.agents",
]
youngjoel · 21 days ago

The absolute path in writable_roots is a show stopper. This is a PROJECT level decision. If someone checks out the repo, they should get the policy for that repo, not have to magically figure out an absolute path and edit the writable_roots.