mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve Guardian evidence during checkpoint migration (#45789)
## Why A checkpoint produced by a previous model may be incompatible with the selected Guardian reviewer. Legacy review must retain user restrictions and verified answers across compaction and restart until a compatible checkpoint is available. ## What changed - Expose retained user evidence independently of whether Guardian reviews the legacy transcript or parent context. - Resolve the selected reviewer's compaction compatibility hash during resume and remote compaction. Preserve the legacy transcript when checkpoint compatibility is unknown or mismatched. - Activate parent-context review immediately after compatible compaction and invalidate pending reviews bound to the previous evidence policy. Ordinary compaction preserves pending reviews. - Keep strict compatibility checks for previously migrated checkpoints whose complete legacy transcript is no longer available. ## Testing Add coverage for mismatched checkpoint hashes, retained evidence during legacy review, and pending-review cancellation on migration. Add a request-history scenario covering a model switch, incompatible automatic compaction, restart, and compatible manual compaction with preserved user restrictions and verified answers. GitOrigin-RevId: b52bfd7c21ce7ebed482174c8d7c327e50b1ada8
This commit is contained in:
1 parent
0c3a14bbc2
commit
c51cb968e4
22 files changed
+841
-281
No files matched your search
@@ -73,7 +73,7 @@ pub(crate) struct SessionState {
|
||||
/// Persisted origin of the session base instructions, when known.
|
||||
pub(crate) base_instructions_provenance: Option<BaseInstructionsProvenance>,
|
||||
pub(crate) history: ContextManager,
|
||||
/// Cancels work bound to discarded history. Appends and compaction preserve it.
|
||||
/// Cancels work bound to discarded history or a superseded Guardian evidence policy.
|
||||
pub(crate) history_reset: CancellationToken,
|
||||
pub(crate) latest_rate_limits: Option<RateLimitSnapshot>,
|
||||
pub(crate) latest_token_usage_record: Option<TokenUsageRecord>,
|
||||
@@ -191,12 +191,19 @@ impl SessionState {
|
||||
reference_context_item: Option<TurnContextItem>,
|
||||
replacement: HistoryReplacement,
|
||||
) {
|
||||
match replacement {
|
||||
HistoryReplacement::Compaction => self.history.replace_compacted(items),
|
||||
let invalidate_reviews = match replacement {
|
||||
HistoryReplacement::Compaction {
|
||||
reviewer_compaction_hash,
|
||||
} => self
|
||||
.history
|
||||
.replace_compacted(items, reviewer_compaction_hash.as_deref()),
|
||||
HistoryReplacement::Reset => {
|
||||
self.history.replace_annotated(items);
|
||||
std::mem::take(&mut self.history_reset).cancel();
|
||||
true
|
||||
}
|
||||
};
|
||||
if invalidate_reviews {
|
||||
std::mem::take(&mut self.history_reset).cancel();
|
||||
}
|
||||
self.history
|
||||
.set_reference_context_item(reference_context_item);
|
||||
|
||||
Reference in new issue
Block a user