Add extra policy configuration for Guardian reviews (#47125)

## What changed

- Add `auto_review.extra_policy` and the managed `guardian_extra_policy` requirement to supply policy text alongside the resolved tenant policy. Nonblank managed values take precedence; blank values are ignored.
- Render the additional text through `{{ extra_policy }}` in Guardian reviewer templates and append it to the tenant policy for Guardian v2 classification before truncation.
- Preserve placeholder-like text inside supplied policies literally.

## Testing

Add coverage for configuration precedence, blank values, template substitution, and classifier prompts, plus a scenario verifying that managed tenant and extra policies reach the Guardian reviewer together.

GitOrigin-RevId: 180d8d716c63fe96a92ec5bfbd22db4ddccd4f1f
This commit is contained in:
Won Park
2026-09-21 23:06:36 +00:00
committed by copyberry
parent 171dd0d39c
commit 26cb4d73e2
21 changed files with 621 additions and 67 deletions
+2
View File
@@ -977,6 +977,7 @@ interrupt_message = false
}),
additional_developer_instructions: None,
guardian_policy_config: Some("Use the managed guardian policy.".to_string()),
guardian_extra_policy: None,
feature_requirements: Some(FeatureRequirementsToml {
entries: BTreeMap::from([("guardian_approval".to_string(), true)]),
}),
@@ -1347,6 +1348,7 @@ approval_policy = "never"
computer_use: None,
windows: None,
guardian_policy_config: None,
guardian_extra_policy: None,
feature_requirements: None,
hooks: None,
mcp_servers: None,