mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve Guardian history across thread reconstruction (#42065)
## Why Guardian review evidence must remain available after a compacted thread is resumed or forked, while rolled-back or parent-local evidence must not grant authorization in a different context. ## What changed - Store the bounded, model-invisible Guardian transcript alongside compacted rollout history and restore it from the newest surviving checkpoint during replay. - Trim Guardian history at rollback boundaries, clearing it when the boundary has already been evicted. - Preserve the checkpoint for user-initiated forks, but remove it when spawning a subagent so parent review evidence is not inherited. - Keep the new rollout field optional for compatibility with existing compacted records and legacy readers. ## Testing - Cover Guardian history across compaction, restart, paginated and pathless stores, user forks, rollback, bounded replay, serialization, and subagent forks. GitOrigin-RevId: 6ab076d5e0c3aac4d6a41ebd50ba2b200c90213e
This commit is contained in:
1 parent
3a04482645
commit
28097e98eb
23 files changed
+369
-27
No files matched your search
@@ -150,6 +150,8 @@ pub(super) struct CompactedItemWire<'a> {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
replacement_history_metadata: Option<Vec<Cow<'a, CodexHarnessMetadata>>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
guardian_history: Option<Cow<'a, crate::GuardianHistoryCheckpoint>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
mcp_resource_origins: Option<Cow<'a, McpResourceOriginCheckpoint>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
window_number: Option<u64>,
|
||||
@@ -191,6 +193,7 @@ impl<'a> From<&'a CompactedItem> for CompactedItemWire<'a> {
|
||||
.collect()
|
||||
}),
|
||||
replacement_history_metadata,
|
||||
guardian_history: item.guardian_history.as_ref().map(Cow::Borrowed),
|
||||
mcp_resource_origins: item.mcp_resource_origins.as_ref().map(Cow::Borrowed),
|
||||
window_number: item.window_number,
|
||||
first_window_id: item.first_window_id.as_deref().map(Cow::Borrowed),
|
||||
@@ -257,6 +260,7 @@ impl TryFrom<CompactedItemWire<'_>> for CompactedItem {
|
||||
Ok(Self {
|
||||
message: item.message.into_owned(),
|
||||
replacement_history,
|
||||
guardian_history: item.guardian_history.map(Cow::into_owned),
|
||||
mcp_resource_origins: item.mcp_resource_origins.map(Cow::into_owned),
|
||||
window_number,
|
||||
first_window_id: item.first_window_id.map(Cow::into_owned),
|
||||
|
||||
Reference in new issue
Block a user