mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
Use model catalog policies for Guardian auto review (#32875)
- Add an `auto_review.policy` field to model catalog messages. - Use the selected Guardian model's catalog policy for review-session instructions, while preserving the precedence of `guardian_policy_config` and falling back to the built-in policy when neither is present. - Preserve auto-review messages when model instruction overrides remove catalog instruction templates. - Cover configured-policy precedence, explicit empty catalog policies, catalog-message preservation, and propagation of the catalog policy into a prewarmed Guardian session. GitOrigin-RevId: 26b61ae2958ea8325a64834dcf91f47e140d74b3
This commit is contained in:
@@ -486,6 +486,7 @@ pub struct ModelMessages {
|
||||
pub instructions_template: Option<String>,
|
||||
pub instructions_variables: Option<ModelInstructionsVariables>,
|
||||
pub approvals: Option<ApprovalMessages>,
|
||||
pub auto_review: Option<AutoReviewMessages>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, TS, JsonSchema)]
|
||||
@@ -494,6 +495,11 @@ pub struct ApprovalMessages {
|
||||
pub on_request_auto_review: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, TS, JsonSchema)]
|
||||
pub struct AutoReviewMessages {
|
||||
pub policy: Option<String>,
|
||||
}
|
||||
|
||||
impl ModelMessages {
|
||||
fn has_personality_placeholder(&self) -> bool {
|
||||
self.instructions_template
|
||||
@@ -814,6 +820,7 @@ mod tests {
|
||||
instructions_template: Some("Hello {{ personality }}".to_string()),
|
||||
instructions_variables: Some(personality_variables()),
|
||||
approvals: None,
|
||||
auto_review: None,
|
||||
}));
|
||||
|
||||
let instructions = model.get_model_instructions(Some(Personality::Friendly));
|
||||
@@ -831,6 +838,7 @@ mod tests {
|
||||
personality_pragmatic: None,
|
||||
}),
|
||||
approvals: None,
|
||||
auto_review: None,
|
||||
}));
|
||||
assert_eq!(
|
||||
model.get_model_instructions(Some(Personality::Friendly)),
|
||||
@@ -857,6 +865,7 @@ mod tests {
|
||||
personality_pragmatic: None,
|
||||
}),
|
||||
approvals: None,
|
||||
auto_review: None,
|
||||
}));
|
||||
assert_eq!(
|
||||
model_no_personality.get_model_instructions(Some(Personality::Friendly)),
|
||||
@@ -886,6 +895,7 @@ mod tests {
|
||||
personality_pragmatic: None,
|
||||
}),
|
||||
approvals: None,
|
||||
auto_review: None,
|
||||
}));
|
||||
|
||||
let instructions = model.get_model_instructions(Some(Personality::Friendly));
|
||||
|
||||
Reference in New Issue
Block a user