Skip to content

fix(setup): load the upgrade hook in Codex - #1836

Merged
potiuk merged 1 commit into
mainfrom
fix/codex-setup-hook
Oct 26, 2026
Merged

potiuk merged 1 commit into
mainfrom
fix/codex-setup-hook

Conversation

@potiuk

@potiuk potiuk commented Oct 25, 2026

Copy link
Copy Markdown
Member

Codex never ran magpie-setup's session-start upgrade check, so Codex users were never told that Magpie had changed.

Why

  • plugins/magpie-setup/ had no Codex manifest, so Codex read its hooks/hooks.json.
  • That file's $schema and modules keys are for Claude Code mods, and Codex's strict hooks-file schema (HooksFile, deny_unknown_fields) rejects them. No hook loaded, and every start logged a parse warning. magpie-utilities produced the same warning.
  • The root .codex-plugin/plugin.json hook re-pointed in fix: correct drift found by the spec sync; setup welcome, Subversion layer, Codex hook #1829 lacked the inline hooks wrapper, so Codex ignored it. The root plugin is also not in the Codex catalogue.

Fix

  • magpie-setup and magpie-utilities get a complete .codex-plugin/plugin.json that points at a clean hooks/codex-hooks.json. Codex prefers that manifest over .claude-plugin/, and Claude Code ignores it.
    • magpie-setup's hook runs /bin/bash -p "${PLUGIN_ROOT}/hooks/check-upgrade.sh" on startup.
    • magpie-utilities's hook file is empty.
  • The root manifest's hook is removed.
  • check-family-plugins.py
    • generates and pins both files, including the version;
    • fails any plugin in the Codex catalogue whose Codex-visible hooks file has keys other than description and hooks, which catches this class of bug;
    • drops the old root CODEX_HOOKS check.
  • test_session_hook.py now covers the Codex wiring too: the /bin/bash -p form, and a bash on PATH is never run.
  • docs/setup/marketplace.md and the check-upgrade.sh header describe the wiring, and that Codex runs a plugin hook only after the user reviews and trusts it in /hooks.
  • setup uninstall names Codex's real verb, codex plugin remove <plugin>@apache-magpie.

Checks

  • Live check against codex 0.154.0 through the app server's hooks/list:
    • before this change: no hooks, and two unknown field `$schema` warnings;
    • after: one sessionStart hook from codex-hooks.json, no warnings, untrusted until reviewed.
  • Not yet tested: a model session actually firing the hook. To check it, install from the marketplace, trust the magpie-setup hook in /hooks, start a new session, and look for the Magpie upgrade notice.
  • check-family-plugins.py, the tools/dev and setup-preflight tests, claude plugin validate --strict on both plugins, and prek run --all-files pass. The exception is 3 vetted-ops tests that fail only inside the agent sandbox; the commit hook ran them outside it.

The pending spec-sync PR records this as a known gap; the next sync will drop it.


Generative AI disclosure: drafted with Claude Code (Claude Opus 5) and reviewed by the committer.

🤖 Generated with Claude Code

Codex never ran magpie-setup's session-start upgrade check. With no
Codex manifest, Codex read the plugin's hooks/hooks.json, whose
`$schema` and `modules` keys (Claude Code mods) its strict hooks-file
schema rejects, so no hook loaded and every start logged a parse
warning; magpie-utilities hit the same warning. The root
.codex-plugin hook #1829 re-pointed lacked the inline `hooks` wrapper,
so Codex ignored it, and no catalogue installs the root plugin.

- magpie-setup and magpie-utilities get a complete
  .codex-plugin/plugin.json pointing at a clean hooks/codex-hooks.json;
  magpie-setup's runs check-upgrade.sh as `/bin/bash -p` on startup,
  magpie-utilities' is empty.
- The root manifest's hook is removed.
- check-family-plugins generates and pins both files and fails any
  Codex-catalogued plugin whose Codex-visible hooks file has keys other
  than `description` and `hooks`.
- The session-hook tests cover the Codex wiring; the marketplace docs
  describe it and Codex's /hooks trust step; uninstall names Codex's
  real `plugin remove` verb.

Checked live with codex 0.154.0's app-server `hooks/list`: the hook
loads from codex-hooks.json with no warnings, untrusted until reviewed.

Generated-by: Claude Opus 5
@github-actions github-actions Bot added family:setup setup-* skills family:tools tools/* family:docs Docs, MISSION.md, READMEs family:ci .github workflows, prek, validators capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) family:utilities utilities skills substrate:framework-dev Tool substrate: build / validate / eval the framework itself substrate:setup Tool substrate: adopter-side setup state resolved at runtime (lock parsing, floors, fingerprints) labels Oct 25, 2026
@potiuk
potiuk merged commit a7c18e9 into main Oct 26, 2026
12 checks passed
@potiuk
potiuk deleted the fix/codex-setup-hook branch October 26, 2026 00:00
potiuk added a commit that referenced this pull request Oct 28, 2026
* docs(spec-loop): sync specs with contributed functionality

Back-fill the specs for the 46 commits since the last sync that changed
behaviour without touching a spec: the public-surface scrub mod (#1676),
adapter hardening (#1862), the hook managers with install strategy
`none` (#1838), Linux `allowAllUnixSockets` and its socket cover (#1809),
the touch-overlay dismissal and matcher (#1832, #1833), the per-family
Codex manifests (#1836), Vulnogram reviewer comments (#1840), the verify
false-pass fixes (#1808), gateway refusal hints (#1810), adversarial-review
output and agy fixes (#1852, #1854, #1871), and code-review inline comment
text (#1853).

Also correct drift found on the way: the threat-model pointer now names
Appendix B after the #1859 restructure, the troubleshooting catalogue has
fourteen entries, and the overview's Mentoring and Pairing skill counts
match docs/modes.md.

Generated-by: Claude Opus 5

* docs(marketplace): magpie-security ships its own Codex manifest too

#1676 gave magpie-security a .codex-plugin/plugin.json and an empty
hooks/codex-hooks.json, because its hooks.json now carries a Claude Code
mod, but the "Which manifest Codex reads" table and the Hooks paragraph
still named only magpie-setup and magpie-utilities.

Generated-by: Claude Opus 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) family:ci .github workflows, prek, validators family:docs Docs, MISSION.md, READMEs family:setup setup-* skills family:tools tools/* family:utilities utilities skills substrate:framework-dev Tool substrate: build / validate / eval the framework itself substrate:setup Tool substrate: adopter-side setup state resolved at runtime (lock parsing, floors, fingerprints)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant