mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
Configure Guardian V3 shadow reviews from the root thread (#64187)
## Why Shadow reviews used default routing and retrieval instructions even when the root thread supplied Guardian V3 settings. ## What changed - Replace `features.guardianv3_shadow` with `features.guardianv3.shadow_enabled` to opt into shadow reviews alongside Guardian V2. Project config cannot set the toggle, and feature requirements can override it. - Use the root thread's routing instructions, retrieval instructions, and board size limit for its shadow board. Child reviewers share the root's board and retrieval instructions. - Keep shadow boards in memory and skip shadow reviews when `features.guardianv3.message_board_in_memory` is explicitly false. ## Testing Add coverage for shadow-only opt-in, config precedence, in-memory enrollment, and root routing and retrieval instructions. GitOrigin-RevId: 085089d70a66c535a86d31906ff59a449ffcb61f
This commit is contained in:
@@ -341,11 +341,14 @@ pub struct GuardianV3ConfigToml {
|
||||
/// Maximum evidence per root shadow board in MiB. Defaults to 32. Ignored in project config.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub shadow_board_limit_mib: Option<NonZeroU32>,
|
||||
/// Keep each fresh root's Guardian board in memory until the runtime closes. Defaults to false.
|
||||
/// Defaults to true for shadow boards and false for live boards. False disables shadow reviews.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub message_board_in_memory: Option<bool>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enabled: Option<bool>,
|
||||
/// Run shadow reviews alongside Guardian V2 without changing approval decisions. Ignored in project config.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub shadow_enabled: Option<bool>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub housekeeper: Option<GuardianV3HousekeeperConfigToml>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
||||
@@ -1113,6 +1113,11 @@ impl FeaturesToml {
|
||||
if let Some(enabled) = self.guardianv3.as_ref().and_then(FeatureToml::enabled) {
|
||||
entries.insert(Feature::GuardianV3.key().to_string(), enabled);
|
||||
}
|
||||
if let Some(FeatureToml::Config(config)) = &self.guardianv3
|
||||
&& let Some(enabled) = config.shadow_enabled
|
||||
{
|
||||
entries.insert(Feature::GuardianV3Shadow.key().to_string(), enabled);
|
||||
}
|
||||
if let Some(enabled) = self.multi_agent_v2.as_ref().and_then(FeatureToml::enabled) {
|
||||
entries.insert(Feature::MultiAgentV2.key().to_string(), enabled);
|
||||
}
|
||||
@@ -2396,7 +2401,7 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::GuardianV3Shadow,
|
||||
key: "guardianv3_shadow",
|
||||
key: "guardianv3.shadow_enabled",
|
||||
stage: Stage::UnderDevelopment,
|
||||
default_enabled: false,
|
||||
},
|
||||
|
||||
@@ -251,6 +251,16 @@ fn guardian_v3_feature_config_resolves_base_and_profile_toggles() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn guardian_v3_shadow_does_not_enable_live_review() {
|
||||
let features: FeaturesToml =
|
||||
toml::from_str("[guardianv3]\nshadow_enabled = true").expect("Guardian V3 shadow settings");
|
||||
assert_eq!(
|
||||
features.entries(),
|
||||
BTreeMap::from([("guardianv3.shadow_enabled".to_owned(), true)])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn guardian_v3_prompt_settings_do_not_implicitly_enable_the_feature() {
|
||||
let features: FeaturesToml = toml::from_str(
|
||||
@@ -272,6 +282,7 @@ retrieval_instructions = "Search before assessing deployments."
|
||||
features.guardianv3,
|
||||
Some(FeatureToml::Config(crate::GuardianV3ConfigToml {
|
||||
shadow_board_limit_mib: std::num::NonZeroU32::new(32),
|
||||
shadow_enabled: None,
|
||||
enabled: None,
|
||||
message_board_in_memory: Some(true),
|
||||
housekeeper: Some(crate::GuardianV3HousekeeperConfigToml {
|
||||
|
||||
Reference in New Issue
Block a user