mirror of
https://github.com/openai/codex.git
synced 2026-09-20 12:47:38 +00:00
Enable Guardian parent-compaction reuse by default (#46522)
## What changed Promote `guardian_reuse_parent_compaction` to stable and enable it by default, allowing Guardian to reuse encrypted parent compaction when restarting review sessions. ## Testing Update Guardian tests to rely on the default setting, including evidence retention after compaction and resume. Adjust cache-key assertions to verify that parent-history changes invalidate cached review sessions by default, while explicitly disabling reuse preserves the previous behavior. GitOrigin-RevId: 196aff1e91d022490b3782f6c7b5f168907efab9
This commit is contained in:
@@ -280,7 +280,6 @@ async fn guardians_retain_evidence_after_compaction_and_resume(
|
||||
.with_root_config("approvals_reviewer = \"auto_review\"\nmodel_auto_compact_token_limit = 1000000")
|
||||
.enable_feature(Feature::DefaultModeRequestUserInput)
|
||||
.enable_feature(Feature::GuardianApproval)
|
||||
.enable_feature(Feature::GuardianReuseParentCompaction)
|
||||
.disable_feature(Feature::EnableRequestCompression)
|
||||
.disable_feature(Feature::TokenBudget)
|
||||
.with_extra_config(&format!(
|
||||
|
||||
@@ -366,7 +366,7 @@ async fn guardian_review_session_config_change_invalidates_cached_session() {
|
||||
)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
assert_ne!(
|
||||
cached_reuse_key,
|
||||
GuardianReviewSessionReuseKey::from_spawn_config(
|
||||
&cached_spawn_config,
|
||||
@@ -414,20 +414,20 @@ async fn guardian_review_session_config_change_invalidates_cached_session() {
|
||||
"changing the effective Node REPL policy must invalidate reviewer history"
|
||||
);
|
||||
|
||||
let mut compaction_enabled_config = cached_spawn_config;
|
||||
compaction_enabled_config
|
||||
let mut compaction_disabled_config = cached_spawn_config;
|
||||
compaction_disabled_config
|
||||
.features
|
||||
.enable(Feature::GuardianReuseParentCompaction)
|
||||
.disable(Feature::GuardianReuseParentCompaction)
|
||||
.expect("Guardian parent-compaction reuse should be configurable");
|
||||
assert_ne!(
|
||||
assert_eq!(
|
||||
GuardianReviewSessionReuseKey::from_spawn_config(
|
||||
&compaction_enabled_config,
|
||||
&compaction_disabled_config,
|
||||
SessionInstructions::default(),
|
||||
/*parent_history_version*/ 0,
|
||||
GuardianContextMode::Legacy,
|
||||
),
|
||||
GuardianReviewSessionReuseKey::from_spawn_config(
|
||||
&compaction_enabled_config,
|
||||
&compaction_disabled_config,
|
||||
SessionInstructions::default(),
|
||||
/*parent_history_version*/ 1,
|
||||
GuardianContextMode::Legacy,
|
||||
@@ -441,9 +441,6 @@ async fn guardian_review_session_config_change_invalidates_cached_session() {
|
||||
async fn encrypted_parent_compaction_requires_original_item_id(thread_context_enabled: bool) {
|
||||
let (session, _) = crate::session::tests::make_session_and_context().await;
|
||||
let mut features = session.get_config().await.features.clone();
|
||||
features
|
||||
.enable(Feature::GuardianReuseParentCompaction)
|
||||
.expect("legacy reuse");
|
||||
features
|
||||
.set_enabled(Feature::GuardianThreadContext, thread_context_enabled)
|
||||
.expect("context mode");
|
||||
|
||||
@@ -2225,17 +2225,11 @@ async fn guardian_reuses_prompt_cache_key_and_appends_prior_reviews() -> anyhow:
|
||||
.await;
|
||||
|
||||
let (session, mut turn) = guardian_test_session_and_turn(&server).await;
|
||||
let mut config = (*turn.config).clone();
|
||||
config
|
||||
.features
|
||||
.enable(Feature::GuardianReuseParentCompaction)
|
||||
.expect("Guardian parent-compaction reuse should be configurable");
|
||||
let turn_mut = Arc::get_mut(&mut turn).expect("turn should be unique");
|
||||
update_turn_settings_for_test(turn_mut, |settings| {
|
||||
Arc::make_mut(&mut settings.model_info).auto_review_model_override =
|
||||
Some("codex-auto-review".to_string());
|
||||
});
|
||||
turn_mut.config = Arc::new(config);
|
||||
seed_guardian_parent_history(&session, &turn).await;
|
||||
|
||||
let first_request = GuardianApprovalRequest::ExecCommand {
|
||||
|
||||
@@ -1612,8 +1612,8 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
FeatureSpec {
|
||||
id: Feature::GuardianReuseParentCompaction,
|
||||
key: "guardian_reuse_parent_compaction",
|
||||
stage: Stage::UnderDevelopment,
|
||||
default_enabled: false,
|
||||
stage: Stage::Stable,
|
||||
default_enabled: true,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::GuardianEnhancedNodeReplTranscripts,
|
||||
|
||||
Reference in New Issue
Block a user