Repository navigation
fix(codex-plugin): keep pre-upgrade sessions' hooks working - #5986
oliver-mee wants to merge 1 commit into
Conversation
8306aa1 to
ed4944a
Compare
|
Rebased onto current I hit this again today updating from This keeps interrupting active sessions on plugin updates, so getting this fix reviewed and released would make a big difference. Thanks for taking a look. |
ed4944a to
253e230
Compare
Codex expands ${PLUGIN_ROOT} to the versioned cache directory once per
session and deletes the old version on upgrade (openai/codex#31383), so
every session started before the upgrade fails each hook with
MODULE_NOT_FOUND until restarted.
Each hook run now records its version; a removed older version is
recreated as a link to the running one, and dropped after a week. Codex
only counts real directories as installed versions, so the links do not
affect which version it activates or prunes.
253e230 to
a0cdac7
Compare
Description
Open a Codex session, upgrade the OpenViking plugin, and send another message. The session can start reporting
MODULE_NOT_FOUNDfor OpenViking hooks until it restarts. Codex expands${PLUGIN_ROOT}to the cache directory for the version installed at session start. An upgrade removes that directory while the running session still uses its path. This is the host behavior reported in openai/codex#31383.Each hook now records the installed version that ran it. If an upgrade removed an older recorded path, the first hook from the new version recreates that path as a link to the current build. The next hook in the old session can run again. Codex continues to select and prune real directories as installed versions. Recorded paths expire after seven days without activity.
Human Involvement
Related Issue
Fixes #5985
Type of Change
Changes Made
scripts/cache-heal.mjsfrom all configured hook entrypoints. The helper records numeric cache versions, recreates missing older paths, and expires stale entries.Testing
On the current head
a0cdac744, 207 Codex tests passed on macOS with Node 24. The suite verifies that every configured hook calls the helper. Plugin shared sync and the version checks passed.The upgrade fixture runs the actual
auto-recall.mjsentrypoint. The old hook succeeds before its cache directory is removed, fails withMODULE_NOT_FOUNDafter removal, and succeeds from the same path after one hook runs on the newer version. The original failure was also observed on Linux with Codex CLI 0.162.1. The junction behavior has not been tested on Windows.Checklist
Additional Notes
Recovery starts on a later upgrade. The previous version must already have recorded itself, and a hook from the new version must run before an older session can use the repaired path. The current helper accepts numeric version directories such as
0.11.24.Developed with AI agents, with a human in the loop. Models: Claude Opus 5.5 and GPT-6.2 Sol.