Add opt-in elastic budgeting for synchronous Guardian reviews (#59444)

## What changed

- Add `features.guardianv2.sync_elastic_budgeting` and `sync_elastic_sections` to configure section minimums, per-entry token caps, and optional section maximums. Require and validate section limits when enabled.
- Use the selected budgeting policy consistently for history capture, resume, prompt preparation, and review input budgeting. Keep fixed budgeting as the default.

## Testing

Add configuration validation tests, capture-and-resume coverage for both budgeting modes, and a request-history snapshot verifying retained instructions and transcript section limits.

GitOrigin-RevId: c7b0bdfd3e0e008d75c4d8a204959bcc58eb1bf8
This commit is contained in:
ioanbudea-OAI
2026-11-04 16:33:22 +00:00
committed by copyberry
parent 48524f337a
commit 4d62359072
19 changed files with 491 additions and 5 deletions
@@ -276,6 +276,7 @@ async fn new_config(
guardian_extra_policy: None,
guardian_policy_template: None,
guardian_transcript_mode: Default::default(),
guardian_sync_elastic_budget: None,
guardian_conversation_history_prompt: None,
guardian_denial_reconsideration_prompt: None,
guardian_conversation_history_max_output_tokens: None,