Lightweight coding agent that runs in your terminal
Rust
Register the Guardian thread context feature flag (#42529)
felixxia-oai6d7f6dcd2285
diff --git a/codex-rs/core/config.schema.json b/codex-rs/core/config.schema.jsonindex d2bd3b9db0..5fc55ff225 100644--- a/codex-rs/core/config.schema.json+++ b/codex-rs/core/config.schema.json@@ -774,6 +774,9 @@"guardian_reuse_parent_compaction": {"type": "boolean"},+ "guardian_thread_context": {+ "type": "boolean"+ },"guardianv2": {"$ref": "#/definitions/FeatureToml_for_GuardianV2ConfigToml"},@@ -6122,6 +6125,9 @@"guardian_reuse_parent_compaction": {"type": "boolean"},+ "guardian_thread_context": {+ "type": "boolean"+ },"guardianv2": {"$ref": "#/definitions/FeatureToml_for_GuardianV2ConfigToml"},diff --git a/codex-rs/features/src/lib.rs b/codex-rs/features/src/lib.rsindex 6c307e4362..4bc7df19ce 100644--- a/codex-rs/features/src/lib.rs+++ b/codex-rs/features/src/lib.rs@@ -299,6 +299,9 @@ pub enum Feature {SendAsyncMessage,/// Enable automatic review for approval prompts.GuardianApproval,+ /// Select thread-owned context for both Guardian reviewers.+ /// Config-only until reviewer wiring lands; read from the thread's fixed feature set.+ GuardianThreadContext,/// Reuse encrypted parent compaction when restarting Guardian review sessions.GuardianReuseParentCompaction,/// Include completed node_repl or cua_repl Code Mode responses in Guardian reviews.@@ -1519,6 +1522,12 @@ pub const FEATURES: &[FeatureSpec] = &[stage: Stage::Stable,default_enabled: true,},+ FeatureSpec {+ id: Feature::GuardianThreadContext,+ key: "guardian_thread_context",+ stage: Stage::UnderDevelopment,+ default_enabled: false,+ },FeatureSpec {id: Feature::GuardianReuseParentCompaction,key: "guardian_reuse_parent_compaction",diff --git a/codex-rs/features/src/tests.rs b/codex-rs/features/src/tests.rsindex 5ad5132a2e..93ab6dc6d7 100644--- a/codex-rs/features/src/tests.rs+++ b/codex-rs/features/src/tests.rs@@ -162,6 +162,44 @@ fn guardian_v2_feature_config_preserves_boolean_toggle() {);}+#[test]+fn guardian_thread_context_resolves_boolean_config_and_profile_overrides() {+ for (base, profile, enabled) in [+ ("", "", false),+ ("guardian_thread_context = false", "", false),+ ("guardian_thread_context = true", "", true),+ (+ "guardian_thread_context = true",+ "guardian_thread_context = false",+ false,+ ),+ (+ "guardian_thread_context = false",+ "guardian_thread_context = true",+ true,+ ),+ ] {+ let base = toml::from_str::<FeaturesToml>(base).expect("base features");+ let profile = toml::from_str::<FeaturesToml>(profile).expect("profile features");+ let features = Features::from_sources(+ FeatureConfigSource {+ features: Some(&base),+ ..Default::default()+ },+ FeatureConfigSource {+ features: Some(&profile),+ ..Default::default()+ },+ FeatureOverrides::default(),+ );+ let mut expected = Features::with_defaults();+ if enabled {+ expected.enable(Feature::GuardianThreadContext);+ }+ assert_eq!(features.enabled_features(), expected.enabled_features());+ }+}+#[test]fn guardian_v2_feature_config_deserializes_classifier_and_transcript_settings() {let features: FeaturesToml = toml::from_str(