mirror of
https://github.com/openai/codex.git
synced 2026-11-15 14:52:36 +00:00
Require Guardian review for incompatible compaction checkpoints (#42588)
## Why Guardian can reuse an opaque parent compaction only when the checkpoint's recorded producer hash matches the scoring model. Missing or incompatible provenance must not allow an asynchronous score or cached approval to omit compacted context. ## What changed - Record the producing model's compatibility hash on compaction history items and expose the latest checkpoint hash through conversation snapshots. - In thread-owned context mode, fail closed and require synchronous review when checkpoint reuse is enabled but the latest checkpoint is incompatible or has unknown provenance. - Reject incompatible checkpoints in the sampler while preserving the legacy context behavior. ## Testing Add coverage for local, remote, resumed, compacted, and rolled-back histories, including matching, mismatched, missing, and empty compatibility hashes. GitOrigin-RevId: 1ce959cb276edc602fd7dfa442133c7fe5e53857
This commit is contained in:
1 parent
1d6727c0b5
commit
ad8ee16a5f
17 files changed
+505
-88
No files matched your search
@@ -3759,6 +3759,19 @@ impl Session {
|
||||
for envelope in &mut items {
|
||||
Self::assign_missing_response_item_id(&mut envelope.item);
|
||||
}
|
||||
if self.enabled(Feature::GuardianThreadContext)
|
||||
&& let Some(checkpoint) = items.iter_mut().rev().find(|envelope| {
|
||||
matches!(
|
||||
envelope.item,
|
||||
ResponseItem::Compaction { .. } | ResponseItem::ContextCompaction { .. }
|
||||
)
|
||||
})
|
||||
{
|
||||
checkpoint
|
||||
.metadata
|
||||
.get_or_insert_default()
|
||||
.compaction_model_hash = metadata.compaction_model_hash;
|
||||
}
|
||||
let mut compacted_item = CompactedItem {
|
||||
message: metadata.message,
|
||||
replacement_history: Some(items.clone()),
|
||||
@@ -4227,6 +4240,7 @@ impl Session {
|
||||
window_number,
|
||||
window_ids,
|
||||
compaction_response_id: None,
|
||||
compaction_model_hash: None,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -5952,6 +5952,7 @@ async fn compaction_checkpoint_waits_for_accepted_settings_persistence() {
|
||||
window_number,
|
||||
window_ids,
|
||||
compaction_response_id: None,
|
||||
compaction_model_hash: None,
|
||||
},
|
||||
),
|
||||
));
|
||||
|
||||
Reference in new issue
Block a user