You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
apply the same protection to RLCR stop-hook codex exec / codex review, /humanize:ask-codex, and BitLesson selection
keep the dev branch compatibility fixes while preserving hook recursion protection
extend tests so nested Codex argv is checked for modern and legacy hook feature names
sync the PR branch with dev and keep plugin version metadata at 1.17.0
Root Cause
Humanize already tried to prevent Stop-hook recursion by launching nested Codex with --disable codex_hooks. That covered older Codex builds where the native hook feature was named codex_hooks.
Recent Codex builds expose hook features under stable names such as hooks and plugin_hooks. In those builds, disabling only codex_hooks may not disable the active native/plugin hook paths. When Humanize's Stop hook launches a nested codex exec or codex review, that nested Codex process can load the same Stop hook again, which can re-enter the RLCR loop during review.
At the same time, some older supported Codex builds expose --disable but reject unknown feature names. Passing every known feature unconditionally can make nested codex exec / codex review fail before doing useful work.
Fix
When the installed Codex CLI supports --disable, Humanize now probes each known hook feature name before using it:
hooks
plugin_hooks
codex_hooks
Only supported feature names are passed as repeated --disable <feature> arguments. This keeps compatibility with older codex_hooks builds while also disabling the currently active hook feature names in newer Codex builds.
The same protection is applied to ask-codex.sh and bitlesson-select.sh, since both are nested helper-style Codex invocations and can otherwise inherit the caller's hook environment.
The reason will be displayed to describe this comment to others. Learn more.
Probe feature names before disabling them
When the installed Codex is an older supported build that has --disable but only knows the codex_hooks feature, this unconditional list makes every nested codex exec/codex review fail before it can do any work. Codex v0.114 already exposes --disable and validates each feature name, but its registry key is codex_hooks and does not include hooks or plugin_hooks, so the new probe passes and the subsequent invocation errors with an unknown feature. Please probe codex features list/feature support or fall back per feature instead of treating --disable support as support for all names; the same copied pattern in ask-codex.sh and bitlesson-select.sh needs the same guard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
codex exec/codex review,/humanize:ask-codex, and BitLesson selectiondevbranch compatibility fixes while preserving hook recursion protectiondevand keep plugin version metadata at1.17.0Root Cause
Humanize already tried to prevent Stop-hook recursion by launching nested Codex with
--disable codex_hooks. That covered older Codex builds where the native hook feature was namedcodex_hooks.Recent Codex builds expose hook features under stable names such as
hooksandplugin_hooks. In those builds, disabling onlycodex_hooksmay not disable the active native/plugin hook paths. When Humanize's Stop hook launches a nestedcodex execorcodex review, that nested Codex process can load the same Stop hook again, which can re-enter the RLCR loop during review.At the same time, some older supported Codex builds expose
--disablebut reject unknown feature names. Passing every known feature unconditionally can make nestedcodex exec/codex reviewfail before doing useful work.Fix
When the installed Codex CLI supports
--disable, Humanize now probes each known hook feature name before using it:Only supported feature names are passed as repeated
--disable <feature>arguments. This keeps compatibility with oldercodex_hooksbuilds while also disabling the currently active hook feature names in newer Codex builds.The same protection is applied to
ask-codex.shandbitlesson-select.sh, since both are nested helper-style Codex invocations and can otherwise inherit the caller's hook environment.Validation
bash -n hooks/loop-codex-stop-hook.sh scripts/bitlesson-select.sh scripts/ask-codex.sh tests/test-disable-nested-codex-hooks.sh tests/test-bitlesson-select-routing.sh tests/test-ask-codex.shbash tests/test-disable-nested-codex-hooks.shbash tests/test-bitlesson-select-routing.shbash tests/test-ask-codex.shgit diff --check