Skip to content

[codex] restore Codex loading state via native hooks#2998

Merged
Kitenite merged 5 commits intomainfrom
debug-codex-loading-state-issue
Mar 30, 2026
Merged

[codex] restore Codex loading state via native hooks#2998
Kitenite merged 5 commits intomainfrom
debug-codex-loading-state-issue

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Mar 29, 2026

Summary

Restore the Codex pane running/loading indicator by switching Superset to Codex's supported hook path, enabling the upstream codex_hooks feature in the default Codex launch command, and migrating already-saved Codex terminal presets that still contain the stale pre-update command.

What Changed

  • add UserPromptSubmit to the managed ~/.codex/hooks.json merge so Codex emits a supported start signal
  • keep the wrapper/session-log watcher only as compatibility support for older Codex builds
  • enable codex_hooks in Superset's default Codex terminal preset command
  • migrate stored terminal presets whose Codex command still matches the legacy pre-hook command
  • update shared, desktop, and settings-router tests that assert the default Codex command, hook setup, and preset normalization behavior

Root Cause

There were three layers to the regression after the upstream Codex update on March 27-28, 2026:

  1. Superset was relying on internal Codex TUI session-log behavior for Start events, and upstream openai/codex changed that surface.
  2. Superset's default Codex command still launched without --enable codex_hooks, so Codex never loaded hooks.json and no running-state start event could fire.
  3. Existing users kept already-initialized terminal presets, so even after fixing the builtin default, saved Codex presets could still keep launching the stale command.

Impact

Codex panes should enter the running/working state again when a prompt is submitted on current Codex builds, including for existing saved Codex terminal presets once the preset normalization path runs.

Validation

  • bun test packages/shared/src/agent-command.test.ts
  • bun test apps/desktop/src/shared/utils/agent-launch-request.test.ts
  • bun test apps/desktop/src/lib/trpc/routers/settings/preset-execution-mode.test.ts
  • bun test apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts
  • bun test apps/desktop/src/main/lib/notifications/server.test.ts
  • bunx biome check apps/desktop/src/lib/trpc/routers/settings/preset-execution-mode.ts apps/desktop/src/lib/trpc/routers/settings/preset-execution-mode.test.ts packages/shared/src/agent-command.ts packages/shared/src/agent-command.test.ts apps/desktop/src/shared/utils/agent-launch-request.test.ts apps/desktop/src/main/lib/agent-setup/agent-wrappers-claude-codex-opencode.ts apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed a configuration issue where the Codex hooks flag was missing from wrapper initialization, affecting notification delivery and hook activation.
  • Tests

    • Added test coverage for argument forwarding and hook enablement to verify the wrapper correctly invokes the process with proper configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f674c43-5006-42db-bd12-1eaa3539abf6

📥 Commits

Reviewing files that changed from the base of the PR and between bd61cc1 and 807632f.

📒 Files selected for processing (2)
  • apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts
  • apps/desktop/src/main/lib/agent-setup/templates/codex-wrapper-exec.template.sh

📝 Walkthrough

Walkthrough

The Codex wrapper initialization now includes the --enable codex_hooks flag when invoking the real Codex binary. The test file has been updated to validate this new flag is correctly passed through the wrapper to ensure the notification mechanism functions as expected.

Changes

Cohort / File(s) Summary
Codex Wrapper Template
apps/desktop/src/main/lib/agent-setup/templates/codex-wrapper-exec.template.sh
Added --enable codex_hooks flag to the Codex binary invocation, placed before the existing notification config parameter.
Wrapper Tests
apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts
Updated existing Codex wrapper assertion to expect --enable codex_hooks flag and added new test case validating the flag is forwarded correctly through manual wrapper execution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A flag to enable, a hook to adhere,
The Codex now dances with notifications clear,
Through wrappers and tests, the new flag takes flight,
With --enable codex_hooks, everything's right! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch debug-codex-loading-state-issue

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 30, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ✅ Electric Fly.io app

Thank you for your contribution! 🎉

@Kitenite Kitenite marked this pull request as ready for review March 30, 2026 04:33
@Kitenite Kitenite merged commit 29141c1 into main Mar 30, 2026
6 of 7 checks passed
@Kitenite Kitenite deleted the debug-codex-loading-state-issue branch March 30, 2026 04:33
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant