Defer Guardian context limits to request preparation (#61185)

## What changed

Preserve original root conversation evidence, retained instructions, assistant context, and verified answers until request preparation. Apply shared section preparation to both synchronous and asynchronous reviews, preserving fixed limits and omission notices while allowing elastic preparation to use the originals. Cache the fixed root view for reuse.

Split classifier setup from final input assembly and normalize new images before deduplication and token accounting, preserving committed history.

## Testing

Extend tests for fixed and elastic preparation across both review profiles, original root evidence after handoff, and image normalization during retained-request preparation.

GitOrigin-RevId: 86c83384c1f5be3707622d675fc54b4c8e1ddc0a
This commit is contained in:
ioanbudea-OAI
2026-11-12 21:40:00 +00:00
committed by copyberry
parent 2bb2e20d6a
commit d4242793f7
24 changed files with 275 additions and 208 deletions
+3 -7
View File
@@ -1304,17 +1304,13 @@ impl CodexThread {
.authorization_version(history.as_ref())
}
/// Returns bounded root conversation evidence and its authorization version atomically.
/// Captures root originals and authorization before request-size preparation.
pub async fn guardian_root_snapshot(&self) -> Option<GuardianRootSnapshot> {
let mut snapshot = self
.session
self.session
.services
.agent_control
.get_guardian_package(self.session.thread_id)
.await?;
// Async consumers need only the bounded projection, not the sync source snapshot.
snapshot.request_candidates = None;
Some(snapshot)
.await
}
/// Refresh the thread's layer-backed user config state from a caller-supplied