mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
## Why Synchronous approval reviews and asynchronous scoring assemble Guardian evidence separately, duplicating transcript framing and section placement. ## What changed - Move evidence ordering, framing, and delivery into `codex-guardian-context`, while keeping transcript retention, budgets, and delta cursors with their callers. - Pass composed messages directly to the asynchronous sampler, preserving roles, annotations, trusted message boundaries, and image placement. - Reject unsupported synchronous delivery with `SectionError::UnsupportedDelivery` instead of silently dropping content. ## Testing Add composition coverage for preserving separate messages and rejecting them for synchronous delivery. Extend Guardian integration coverage to check trusted tool and skill messages, mixed text and image evidence ordering, and full and delta review framing. GitOrigin-RevId: efc06695ee4e2b7400b123b77ef2a21c8bf40646
57 lines
1.6 KiB
Rust
57 lines
1.6 KiB
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn delivery_preserves_arbitrary_message_boundaries_and_rejects_them_for_sync() {
|
|
let message = crate::PreviousReviews::try_from_fragments(vec!["host-attested review".into()])
|
|
.unwrap()
|
|
.into_message();
|
|
let sections = || {
|
|
vec![
|
|
SectionOutput {
|
|
id: "new_user_section",
|
|
delivery: text_content(vec!["first".into(), "second".into()]),
|
|
},
|
|
SectionOutput {
|
|
id: "new_message_section",
|
|
delivery: SectionDelivery::Message(Box::new(message.clone())),
|
|
},
|
|
SectionOutput {
|
|
id: "another_user_section",
|
|
delivery: text_content(vec!["third".into()]),
|
|
},
|
|
]
|
|
};
|
|
assert_eq!(
|
|
ComposedContext {
|
|
sections: sections(),
|
|
truncations: Vec::new()
|
|
}
|
|
.into_messages(),
|
|
vec![
|
|
user_message(vec![
|
|
ContentItem::InputText {
|
|
text: "first".into()
|
|
},
|
|
ContentItem::InputText {
|
|
text: "second".into()
|
|
}
|
|
]),
|
|
message.clone(),
|
|
user_message(vec![ContentItem::InputText {
|
|
text: "third".into()
|
|
}]),
|
|
]
|
|
);
|
|
assert_eq!(
|
|
ComposedContext {
|
|
sections: sections(),
|
|
truncations: Vec::new()
|
|
}
|
|
.into_user_inputs(),
|
|
Err(SectionError::UnsupportedDelivery {
|
|
section: "new_message_section"
|
|
})
|
|
);
|
|
}
|