mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Centralize Guardian transcript policy in context profiles (#43806)
## What changed Add `ContextProfile` to `codex-guardian-context` and route synchronous and asynchronous Guardian transcript rendering through it. Move default limits, retention, formatting, and async chunked eviction into the shared crate while preserving the distinct retention policies and host-managed full/delta cursors. Carry transcript truncation observations through `RenderedTranscript` into context composition, and derive async image collection flags from the resolved profile. ## Testing Add a profile regression test covering distinct sync/async retention priorities, original entry numbering, omission notes, and async truncation observations. Adapt existing transcript tests to the updated input API. GitOrigin-RevId: 7f7dc249629d8017e9547085f6617f815ae43a1b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//! Composes collected evidence into ordered sections with explicit delivery.
|
||||
//! Hosts select the transcript and retain cursor/budget policy; composition owns
|
||||
//! Profiles retain the host-selected transcript slice; composition owns
|
||||
//! framing, message boundaries and section placement, without retaining history.
|
||||
|
||||
use codex_context_fragments::ContextualUserFragment;
|
||||
@@ -24,6 +24,7 @@ pub enum ContextPresentation<'a> {
|
||||
pub struct RenderedTranscript {
|
||||
pub items: Vec<String>,
|
||||
pub omission_note: Option<String>,
|
||||
pub truncations: Vec<TruncationObservation>,
|
||||
}
|
||||
|
||||
/// Evidence collected successfully before host transcript selection.
|
||||
@@ -67,7 +68,7 @@ impl CollectedContext {
|
||||
pub fn compose(
|
||||
self,
|
||||
presentation: ContextPresentation<'_>,
|
||||
transcript: RenderedTranscript,
|
||||
mut transcript: RenderedTranscript,
|
||||
) -> Result<ComposedContext, SectionError> {
|
||||
let (action, intro, start, end, session_id) = match presentation {
|
||||
ContextPresentation::SyncFull { session_id } => (
|
||||
@@ -97,7 +98,7 @@ impl CollectedContext {
|
||||
),
|
||||
};
|
||||
let mut sections = Vec::new();
|
||||
let mut truncations = Vec::new();
|
||||
let mut truncations = std::mem::take(&mut transcript.truncations);
|
||||
if let Some(intro) = intro {
|
||||
sections.push((
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user