[BUG] Symlinks with relative paths not resolved correctly

Resolved 💬 2 comments Opened Jan 26, 2026 by PaulRBerg Closed Jan 27, 2026

What version of Codex is running?

codex-cli 0.91.0

What subscription do you have?

Pro

Which model were you using?

Not model-specific

What platform is your computer?

macOS v26.2

What issue are you seeing?

Codex does not correctly resolve symlinks that use relative paths. The relative path is resolved from the current working directory rather than from the directory where the symlink is defined.

Example setup:

~/.codex/skills -> ../.agents/skills  (relative symlink)
~/.agents/skills/                      (actual target)

When this symlink is evaluated:

  • Expected: Resolve ../.agents/skills relative to ~/.codex/~/.agents/skills
  • Actual: Codex appears to resolve it relative to CWD, which breaks the symlink

Use case:

This pattern is used by dot-agents, a central repository for managing AI agent skills across multiple tools. The setup allows different AI agents (Codex, etc.) to share a single skill library via symlinks:

# Each agent's config dir symlinks to the central location
ln -s ~/.agents/skills ~/.codex/skills
ln -s ~/.agents/skills ~/.cursor/skills
# etc.

This architecture enables:

  • Single source of truth for all skills
  • Easy skill management via the skills CLI (https://skills.sh/)
  • Consistent skill availability across all AI coding assistants

Claude Code handles this symlink pattern correctly; Codex does not.

What steps can reproduce the bug?

  1. Create a central skills directory: mkdir -p ~/.agents/skills
  2. Add a skill to it: mkdir -p ~/.agents/skills/my-skill
  3. Create a relative symlink: ln -s ../.agents/skills ~/.codex/skills
  4. Run Codex in any directory other than ~
  5. Observe that Codex fails to find/load skills from the symlinked directory

What is the expected behavior?

Codex should resolve relative symlinks from the directory containing the symlink, not from the current working directory. This is standard POSIX symlink behavior.

Additional information

The underlying issue is likely in how Codex reads symlinks. When encountering a symlink with a relative target, the resolution should be:

realpath(symlink_dir + "/" + relative_target)

Not:

realpath(cwd + "/" + relative_target)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