Register the Guardian thread context feature flag (#42529)

## What changed

- Add the disabled, under-development `guardian_thread_context` feature flag for selecting thread-owned context for Guardian reviewers.
- Expose the boolean setting in the generated configuration schema.
- Verify default, base configuration, and profile override resolution.

GitOrigin-RevId: c4878be96d12f4ccd84356df15d3e55f13ac141f
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-09-03 14:35:02 +00:00
1 parent 728cb12fe5
commit 6d7f6dcd22
3 files changed
+53

No files matched your search

+6
View File
@@ -774,6 +774,9 @@
"guardian_reuse_parent_compaction": { "guardian_reuse_parent_compaction": {
"type": "boolean" "type": "boolean"
}, },
"guardian_thread_context": {
"type": "boolean"
},
"guardianv2": { "guardianv2": {
"$ref": "#/definitions/FeatureToml_for_GuardianV2ConfigToml" "$ref": "#/definitions/FeatureToml_for_GuardianV2ConfigToml"
}, },
@@ -6122,6 +6125,9 @@
"guardian_reuse_parent_compaction": { "guardian_reuse_parent_compaction": {
"type": "boolean" "type": "boolean"
}, },
"guardian_thread_context": {
"type": "boolean"
},
"guardianv2": { "guardianv2": {
"$ref": "#/definitions/FeatureToml_for_GuardianV2ConfigToml" "$ref": "#/definitions/FeatureToml_for_GuardianV2ConfigToml"
}, },
+9
View File
@@ -299,6 +299,9 @@ pub enum Feature {
SendAsyncMessage, SendAsyncMessage,
/// Enable automatic review for approval prompts. /// Enable automatic review for approval prompts.
GuardianApproval, 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. /// Reuse encrypted parent compaction when restarting Guardian review sessions.
GuardianReuseParentCompaction, GuardianReuseParentCompaction,
/// Include completed node_repl or cua_repl Code Mode responses in Guardian reviews. /// Include completed node_repl or cua_repl Code Mode responses in Guardian reviews.
@@ -1519,6 +1522,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::Stable, stage: Stage::Stable,
default_enabled: true, default_enabled: true,
}, },
FeatureSpec {
id: Feature::GuardianThreadContext,
key: "guardian_thread_context",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec { FeatureSpec {
id: Feature::GuardianReuseParentCompaction, id: Feature::GuardianReuseParentCompaction,
key: "guardian_reuse_parent_compaction", key: "guardian_reuse_parent_compaction",
+38
View File
@@ -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] #[test]
fn guardian_v2_feature_config_deserializes_classifier_and_transcript_settings() { fn guardian_v2_feature_config_deserializes_classifier_and_transcript_settings() {
let features: FeaturesToml = toml::from_str( let features: FeaturesToml = toml::from_str(