mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:50:52 +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:
@@ -1385,7 +1385,11 @@ fn sanitize_project_config(
|
||||
.get_mut("guardianv3")
|
||||
.and_then(TomlValue::as_table_mut)
|
||||
{
|
||||
for key in ["max_instruction_tokens", "shadow_board_limit_mib"] {
|
||||
for key in [
|
||||
"max_instruction_tokens",
|
||||
"shadow_board_limit_mib",
|
||||
"shadow_enabled",
|
||||
] {
|
||||
if guardian.remove(key).is_some() {
|
||||
ignored_keys.push(format!("features.guardianv3.{key}"));
|
||||
}
|
||||
@@ -1416,7 +1420,8 @@ fn sanitize_project_config(
|
||||
"respect_system_proxy",
|
||||
"system_proxy_fallback",
|
||||
"credential_masking",
|
||||
"guardianv3_shadow",
|
||||
// A quoted dotted key is a literal feature name, outside the table above.
|
||||
"guardianv3.shadow_enabled",
|
||||
] {
|
||||
if features.remove(key).is_some() {
|
||||
ignored_keys.push(format!("features.{key}"));
|
||||
|
||||
@@ -1310,11 +1310,12 @@ async fn local_layers_keep_raw_paths_order_and_legacy_requirements() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_config_cannot_override_guardian_v3_prompts_or_limits() {
|
||||
fn project_config_cannot_override_guardian_v3_prompts_limits_or_shadow_toggle() {
|
||||
let mut project: TomlValue = toml::toml! {
|
||||
[features.guardianv3]
|
||||
max_instruction_tokens = 1
|
||||
shadow_board_limit_mib = 512
|
||||
shadow_enabled = true
|
||||
[features.guardianv3.housekeeper]
|
||||
routing_instructions = "Use project routing"
|
||||
batch_timeout_ms = 15000
|
||||
@@ -1342,6 +1343,7 @@ fn project_config_cannot_override_guardian_v3_prompts_or_limits() {
|
||||
[
|
||||
"features.guardianv3.max_instruction_tokens",
|
||||
"features.guardianv3.shadow_board_limit_mib",
|
||||
"features.guardianv3.shadow_enabled",
|
||||
"features.guardianv3.housekeeper.routing_instructions",
|
||||
"features.guardianv3.reviewer.retrieval_instructions",
|
||||
]
|
||||
@@ -1363,7 +1365,7 @@ fn project_config_cannot_override_guardian_v3_prompts_or_limits() {
|
||||
#[test]
|
||||
fn project_config_ignores_positional_guardian_v3_settings() {
|
||||
let mut project: TomlValue =
|
||||
toml::from_str("features.guardianv3 = [512, true, true, {}, {}, 1]").unwrap();
|
||||
toml::from_str("features.guardianv3 = [512, true, true, true, {}, {}, 1]").unwrap();
|
||||
let sanitize = |project: &mut TomlValue| {
|
||||
sanitize_project_config(project, CredentialBrokerProjectState::Unconfigured, &[])
|
||||
};
|
||||
@@ -1396,11 +1398,11 @@ fn project_config_cannot_change_protected_features() {
|
||||
"respect_system_proxy",
|
||||
"system_proxy_fallback",
|
||||
"credential_masking",
|
||||
"guardianv3_shadow",
|
||||
"guardianv3.shadow_enabled",
|
||||
] {
|
||||
for enabled in [false, true] {
|
||||
let mut config: TomlValue =
|
||||
toml::from_str(&format!("[features]\n{key} = {enabled}\nplugins = true"))
|
||||
toml::from_str(&format!("[features]\n'{key}' = {enabled}\nplugins = true"))
|
||||
.expect("valid project config");
|
||||
let ignored = sanitize_project_config(
|
||||
&mut config,
|
||||
|
||||
Reference in New Issue
Block a user