From cff337e4e3bd2b84347ddcc26a69775bfc0638fc Mon Sep 17 00:00:00 2001 From: maja-openai <163171781+maja-openai@users.noreply.github.com> Date: Thu, 23 Apr 2026 11:42:43 -0700 Subject: [PATCH] Use Auto-review wording for fallback rationale (#19168) ## Why PR #18797 currently surfaces fallback rationale text that names Guardian directly. ## What changed - Updated the bare allow and bare deny fallback rationales in `codex-rs/core/src/guardian/prompt.rs` from Guardian to Auto-review. - Updated the existing bare allow parser test and added explicit bare deny parser coverage. ## Verification - `cargo test -p codex-core parse_guardian_assessment_treats_bare` --- codex-rs/core/src/guardian/prompt.rs | 4 ++-- codex-rs/core/src/guardian/tests.rs | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/codex-rs/core/src/guardian/prompt.rs b/codex-rs/core/src/guardian/prompt.rs index adf9dd8d70..3005ba60cd 100644 --- a/codex-rs/core/src/guardian/prompt.rs +++ b/codex-rs/core/src/guardian/prompt.rs @@ -517,10 +517,10 @@ pub(crate) fn parse_guardian_assessment(text: Option<&str>) -> anyhow::Result { - "Guardian returned a low-risk allow decision.".to_string() + "Auto-review returned a low-risk allow decision.".to_string() } super::GuardianAssessmentOutcome::Deny => { - "Guardian returned a deny decision without a rationale.".to_string() + "Auto-review returned a deny decision without a rationale.".to_string() } }); diff --git a/codex-rs/core/src/guardian/tests.rs b/codex-rs/core/src/guardian/tests.rs index 470a46498f..c679f605a8 100644 --- a/codex-rs/core/src/guardian/tests.rs +++ b/codex-rs/core/src/guardian/tests.rs @@ -1052,7 +1052,23 @@ fn parse_guardian_assessment_treats_bare_allow_as_low_risk() { risk_level: GuardianRiskLevel::Low, user_authorization: GuardianUserAuthorization::Unknown, outcome: GuardianAssessmentOutcome::Allow, - rationale: "Guardian returned a low-risk allow decision.".to_string(), + rationale: "Auto-review returned a low-risk allow decision.".to_string(), + } + ); +} + +#[test] +fn parse_guardian_assessment_treats_bare_deny_as_high_risk() { + let parsed = + parse_guardian_assessment(Some(r#"{"outcome":"deny"}"#)).expect("guardian assessment"); + + assert_eq!( + parsed, + GuardianAssessment { + risk_level: GuardianRiskLevel::High, + user_authorization: GuardianUserAuthorization::Unknown, + outcome: GuardianAssessmentOutcome::Deny, + rationale: "Auto-review returned a deny decision without a rationale.".to_string(), } ); }