Enable Guardian V2 scoring with an explicit Guardian provider (#62607)

## Why

An explicit Guardian provider could handle approval reviews, but configuring it
disabled Guardian V2 scoring. This prevented automatic reviews from using
background scores from that provider.

## What changed

Route classification through the configured Guardian provider and use its
classifier catalog for instructions, reasoning effort, review thresholds, and
input limits. Apply the Guardian provider's API-key access policy to classifier
requests and ignore assessments from the actor's response stream when a
Guardian provider is configured.

Keep mandatory review requirements in force and skip background scoring in
User approval mode and Full Access.

## Testing

Extend coverage for separate actor and Guardian providers at startup and after
cold resume, including when both use the same model name. Cover catalog
settings, scoring restrictions, and provider-specific API-key policy.

GitOrigin-RevId: 5f83d1704bacc63033e144bba0d78752283cb590
This commit is contained in:
XMLIU-oai
2026-11-19 22:00:52 +00:00
committed by copyberry
parent 75f2d93e7c
commit efcc0cf917
19 changed files with 606 additions and 173 deletions
+5 -1
View File
@@ -3159,6 +3159,7 @@ async fn try_run_sampling_request(
let mut pending_assessment: Option<codex_api::GuardianAssessment> = None;
let mut response_completed = false;
let mut includes_reasoning = step_context.settings.model_info.use_responses_lite;
let accept_actor_assessments = turn_context.config.guardian_model_provider.is_none();
let mut resampling = crate::guardian::ResponseResampling::new(&sess);
let prompt = Arc::new(prompt);
let interrupt_at_boundary = SamplingInterrupt::enabled(&turn_context);
@@ -3701,7 +3702,10 @@ async fn try_run_sampling_request(
.await;
}
ResponseEvent::GuardianAssessment(assessment) => {
if response_id_for_assessment.as_deref() == Some(assessment.response_id.as_str()) {
if accept_actor_assessments
&& response_id_for_assessment.as_deref()
== Some(assessment.response_id.as_str())
{
pending_assessment = Some(assessment);
}
}