Add opt-in elastic budgeting for asynchronous Guardian requests (#61345)

## What changed

- Add `async_elastic_budgeting` and `async_elastic_sections` under `[features.guardianv2]`, independently of synchronous budgeting and disabled by default.
- Apply section limits and elastic allocation to new classifier evidence after accounting for setup and retained conversation history. Preserve the configured elastic policy when applying model defaults.
- Keep permission context whole during elastic allocation and record truncation observations when image preparation rejects an image.

## Testing

Add coverage for configuration validation, fixed and elastic conversation budgeting, retained history and cursor preservation, and complete classifier requests that retain evidence beyond the fixed entry limit.

GitOrigin-RevId: 2955f0482f7c3e18325e296fc2ccb6592ffcb73a
This commit is contained in:
ioanbudea-OAI
2026-11-13 18:46:45 +00:00
committed by copyberry
parent c33002259e
commit a655b50de9
29 changed files with 448 additions and 50 deletions
@@ -278,6 +278,7 @@ async fn new_config(
guardian_policy_template: None,
guardian_transcript_mode: Default::default(),
guardian_sync_elastic_budget: None,
guardian_async_elastic_budget: None,
guardian_conversation_history_prompt: None,
guardian_conversation_history_max_output_tokens: None,
guardian_circuit_break_action: Default::default(),