From 130b047beb95acc0d06a01e735b48c6342baf43f Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 14 Apr 2026 19:47:50 -0700 Subject: [PATCH] Disable hooks in guardian review sessions (#17872) ## What Disable `Feature::CodexHooks` when building guardian review session config ## Why Guardian review sessions were respecting the Stop hook and could ingest synthetic `` user turns Guardian should ignore hooks, while the main session and regular subagents continue to respect them In other words Guardian was getting ralph-looped Co-authored-by: Codex --- codex-rs/core/src/guardian/review_session.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/codex-rs/core/src/guardian/review_session.rs b/codex-rs/core/src/guardian/review_session.rs index 239754c50..6cb9aefa1 100644 --- a/codex-rs/core/src/guardian/review_session.rs +++ b/codex-rs/core/src/guardian/review_session.rs @@ -748,6 +748,7 @@ pub(crate) fn build_guardian_review_session_config( for feature in [ Feature::SpawnCsv, Feature::Collab, + Feature::CodexHooks, Feature::WebSearchRequest, Feature::WebSearchCached, ] { @@ -854,6 +855,25 @@ mod tests { ); } + #[test] + fn guardian_review_session_config_disables_hooks() { + let mut parent_config = crate::config::test_config(); + parent_config + .features + .enable(Feature::CodexHooks) + .expect("enable hooks on parent config"); + + let guardian_config = build_guardian_review_session_config( + &parent_config, + /*live_network_config*/ None, + "active-model", + /*reasoning_effort*/ None, + ) + .expect("guardian config"); + + assert!(!guardian_config.features.enabled(Feature::CodexHooks)); + } + #[tokio::test(flavor = "current_thread")] async fn run_before_review_deadline_times_out_before_future_completes() { let outcome = run_before_review_deadline(