Skip to content

fix(codex): migrate skill to documented user path - #1781

Merged
DeusData merged 14 commits into
DeusData:mainfrom
agn-7:feat/codex-skill-location-compat
Nov 1, 2026
Merged

DeusData merged 14 commits into
DeusData:mainfrom
agn-7:feat/codex-skill-location-compat

Conversation

@agn-7

@agn-7 agn-7 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • install the Codex user skill at the documented $HOME/.agents/skills root while keeping config, hooks, and profiles under $CODEX_HOME
  • migrate byte-identical installer-owned legacy copies from $CODEX_HOME/skills only after the canonical copy is written and verified
  • preserve foreign, modified, linked, or unsafe content unless --force explicitly authorizes replacement
  • cover canonical/legacy reconciliation in plan, dry-run, repeat install, failure, force, and uninstall paths

Rationale

This follows the opportunity recorded when #977 was closed. Current Codex builds discover both $HOME/.agents/skills and $CODEX_HOME/skills, but the public documentation names $HOME/.agents/skills as the user-scoped location. Permanently writing the same named skill to both roots creates duplicate selector entries, so this change converges provably owned installs to one canonical copy instead.

The legacy path is not treated as broken. Unowned legacy content remains in place and prevents creation of a duplicate canonical copy; --force is required to replace and migrate it.

Safety

  • destination publication is verified before owned legacy cleanup
  • cleanup uses the existing exact-content ownership APIs and preserves sibling files
  • equal or same-file roots are deduplicated
  • hook-preflight failures cannot let another shared-root client create a second Codex copy
  • uninstall checks canonical and legacy roots independently and removes only exact-owned content

Verification

  • make -f Makefile.cbm cbm
  • scripts/smoke-test.sh build/c/codebase-memory-mcp --agent-config-only
  • CLI suite: all new Codex tests and the extended preflight regression pass; local aggregate is 286 passed, 1 failed because the host-installed Hermes CLI triggers the pre-existing cli_uninstall_quiesces_active_cohort_before_removing_binary_and_index environment-sensitive failure
  • make -f Makefile.cbm lint-format CLANG_FORMAT=/Library/Developer/CommandLineTools/usr/bin/clang-format
  • security layers pass, including MCP fuzz 32/32 when run outside the filesystem/network sandbox required for local IPC

scripts/lint.sh could not run clang-tidy or cppcheck locally because those executables are not installed; the no-skips and clang-format checks pass.

Related Work

#1739 also introduces cleanup_actions_planned for a separate Codex AGENTS.md cleanup. This PR uses the same receipt field for legacy skill cleanup and does not change AGENTS.md behavior. If #1739 merges first, the resolution is to retain the shared field and both cleanup action types.

Follow-up to #977. Related merged hardening: #1373.

@agn-7
agn-7 requested a review from DeusData as a code owner August 21, 2026 10:58
@github-actions

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

@DeusData DeusData added bug Something isn't working editor/integration Editor compatibility and CLI integration ux/behavior Display bugs, docs, adoption UX security Security vulnerabilities, hardening priority/normal Standard review queue; useful PR with ordinary maintainer urgency. labels Aug 24, 2026
@DeusData

Copy link
Copy Markdown
Owner

Thank you for the detailed ownership and migration work. I checked current main: Codex configuration honors CODEX_HOME, and the installer currently derives the Codex skill directory as $CODEX_HOME/skills; install and uninstall both use that same legacy location. The local migration premise is therefore grounded.

I have labeled this as an editor-integration, UX, and installer-security item and routed it for detailed review. The external Codex path contract and the exact-owned cleanup behavior still need to be verified together before any merge decision, especially because this changes where durable user content is written and removed. The PR is one coherent migration despite its size, so I am not asking for an artificial split at triage. Our review queue is full, and this may take a little time. Thank you for covering plan, dry-run, repeat-install, failure, force, and uninstall paths.

@DeusData DeusData added priority/high Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker. and removed priority/normal Standard review queue; useful PR with ordinary maintainer urgency. labels Sep 5, 2026
@DeusData

DeusData commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Direction confirmed — thank you for doing the homework on this. I re-read Codex's current skills documentation today: the USER scope is $HOME/.agents/skills, $CODEX_HOME/skills is not among the documented locations at all (only ~/.codex/config.toml is, for enabling/disabling), symlinked skill folders are followed, and two same-named skills are both shown rather than merged — which is exactly the duplicate a Codex+Zed/OpenHands/Warp user gets from us today, since main already installs the shared root for those clients. So moving our Codex install to ~/.agents/skills, migrating installer-owned legacy copies, and cleaning both roots on uninstall is the right change, and I verified it on a tree merged with current main: cli 312/312, the six new tests go red with main's cli.c, the Codex block of the smoke passes standalone against the product binary, lint is clean.

