Use model-specific auto-review outcome instructions (#39741)

## What changed

- Add `rejection_instructions` and `timeout_instructions` to catalog-provided auto-review messages.
- Use the acting model's instructions for denied and timed-out reviews across tool approvals, shell escalation, and MCP elicitation responses.
- Fall back to the existing instructions only when a catalog value is absent, while preserving explicit empty-string overrides.

## Testing

- Cover catalog overrides, legacy fallbacks, empty values, and separation between acting-model and reviewer-model messages.

GitOrigin-RevId: c5b2c2dbdaefd45d1d658651dd1abaeb6d8c93da
This commit is contained in:
rhan-oai authored and copyberry committed 2026-08-20 16:52:16 +00:00
1 parent 88da5520d4
commit 4f38432d87
12 files changed
+292 -33

No files matched your search

+19 -1
View File
@@ -1427,10 +1427,28 @@ async fn cancelled_guardian_review_emits_terminal_abort_without_warning() {
#[test]
fn guardian_timeout_message_distinguishes_timeout_from_policy_denial() {
let message = guardian_timeout_message();
let mut model = codex_models_manager::model_info::model_info_from_slug("acting-model");
model.model_messages = None;
let message = guardian_timeout_message(&model);
assert!(message.contains("did not finish before its deadline"));
assert!(message.contains("retry once"));
assert!(!message.contains("unacceptable risk"));
for timeout_instructions in [None, Some("Catalog timeout instructions."), Some("")] {
model.model_messages = Some(
serde_json::from_value(serde_json::json!({
"auto_review": {
"policy": "review policy",
"timeout_instructions": timeout_instructions,
},
}))
.expect("model messages should deserialize"),
);
assert_eq!(
guardian_timeout_message(&model),
timeout_instructions.unwrap_or(&message),
);
}
}
#[tokio::test]