Support model catalog templates for Guardian policy prompts (#33177)

## What changed

- Add an optional `policy_template` field to auto-review model messages.
- Build Guardian instructions from the catalog template when present, while
  preserving the existing precedence for managed and catalog policy content.
- Fall back independently to the bundled template and bundled policy, and
  preserve explicit empty catalog values.

## Testing

- Cover missing and empty template deserialization, policy precedence, bundled
  fallbacks, and Guardian prewarm instructions.

GitOrigin-RevId: 93116dadbc9bf40527882844a428caed4159fff6
This commit is contained in:
rhan-oai
2026-07-14 22:01:11 +00:00
committed by copyberry
parent 6e215e0db5
commit 68c6e5df2b
9 changed files with 156 additions and 44 deletions
@@ -528,7 +528,7 @@ async fn guardian_allows_unified_exec_additional_permissions_requests_past_polic
#[tokio::test]
async fn process_compacted_history_preserves_separate_guardian_developer_message() {
let (session, mut turn_context) = make_session_and_context().await;
let guardian_policy = crate::guardian::guardian_policy_prompt();
let guardian_policy = "guardian policy".to_string();
let guardian_source =
SessionSource::SubAgent(SubAgentSource::Other(GUARDIAN_REVIEWER_NAME.to_string()));