Two things before it merges:

  1. Ownership must cover released skill text, not just the current bytes. src/cli/cli.c:7910 judges a legacy $CODEX_HOME/skills/codebase-memory/SKILL.md as installer-owned only if it matches the current skill contents (released_contents=NULL). The skill text changed at v0.10.0 and v0.10.3, and a plain install/update never rewrote an existing skill, so every install older than v0.10.3 is "not installer-owned" under this rule: no migration, a warning on every install (:8046), and — the part that turns a no-op into a regression — the shared-root install for Zed/OpenHands/Warp is skipped (:7823 / :7929), order-dependently. Please accept any previously released skill text as owned (the same released_contents mechanism the hook documents use), and never let an unowned Codex copy block the other clients' install; the copy can simply be left in place with the one warning.

  2. Rebase — main changed all four files since your base (README.md and tests/test_cli.c conflict textually; the cli.c and smoke hunks merge clean). Same PR, same sign-off.

Minor, take or leave: a symlinked skill directory now records an install error (:7875-7908) where main silently skipped; since Codex itself follows symlinked skill folders, treating a symlink whose target is ours as owned would be friendlier.

With those two this merges on green — and it closes a real duplicate-skill annoyance, not just a doc mismatch.

Signed-off-by: Benyamin <benyaminjmf@gmail.com>
Signed-off-by: Benyamin <benyaminjmf@gmail.com>
Signed-off-by: Benyamin <benyaminjmf@gmail.com>
@agn-7
agn-7 force-pushed the feat/codex-skill-location-compat branch from 6c3f52c to 7c88e64 Compare September 15, 2026 07:50
@agn-7

agn-7 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Implemented the requested changes and rebased this branch onto the latest main (2058d49a).

Released-content ownership

  • Audited every consolidated codebase-memory skill release from 0.6.0 through v0.10.8.
  • Added the four byte-distinct released payloads to the installer's released_contents ownership set:
    • 0.6.0 through v0.9.0
    • v0.9.1-rc.1
    • v0.10.0 through v0.10.2
    • v0.10.3 through v0.10.8
  • Exact released payloads now migrate from the legacy Codex path and upgrade in place at the shared path.
  • Modified or otherwise user-owned files remain untouched unless --force is used.
  • Uninstall recognizes and removes exact historical installer-owned payloads as well as the current payload.

Shared-root behavior

  • Removed the global shared-skill suppression. A foreign Codex legacy skill no longer blocks OpenHands, Zed, Warp, or another shared-root client from installing the canonical skill.
  • Migration remains destination-first: the canonical skill is verified before an installer-owned legacy copy is removed.

Verification

  • CLI suite: 326 passed
  • scripts/smoke-test.sh build/c/codebase-memory-mcp --agent-config-only: passed
  • make -f Makefile.cbm security: passed
  • git diff --check: passed

The optional final-directory symlink case is not included, keeping this update focused on the required compatibility and migration behavior.

@agn-7

agn-7 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

CI update: every substantive check passed except test / test-windows-guards.

The failing guard is the exact known section_cold_storm runner race tracked in #2057:

RED: cold-storm client 0 failed (racing daemon spawn):
codebase-memory-mcp: secure CLI coordination could not be created (endpoint)

Failed job: https://github.com/DeusData/codebase-memory-mcp/actions/runs/34943783091/job/104301975858

This branch does not modify daemon coordination, IPC, or tests/windows/test_daemon_stability.py. All three PR smoke jobs (macOS, Ubuntu, and Windows), lint, CodeQL, security, sanitizers, diagnostics, and the complete Unix/Windows matrix otherwise passed.

I attempted a failed-only rerun, but GitHub requires upstream repository write/admin permission. Could a maintainer please rerun the failed jobs for run 34943783091? I have not pushed a no-op commit because #2057 explicitly calls out changing the commit merely to reroll this guard as contrary to the CI-determinism rule.

@DeusData

Copy link
Copy Markdown
Owner

Thank you for addressing the ownership follow-up and removing the shared-root suppression. Those reported changes move this back to maintainer review; they are not being described as an independently completed security review. We need more time to review the current head and attribute its CI results before an integration decision. No further speculative rebase is requested.

@DeusData DeusData left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @agn-7. This is careful, thorough work, and it closes a real duplicate-skill annoyance for every Codex user who also runs Zed, OpenHands or Warp. Both follow-ups landed exactly as asked. We checked the released payloads byte for byte against the skill text in every tag from v0.6.0 through v0.11.0, and they all match, including v0.11.0. That matters because main has changed the skill text again since your base, so your list is what keeps v0.11.0 installs owned after the merge.

