mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Add an optional JSON transcript format for Guardian (#51465)
## Why Transcript content can contain forged role headers, transcript boundaries, or claims of user approval. Guardian needs to distinguish that content from host-assigned authorship metadata. ## What changed - Add `features.guardianv2.transcript_mode` with `line` (the default) and `json` options for synchronous review and asynchronous scoring. - Render JSON transcript entries with host-assigned metadata and escaped `text`, and prepend matching provenance instructions to reviewer and classifier prompts. - Preserve JSON metadata when budget recovery shortens historical text, and keep provenance instructions outside the configured classifier prompt limit. ## Testing Add coverage for forged roles and approvals remaining within their original entries, JSON metadata surviving budget recovery, and provenance instructions surviving prompt limits. Extend review and scoring integration tests to verify JSON evidence and matching instructions. GitOrigin-RevId: 81a3580390d3c4d1a664e554976cda5f1adc9a2c
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//! Shared Guardian transcript encoding selected by configuration and used by evidence consumers.
|
||||
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
/// Transcript encoding shared by rendering, provenance instructions and budget recovery.
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TranscriptFormat {
|
||||
/// Numbered entries with a role prefix and unescaped text.
|
||||
#[default]
|
||||
Line,
|
||||
/// Host-owned metadata with message text escaped as a JSON string.
|
||||
Json,
|
||||
}
|
||||
@@ -22,6 +22,8 @@ pub mod approvals;
|
||||
pub mod capabilities;
|
||||
mod codex_error_info;
|
||||
pub mod config_types;
|
||||
mod guardian_transcript;
|
||||
pub use guardian_transcript::TranscriptFormat;
|
||||
pub mod dynamic_tools;
|
||||
mod environment;
|
||||
pub mod error;
|
||||
|
||||
Reference in New Issue
Block a user