Reuse Guardian reviews in async risk scoring (#40013)

## What changed

- Retain bounded evidence from completed synchronous Guardian allow and deny reviews and supply it to subsequent Guardian v2 async classifier samples as trusted developer context.
- Keep review evidence isolated from the conversation transcript, escape and truncate its fields, and ignore failed or incomplete reviews.
- Invalidate retained evidence after conversation history rewrites or new user messages, including authorization changes in a worker's root thread.

## Testing

- Cover approved, denied, malformed, and forged review inputs, plus root rollback and authorization-change scenarios.

GitOrigin-RevId: 27817e1fde9a136de727048c4220d148fcf72f42
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-08-21 21:22:35 +00:00
1 parent ab8768306f
commit 9949c9eafa
16 files changed
+688 -74

No files matched your search

@@ -5,6 +5,9 @@ use codex_protocol::models::ResponseItem;
/// Implementations should retain the host's existing snapshot storage rather than
/// copying response payloads into an extension-owned collection.
pub trait ConversationHistorySnapshot: Send + Sync {
/// Returns the generation of the history captured by this snapshot.
fn history_version(&self) -> u64;
/// Returns the snapshot's response items in conversation order.
fn items(&self) -> Box<dyn Iterator<Item = &ResponseItem> + Send + '_>;
}