[BUG] sync-codex-skills.py: --validate walks the sources, so an orphaned symlink in .codex/skills/ is never seen
Bug Description
create_symlinks() and validate_symlinks() both iterate the discovered
skills and look up the matching entry in .codex/skills/. Neither reads the
target directory. A symlink left behind there by an earlier sync generation is
visited by neither function: it survives every run, and --validate reports
success.
The sync workflow runs on every push touching a SKILL.md and calls the
script with --validate. It has been green with a dangling symlink in the
tree.
Affected Skill
Skill Name: n/a
Component: scripts/sync-codex-skills.py, validate_symlinks() / create_symlinks()
To Reproduce
On 527a1b8:
$ python scripts/sync-codex-skills.py --validate > /dev/null; echo $?
0
$ find .codex -type l ! -exec test -e {} \; -print
.codex/skills/dsh-deepread
$ readlink .codex/skills/dsh-deepread
../../research/dsh-deepread
$ git ls-files | grep dsh-deepread
.codex/skills/dsh-deepreadThe source is in no path of the tree. Counting the whole directory against what the sync discovers:
discovered skills (unique names) 350
symlinks in .codex/skills/ 374
orphans 24
22 x -> ../../c-level-agents/skills/* (resolve; see the SKILL_DOMAINS issue)
1 x playwright-pro -> ../../engineering-team/playwright-pro
(resolves, but has no SKILL.md; the sync discovers its 10
sub-skills individually)
1 x dsh-deepread (dangles)Codex loads .codex/skills/ by directory, so both of the last two are shipped
and neither can be loaded.
Expected Behavior
--validate fails on a symlink in .codex/skills/ that no discovered skill
claims.
Actual Behavior
Exit 0, nothing reported, for any number of orphans.
Environment
- OS: macOS 15 (Darwin 25.6.0)
- Python: 3.14.7
- Ref:
origin/dev527a1b8
Additional Context
The 22 c-level-agents links are the reason a fix must not simply delete every
unclaimed link: on 527a1b8 that would delete 22 working ones. Removal is
only safe where nothing can be lost: the link dangles, or there is no
SKILL.md behind it. An unclaimed link that does resolve to a real skill is
the signature of a SKILL_DOMAINS gap and belongs in the report, not in the
bin. PR follows.
Source: alirezarezvani/claude-skills