mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Centralize compaction checkpoint selection and validation (#46009)
## What changed Add `codex_history::CompactionCheckpoint` to keep a checkpoint and its recorded producer model hash together, with shared checks for usability and reviewer compatibility. Replace `ConversationHistorySnapshot::latest_compaction_model_hash()` with `latest_compaction()` and use the shared abstraction in Guardian context selection, review sessions, and parent compaction reuse. Preserve selection of the latest checkpoint even when unusable, and leave missing producer metadata unknown. ## Testing Add coverage showing that the latest checkpoint retains its own provenance even with missing or empty encrypted content, and that compatibility requires matching producer and reviewer hashes. Adapt existing history, migration, and parent compaction tests to the new API. GitOrigin-RevId: 98e794644edf979c98fcc8294baa48ff82ea0ed0
This commit is contained in:
1 parent
2b59d92dbd
commit
7f0ab95827
12 files changed
+187
-105
No files matched your search
@@ -1,3 +1,4 @@
|
||||
use codex_history::CompactionCheckpoint;
|
||||
use codex_history::RetainedContext;
|
||||
|
||||
use codex_protocol::models::ResponseItem;
|
||||
@@ -29,10 +30,12 @@ pub trait ConversationHistorySnapshot: Send + Sync {
|
||||
self.retained_context().is_some()
|
||||
}
|
||||
|
||||
/// Producer compatibility recorded on the latest opaque checkpoint. Missing provenance
|
||||
/// must not be inferred from the currently selected model, including after resume.
|
||||
fn latest_compaction_model_hash(&self) -> Option<&str> {
|
||||
None
|
||||
/// Latest opaque checkpoint, including unusable items, with its recorded producer.
|
||||
/// Hosts without provenance leave the producer unknown rather than using the live model.
|
||||
fn latest_compaction(&self) -> Option<CompactionCheckpoint<'_>> {
|
||||
self.items()
|
||||
.filter_map(|item| CompactionCheckpoint::from_item(item, /*model_hash*/ None))
|
||||
.last()
|
||||
}
|
||||
|
||||
/// Original review evidence retained across parent compaction, in conversation order.
|
||||
|
||||
Reference in new issue
Block a user