[codex] Enable current Codex hook feature flag

CY
1mo ago
+104-44

Summary

  • Update Codex hook setup to enable the current Codex runtime flag, [features] codex_hooks = true, instead of the legacy hooks = true setting.
  • Preserve user-owned codex_hooks settings during install/uninstall while still removing cmux-owned marker blocks and legacy orphaned marker blocks.
  • Update regression coverage and docs so Codex hook setup reflects the current Codex CLI behavior.

Root cause: current Codex requires codex_hooks = true; cmux installed hooks = true, so Codex could skip UserPromptSubmit hooks and the sidebar would not show Running during interactive Codex requests.

Testing

  • python3 -m py_compile tests/test_codex_feed_hooks.py
  • swiftc -parse CLI/CMUXCLI+CodexConfigToml.swift CLI/CMUXCLI+AgentHookDefinitions.swift
  • git diff --check HEAD~2..HEAD
  • PATH="/opt/homebrew/opt/zig@0.15/bin:$PATH" DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer ./scripts/reload.sh --tag fix-codex-running --launch
  • Verified with a temporary CODEX_HOME that cmux hooks codex install --yes writes [features] codex_hooks = true and installs the UserPromptSubmit hook.
  • Verified against /tmp/cmux-debug-fix-codex-running.sock that the generated shell hook updates sidebar state to codex=Running icon=bolt.fill color=#4C8DFF.
  • Manually verified the isolated cmux DEV fix-codex-running.app sidebar shows Running.

Demo Video

For UI or behavior changes, include a short demo video (GitHub upload, Loom, or other direct link).

  • Video URL or attachment: N/A; manually verified in an isolated tagged app and included the exact socket/sidebar-state verification above.

Review Trigger (Copy/Paste as PR comment)

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

Checklist

  • I tested the change locally
  • I added or updated tests for behavior changes
  • I updated docs/changelog if needed
  • I requested bot reviews after my latest commit (copy/paste block above or equivalent)
  • All code review bot comments are resolved
  • All human review comments are resolved

Summary by cubic

Switch Codex hook setup to the current codex_hooks = true flag and clean up legacy hooks = true so UserPromptSubmit hooks run and the sidebar shows Running during interactive requests. Preserve user settings on install/uninstall and clean up cmux-owned and legacy markers.

  • Bug Fixes
    • Install writes [features] codex_hooks = true (or features.codex_hooks = true), removes unmarked legacy hooks = true/features.hooks = true, and preserves existing disabled hooks settings.
    • Uninstall removes only cmux-owned blocks and orphaned markers, preserves/restores user codex_hooks and legacy hooks values, and drops now-empty [features] tables.
    • Added regression tests for migration, legacy flag cleanup (incl. dotted keys and bracketed arrays), and uninstall; docs note Codex writes ~/.codex/hooks.json and enables [features] codex_hooks = true.

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added setup guide for Codex hook runtime configuration explaining the configuration process.
  • Improvements

    • Updated Codex hooks feature configuration handling to improve setting recognition and management. Legacy hook settings are automatically cleaned up during configuration updates.

Review Change Stack