Lightweight coding agent that runs in your terminal
Rust
fix: deprecate use_legacy_landlock feature flag (#17971)
viyatb-oai2967900d810e
diff --git a/codex-rs/core/tests/suite/deprecation_notice.rs b/codex-rs/core/tests/suite/deprecation_notice.rsindex 26a56c86e2..dc7280ea32 100644--- a/codex-rs/core/tests/suite/deprecation_notice.rs+++ b/codex-rs/core/tests/suite/deprecation_notice.rs@@ -161,3 +161,45 @@ async fn emits_deprecation_notice_for_web_search_feature_flag_values() -> anyhowOk(())}++#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn emits_deprecation_notice_for_use_legacy_landlock() -> anyhow::Result<()> {+ skip_if_no_network!(Ok(()));++ let server = start_mock_server().await;++ let mut builder = test_codex().with_config(|config| {+ let mut entries = BTreeMap::new();+ entries.insert("use_legacy_landlock".to_string(), true);+ let mut features = config.features.get().clone();+ features.apply_map(&entries);+ config+ .features+ .set(features)+ .expect("test config should allow managed feature map updates");+ });++ let TestCodex { codex, .. } = builder.build(&server).await?;++ let notice = wait_for_event_match(&codex, |event| match event {+ EventMsg::DeprecationNotice(ev)+ if ev.summary.contains("[features].use_legacy_landlock") =>+ {+ Some(ev.clone())+ }+ _ => None,+ })+ .await;++ let DeprecationNoticeEvent { summary, details } = notice;+ assert_eq!(+ summary,+ "`[features].use_legacy_landlock` is deprecated and will be removed soon.".to_string(),+ );+ assert_eq!(+ details.as_deref(),+ Some("Remove this setting to stop opting into the legacy Linux sandbox behavior."),+ );++ Ok(())+}diff --git a/codex-rs/features/src/lib.rs b/codex-rs/features/src/lib.rsindex a2e656be44..586c366850 100644--- a/codex-rs/features/src/lib.rs+++ b/codex-rs/features/src/lib.rs@@ -371,6 +371,12 @@ impl Features {"image_detail_original" => {continue;}+ "use_legacy_landlock" => {+ self.record_legacy_usage_force(+ "features.use_legacy_landlock",+ Feature::UseLegacyLandlock,+ );+ }_ => {}}match feature_for_key(k) {@@ -456,6 +462,19 @@ fn legacy_usage_notice(alias: &str, feature: Feature) -> (String, Option<String>format!("`{label}` is deprecated because web search is enabled by default.");(summary, Some(web_search_details().to_string()))}+ Feature::UseLegacyLandlock => {+ let label = match alias {+ "features.use_legacy_landlock" | "use_legacy_landlock" => {+ "[features].use_legacy_landlock"+ }+ _ => alias,+ };+ let summary = format!("`{label}` is deprecated and will be removed soon.");+ let details =+ "Remove this setting to stop opting into the legacy Linux sandbox behavior."+ .to_string();+ (summary, Some(details))+ }_ => {let label = if alias.contains('.') || alias.starts_with('[') {alias.to_string()@@ -728,7 +747,7 @@ pub const FEATURES: &[FeatureSpec] = &[FeatureSpec {id: Feature::UseLegacyLandlock,key: "use_legacy_landlock",- stage: Stage::Stable,+ stage: Stage::Deprecated,default_enabled: false,},FeatureSpec {diff --git a/codex-rs/features/src/tests.rs b/codex-rs/features/src/tests.rsindex d2f73cedad..fc81c73085 100644--- a/codex-rs/features/src/tests.rs+++ b/codex-rs/features/src/tests.rs@@ -42,8 +42,8 @@ fn default_enabled_features_are_stable() {}#[test]-fn use_legacy_landlock_is_stable_and_disabled_by_default() {- assert_eq!(Feature::UseLegacyLandlock.stage(), Stage::Stable);+fn use_legacy_landlock_is_deprecated_and_disabled_by_default() {+ assert_eq!(Feature::UseLegacyLandlock.stage(), Stage::Deprecated);assert_eq!(Feature::UseLegacyLandlock.default_enabled(), false);}@@ -166,6 +166,28 @@ fn image_generation_is_stable_and_enabled_by_default() {assert_eq!(Feature::ImageGeneration.default_enabled(), true);}+#[test]+fn use_legacy_landlock_config_records_deprecation_notice() {+ let mut entries = BTreeMap::new();+ entries.insert("use_legacy_landlock".to_string(), true);++ let mut features = Features::with_defaults();+ features.apply_map(&entries);++ let usages = features.legacy_feature_usages().collect::<Vec<_>>();+ assert_eq!(usages.len(), 1);+ assert_eq!(usages[0].alias, "features.use_legacy_landlock");+ assert_eq!(usages[0].feature, Feature::UseLegacyLandlock);+ assert_eq!(+ usages[0].summary,+ "`[features].use_legacy_landlock` is deprecated and will be removed soon."+ );+ assert_eq!(+ usages[0].details.as_deref(),+ Some("Remove this setting to stop opting into the legacy Linux sandbox behavior.")+ );+}+#[test]fn image_detail_original_is_a_removed_feature_key() {assert_eq!(