Files
codex/codex-rs/guardian-context/src/section.rs
T
felixxia-oai 93ac341410 Preserve Guardian context sections and share planned-action rendering (#43534)
## What changed

- Replace `ComposedContext` with ordered `ContextSection` values that retain section identities through transcript selection and rendering.
- Add a shared `PlannedAction` section and renderer for core synchronous approval prompts and the Guardian V2 asynchronous scorer, preserving full, delta, terminal-input, and network-request framing.
- Keep action JSON and retry reasons out of `PlannedAction` debug output.

## Testing

Update registry and transcript tests to assert section identities and source roles. Extend registry coverage to verify planned-action collection for both consumers and omission of action JSON and reasons from debug output.

GitOrigin-RevId: 675b841a2cad06afce03f414615b4d7aa0553b13
2026-09-07 18:02:06 +00:00

20 lines
879 B
Rust

//! Section identities survive consumer-specific transcript selection and rendering.
use crate::ConversationTranscriptEntry;
use crate::PlannedAction;
/// Ordered evidence with a stable section identity and source-specific content.
///
/// Variants preserve provenance: transcript entries carry their original roles,
/// root messages remain line-role-labeled, and answers are host-verified fragments.
/// All currently supported sections are delivered as user-role evidence. Source
/// attribution never promotes their contents to developer instructions.
#[derive(Clone, Debug, PartialEq)]
pub enum ContextSection<T = ConversationTranscriptEntry> {
ConversationTranscript { items: Vec<T> },
RootConversation { items: Vec<String> },
TrustedUserAnswers { items: Vec<String> },
RetainedUserInstructions { items: Vec<String> },
PlannedAction(PlannedAction),
}