Skip to content

[codex] migrate Codex preset to hooks and shared bash recovery#997

Merged
svarlamov merged 3 commits intojohnw/bash-supportfrom
codex/codex-hooks-shared-bash-recovery
Apr 7, 2026
Merged

[codex] migrate Codex preset to hooks and shared bash recovery#997
svarlamov merged 3 commits intojohnw/bash-supportfrom
codex/codex-hooks-shared-bash-recovery

Conversation

@svarlamov
Copy link
Copy Markdown
Member

@svarlamov svarlamov commented Apr 7, 2026

Summary

  • migrate the Codex preset from legacy notify wiring to Codex hooks (PreToolUse, PostToolUse, Stop)
  • reuse the shared bash snapshot architecture for inflight agent recovery instead of a Codex-only sidecar path
  • keep Codex-specific behavior only where runtime gaps still require it: snapshot-only PreToolUse for Bash and Stop fallback for apply_patch/file-edit turns

Why

Codex now supports bash pre/post hooks, but it still does not emit hooks for file-edit tool calls. The old notify-based path needed to be removed, while commit-time attribution still needed to recover the owning Codex session when git commit happens inside a live bash invocation.

This change moves that recovery into the shared bash snapshot flow so other agents can use the same mechanism, and leaves Codex-specific logic only for the current runtime gaps.

User impact

  • Codex installs hooks instead of git-ai notify
  • bash-originated Codex edits and commits recover proper AI attribution from active session context
  • pure Codex file-edit turns still get unscoped AI attribution through Stop until Codex exposes file-edit hooks
  • the shared bash prehook path is simpler and reused across Claude, Gemini, Continue CLI, Amp, OpenCode, Droid, and Firebender

Validation

  • cargo fmt -- --check
  • git diff --check
  • cargo test pre_commit_checkpoint_context_uses_inflight_bash_agent_context -- --nocapture
  • cargo test mdm::agents::codex::tests -- --nocapture
  • cargo test --package git-ai --test integration codex -- --nocapture
  • cargo test --package git-ai --test integration bash_tool_conformance -- --nocapture
  • cargo test --package git-ai --test integration test_amp_preset_pretooluse_returns_human_checkpoint -- --nocapture
  • cargo test --package git-ai --test integration test_opencode_preset_pretooluse_returns_human_checkpoint -- --nocapture
  • cargo test --package git-ai --test integration test_droid_preset_pretooluse_returns_human_checkpoint -- --nocapture
  • cargo test --package git-ai --test integration test_firebender_pre_tool_use_maps_to_human_checkpoint -- --nocapture
  • cargo test --package git-ai --test integration test_continue_cli_preset_human_checkpoint -- --nocapture
  • cargo test --package git-ai --test integration test_gemini_preset_human_checkpoint -- --nocapture
  • cargo test --package git-ai --test integration test_claude_preset_pretooluse_checkpoint -- --nocapture
  • cargo test --package git-ai --test integration test_gemini_preset_bash_tool_aftertool_detects_changes -- --nocapture

Stack

Base branch: johnw/bash-support
Intended follow-up into: #798


Open with Devin

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 7, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Test Runner seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@svarlamov svarlamov force-pushed the codex/codex-hooks-shared-bash-recovery branch from 01b6d04 to df2c831 Compare April 7, 2026 03:20
@svarlamov svarlamov marked this pull request as ready for review April 7, 2026 03:28
devin-ai-integration[bot]

This comment was marked as resolved.

@svarlamov svarlamov merged commit 13064ab into johnw/bash-support Apr 7, 2026
1 of 2 checks passed
@svarlamov svarlamov deleted the codex/codex-hooks-shared-bash-recovery branch April 7, 2026 14:06
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.

2 participants