mirror of
https://github.com/openai/codex.git
synced 2026-11-03 16:23:51 +00:00
Centralize Guardian context mode and checkpoint policy (#43458)
## What changed Resolve `GuardianContextMode` once at session construction and share it across history retention, replay, evidence capture, compaction, and review consumers. Extract synchronous reviewer context policy and consolidate Guardian V2 parent checkpoint selection so sampling and fast approval use the same eligibility checks. Preserve legacy checkpoint omission and strict compatibility requirements for thread-owned context. ## Testing Adapt existing review and history tests to the explicit context mode. Move checkpoint tests alongside the extracted selector, retaining coverage for latest-item identity, unusable checkpoints, and complete-item size limits. GitOrigin-RevId: c73fb6fea556921acfffe758a5f709d7494019dd
This commit is contained in:
1 parent
f3f53ee949
commit
8260619cb6
26 files changed
+599
-482
No files matched your search
@@ -1,3 +1,4 @@
|
||||
use crate::context::GuardianContextMode;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
|
||||
@@ -32,7 +33,6 @@ use codex_analytics::CompactionTrigger;
|
||||
use codex_analytics::now_unix_seconds;
|
||||
use codex_context_fragments::AnnotatedContent;
|
||||
use codex_context_fragments::set_annotated_content;
|
||||
use codex_features::Feature;
|
||||
use codex_history::CodexHarnessMetadata;
|
||||
use codex_history::ResponseItemEnvelope;
|
||||
use codex_protocol::ResponseItemId;
|
||||
@@ -357,7 +357,7 @@ async fn run_compact_task_inner_impl(
|
||||
let summary_suffix =
|
||||
get_last_assistant_message_from_turn(history_snapshot.raw_items()).unwrap_or_default();
|
||||
let summary_text = format!("{SUMMARY_PREFIX}\n{summary_suffix}");
|
||||
let identity = if sess.enabled(Feature::GuardianThreadContext) {
|
||||
let identity = if sess.guardian_context_mode == GuardianContextMode::ThreadOwned {
|
||||
CompactedMessageIdentity::Preserve
|
||||
} else {
|
||||
CompactedMessageIdentity::Regenerate
|
||||
|
||||
Reference in new issue
Block a user