Symlinked ~/.codex/rules/default.rules is ignored when ~/.codex/rules is a real directory

Open 💬 1 comment Opened Apr 1, 2026 by Epokhe

What version of Codex CLI is running?

0.118.0

What subscription do you have?

plus

Which model were you using?

_No response_

What platform is your computer?

_No response_

What terminal emulator and version are you using (if applicable)?

_No response_

What issue are you seeing?

Rules are loaded when ~/.codex/rules/default.rules is a real file, and also when ~/.codex/rules itself is a symlinked directory.

But if ~/.codex/rules/ is a real directory and default.rules inside it is a symlink to another file, Codex appears to ignore the rules entirely.

This looks very similar to the older prompts symlink issue:

  • #3637
  • fixed by #3643 / commit fff576cf9

I am not very familiar with the codebase, but I traced this locally with codex and the rules loader seems to still use the pre-fix pattern that prompt loading used to have.

What steps can reproduce the bug?

  1. Create a valid rules file somewhere outside ~/.codex/rules, for example:
prefix_rule(pattern=["git", "-C", "/Users/me/some-repo", "add", "README.md"], decision="allow")
  1. Create ~/.codex/rules/ as a real directory.
  1. Create ~/.codex/rules/default.rules as a symlink to that real rules file.
  1. Start a fresh Codex CLI session.
  1. Run a command that should match the rule. For example:
codex exec -C /Users/me/some-repo -c 'approval_policy="never"' 'Run exactly this command and nothing else: git -C /Users/me/some-repo add README.md If it succeeds, reply with exactly OK. If it fails, reply with exactly FAIL: followed by the main error message.'
  1. Observe that the rule is ignored and the command is denied, for example with:
fatal: Unable to create '/Users/me/some-repo/.git/index.lock': Operation not permitted

For comparison:

  • If ~/.codex/rules/default.rules is a real file, the same rule works.
  • If ~/.codex/rules itself is a symlinked directory containing a real default.rules, the same rule also works.

What is the expected behavior?

_No response_

Additional information

I also prepared a minimal fix on my fork for comparison, but I cannot open a PR because PR creation is restricted to collaborators on this repo:

I am not familiar with the codebase, so I just tried to mirror the earlier prompt symlink fix.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