Centralize bounded Guardian review evidence in guardian-context (#43595)

## What changed

Move prior-review rendering and developer-message construction into `codex_guardian_context`, and route async scorer evidence through a dedicated `PreviousReviews` context section.

Validate a maximum of eight review fragments and a per-fragment byte budget equivalent to 1,000 approximate tokens. Reject oversized evidence without rewriting or dropping records, and fail closed when validation fails. Preserve authorization-version filtering and the existing developer-role delivery. Keep review contents out of debug output.

## Testing

Add coverage for count and UTF-8 byte-size boundaries, preservation of accepted fragments, async-only section delivery, and omission of review contents from debug output.

GitOrigin-RevId: 05e9f53a6405f490b2424b2491a834cd90ab24f0
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-09-07 21:20:31 +00:00
1 parent a444546564
commit 0b9b5ecff3
17 files changed
+334 -129

No files matched your search

@@ -100,6 +100,7 @@ fn registered_transcript_preserves_shared_roles_and_node_repl_tool_attribution()
trusted_user_answers: &[],
planned_action: None,
permissions: None,
previous_reviews: None,
})
.expect("transcript collection should succeed");
@@ -174,6 +175,7 @@ fn excluded_tool_calls_still_attribute_included_results() {
trusted_user_answers: &[],
planned_action: None,
permissions: None,
previous_reviews: None,
})
.expect("transcript collection should succeed");
@@ -267,6 +269,7 @@ fn outputs_with_call_ids_or_explicit_names_are_retained() {
trusted_user_answers: &[],
planned_action: None,
permissions: None,
previous_reviews: None,
})
.expect("transcript collection should succeed");
let mut expected = vec![
@@ -314,6 +317,7 @@ fn reused_registry_applies_current_history_sources_and_entry_limits() {
trusted_user_answers: &[],
planned_action: None,
permissions: None,
previous_reviews: None,
})
.expect("transcript collection should succeed");
assert_eq!(
@@ -348,6 +352,7 @@ fn reused_registry_applies_current_history_sources_and_entry_limits() {
trusted_user_answers: &[],
planned_action: None,
permissions: None,
previous_reviews: None,
})
.expect("transcript collection should succeed");
let mut expected = vec![ConversationTranscriptEntry {