Bug
/codex:setup --enable-review-gate appears to succeed, but the Stop hook never enforces the gate.
Root cause
resolveStateDir() in scripts/lib/state.mjs (L29-44) picks the state directory based on CLAUDE_PLUGIN_DATA:
const pluginDataDir = process.env[PLUGIN_DATA_ENV];
const stateRoot = pluginDataDir
? path.join(pluginDataDir, "state")
: FALLBACK_STATE_ROOT_DIR; // os.tmpdir() + "codex-companion"
The setup command runs via Bash (invoked by Claude), where CLAUDE_PLUGIN_DATA is not set → writes stopReviewGate: true to the temp directory.
The Stop hook runs via Claude Code's hook system, where CLAUDE_PLUGIN_DATA is set → reads from the persistent plugin data directory, which still has the default stopReviewGate: false.
Evidence
# Temp dir (written by setup) — gate enabled
/var/folders/.../codex-companion/feat-emoji-<hash>/state.json
→ { "config": { "stopReviewGate": true } }
# Persistent dir (read by hook) — gate still disabled
~/.claude/plugins/data/codex-openai-codex/state/feat-emoji-<hash>/state.json
→ { "config": { "stopReviewGate": false } }
Suggested fix
The setup subcommand in codex-companion.mjs should resolve the persistent plugin data directory the same way hooks do. Options:
- Have the skill pass
CLAUDE_PLUGIN_DATA as an env var when invoking the setup Bash command.
- Have
codex-companion.mjs setup detect ~/.claude/plugins/data/codex-openai-codex/ as a fallback when CLAUDE_PLUGIN_DATA is unset.
- Write to both directories during setup so either reader finds the correct value.
Environment
- Claude Code (CLI)
- codex-plugin-cc v1.0.1
- codex-cli 0.117.0
- macOS Darwin 25.4.0
Bug
/codex:setup --enable-review-gateappears to succeed, but the Stop hook never enforces the gate.Root cause
resolveStateDir()inscripts/lib/state.mjs(L29-44) picks the state directory based onCLAUDE_PLUGIN_DATA:The setup command runs via Bash (invoked by Claude), where
CLAUDE_PLUGIN_DATAis not set → writesstopReviewGate: trueto the temp directory.The Stop hook runs via Claude Code's hook system, where
CLAUDE_PLUGIN_DATAis set → reads from the persistent plugin data directory, which still has the defaultstopReviewGate: false.Evidence
Suggested fix
The setup subcommand in
codex-companion.mjsshould resolve the persistent plugin data directory the same way hooks do. Options:CLAUDE_PLUGIN_DATAas an env var when invoking the setup Bash command.codex-companion.mjs setupdetect~/.claude/plugins/data/codex-openai-codex/as a fallback whenCLAUDE_PLUGIN_DATAis unset.Environment