mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +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,8 +1,8 @@
|
||||
//! Collects bounded conversation evidence before consumer-specific rendering.
|
||||
//!
|
||||
//! Both Guardian consumers receive the same role and tool-source attribution,
|
||||
//! with per-entry caps applied before accumulation. Consumers retain their own
|
||||
//! transcript selection, aggregate budgets, and formatting. Tool outputs with a
|
||||
//! with per-entry caps applied before accumulation. Resolved context profiles
|
||||
//! apply aggregate retention after the host selects its full/delta slice. Tool outputs with a
|
||||
//! call ID retain their generic label when the call is unavailable. Outputs
|
||||
//! without a call ID require an explicit name.
|
||||
|
||||
@@ -65,9 +65,8 @@ pub struct TranscriptEntryLimits {
|
||||
|
||||
/// Aggregate limits for retaining rendered transcript entries.
|
||||
///
|
||||
/// Sync and async consumers keep their existing selection rules. These limits
|
||||
/// configure those rules without introducing another sync/async policy selector.
|
||||
/// Collection applies per-entry caps; aggregate retention remains with the host.
|
||||
/// Context profiles apply the sync or async selection rules using these limits.
|
||||
/// Collection applies per-entry caps before profile retention.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct TranscriptRetentionConfig {
|
||||
/// Budget for rendered user, developer, assistant, and reasoning entries.
|
||||
@@ -106,7 +105,7 @@ impl SectionContributor for ConversationTranscriptSection {
|
||||
/// Extracts bounded transcript entries without composing other context sections.
|
||||
///
|
||||
/// Entries preserve conversation order and role/tool attribution. Per-entry
|
||||
/// limits apply during collection; consumers own aggregate retention and rendering.
|
||||
/// limits apply during collection; context profiles own aggregate retention.
|
||||
pub fn collect_transcript(
|
||||
history: &dyn SectionHistory,
|
||||
config: &ConversationTranscriptConfig,
|
||||
|
||||
Reference in New Issue
Block a user