The destination-first migration, the exact-owned removal and the independent uninstall of both roots all read correctly. The merged tree is clean against current main, and the memory-core ratchet passes. The only red on the last run is test-windows-guards, which is the known cold-storm race (#2057).

We'll update the branch from our side so CI runs against current main, and it merges on green; nothing further is needed from you. One optional thought for a follow-up: cli_codex_skill_migrates_every_released_legacy_payload loops over production's own list, so a hash-pinned test would also catch a wrong entry. Thanks again!

@DeusData

Copy link
Copy Markdown
Owner

Thank you again, @agn-7 -- this is careful work, and the released-payload list is exactly what keeps every older Codex install owned. We have updated the branch against current main so CI runs on today's tree. The one red on the previous run (a Windows daemon IPC test, daemon_ipc_windows_startup_retries_transient_rendezvous_reader) was a timing defect in that test, not your change; it has since been fixed on main by #2409, and the update brings that fix in. Nothing further is needed from you.

@DeusData

Copy link
Copy Markdown
Owner

Thank you again for the Codex migration work. Our October 20 update records that the branch refresh and upstream Windows test fix are already included, so nothing further is needed from you. Sorry for the delay in the remaining maintainer follow-up—I’ll follow up soon.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

Copy link
Copy Markdown
Owner

Thank you again, @agn-7. We merged the current main into this branch once more so the required checks run against today's tree. It merged cleanly and your change is untouched: the same three commits of yours plus our merge commit. We also re-checked your released-payload list against every tagged release that ships the consolidated skill, v0.6.0 through v0.12.1. Each one matches one of your four payloads or the current text byte for byte, so every existing Codex install stays recognised as installer-owned and migrates safely. If you push to this branch again, please pull first so our merge commit is kept. It merges once the checks are green, and nothing further is needed from you.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

Copy link
Copy Markdown
Owner

Thank you again, @agn-7, for the Codex skill migration. Tonight's merges on main touched README.md: the Codex CLI row in the agent table gained a note about the new PreToolUse graph lookup for Bash searches, in the same cell where your change names the ~/.agents/skills path. We merged current main into the branch once more (signed-off merge commit 994432f) and kept both edits in that row. The rest of your changes is untouched. Nothing is needed from you. If you push to this branch again, please pull first so the merge commit is kept.

README agent table: keep main's Claude Code row (drift note) and this
branch's Codex CLI row (skill path + PreToolUse).

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

Copy link
Copy Markdown
Owner

Thank you for your patience, @agn-7. This evening main gained a drift-note hook, which changed the Claude Code row of the agent table in README.md right next to your Codex CLI row, so the two conflicted. We merged current main into your branch (one merge commit, 848975f) and kept both: main's Claude Code row and your Codex CLI row with the ~/.agents/skills path. The rest of your change is untouched. We will merge once the fresh checks are green; please pull before pushing again.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

Copy link
Copy Markdown
Owner

Thank you for your patience, @agn-7. A pull request that merged into main a few minutes ago (#2290) changes src/cli/cli.c, which this pull request also changes, so the CI run in progress here could no longer vouch for today's main. We merged current main into your branch once more (one merge commit, ea2dbaa; it merged cleanly and your own change is untouched) and started a fresh run. We will merge once the required checks are green. Please pull before pushing again.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

Copy link
Copy Markdown
Owner

Thank you for your patience, @agn-7. Main has moved since the last CI run on this branch, and some of the new commits change README.md, which this pull request also changes, so that run can no longer vouch for today's main. We merged current main into your branch (one merge commit, 9cbc350; it merged cleanly and your own change is untouched) and started a fresh run. We will merge once the required checks are green. Please pull before pushing again.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

Copy link
Copy Markdown
Owner

Thank you for your patience, @agn-7. The macOS legs of the last CI run here were cancelled by GitHub itself: it is retiring its macOS 14 runners on November 2 and ran scheduled brownouts beforehand, so those jobs never got a runner. Nothing in your change caused it. Main now runs CI on macOS 15 (#2849), so we merged current main into your branch (one merge commit, 2418526; it merged cleanly and your own change is untouched) to get a run on the new runners. Please pull before pushing again.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

DeusData commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thank you for your patience, @agn-7. Your change was green, but pull requests merged since its run touch src/cli/cli.c and tests/test_cli.c, which this pull request also changes, so that run could no longer vouch for today's main. We merged current main into your branch (no conflicts, your own change is unchanged) to get a fresh CI run on the combined tree. Please pull before pushing again. We will merge as soon as the required checks are green.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData
DeusData merged commit f29e74f into DeusData:main Nov 1, 2026
34 checks passed
@DeusData

DeusData commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Merged as f29e74f - thank you, @agn-7! This moves the Codex skill to the documented ~/.agents/skills location, migrates every previously installed copy safely, and ends the duplicate skill entry that Codex users who also run Zed, OpenHands or Warp were seeing. The care you put into the destination-first migration and the complete released-payload list is what made this safe to ship. Thank you for seeing it through all the way from #977.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working editor/integration Editor compatibility and CLI integration priority/high Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker. security Security vulnerabilities, hardening ux/behavior Display bugs, docs, adoption UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants