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 `<hook_prompt>` 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 <noreply@openai.com>
This commit is contained in:
Abhinav
2026-04-14 19:47:50 -07:00
committed by GitHub
Unverified
parent ca650561d6
commit 130b047beb
@@ -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(