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:
felixxia-oai
2026-11-26 17:16:53 +00:00
committed by copyberry
parent a705e0bb69
commit 58961aa3a2
12 changed files with 178 additions and 84 deletions
+7 -2
View File
@@ -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}"));
+6 -4
View File
@@ -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,
+6 -2
View File
@@ -77,8 +77,12 @@ pub fn features_schema(schema_gen: &mut SchemaGenerator) -> Schema {
);
continue;
}
if feature.id == codex_features::Feature::GuardianThreadContext {
// This setting is already part of the guardianv2 feature table.
if matches!(
feature.id,
codex_features::Feature::GuardianThreadContext
| codex_features::Feature::GuardianV3Shadow
) {
// These settings already belong to their respective Guardian feature tables.
continue;
}
if feature.id == codex_features::Feature::GuardianV2 {
+5 -7
View File
@@ -1135,9 +1135,6 @@
"guardianv3": {
"$ref": "#/definitions/FeatureToml_for_GuardianV3ConfigToml"
},
"guardianv3_shadow": {
"type": "boolean"
},
"hooks": {
"type": "boolean"
},
@@ -2553,7 +2550,7 @@
"type": "integer"
},
"message_board_in_memory": {
"description": "Keep each fresh root's Guardian board in memory until the runtime closes. Defaults to false.",
"description": "Defaults to true for shadow boards and false for live boards. False disables shadow reviews.",
"type": "boolean"
},
"reviewer": {
@@ -2564,6 +2561,10 @@
"format": "uint32",
"minimum": 1.0,
"type": "integer"
},
"shadow_enabled": {
"description": "Run shadow reviews alongside Guardian V2 without changing approval decisions. Ignored in project config.",
"type": "boolean"
}
},
"type": "object"
@@ -8534,9 +8535,6 @@
"guardianv3": {
"$ref": "#/definitions/FeatureToml_for_GuardianV3ConfigToml"
},
"guardianv3_shadow": {
"type": "boolean"
},
"hooks": {
"type": "boolean"
},
+3
View File
@@ -12648,6 +12648,7 @@ async fn explicit_feature_config_is_normalized_by_requirements() -> std::io::Res
[features]
view_image = false
shell_tool = true
guardianv3.shadow_enabled = true
"#,
)?;
@@ -12660,6 +12661,7 @@ shell_tool = true
[features]
view_image = true
shell_tool = false
"guardianv3.shadow_enabled" = false
"#,
),
)
@@ -12668,6 +12670,7 @@ shell_tool = false
assert!(config.features.enabled(Feature::ViewImage));
assert!(!config.features.enabled(Feature::ShellTool));
assert!(!config.features.enabled(Feature::GuardianV3Shadow));
assert!(
!config
.startup_warnings
+5 -4
View File
@@ -122,13 +122,14 @@ impl ActorReviewer {
if let Some(binding) = &state.binding {
return Ok(binding.clone());
}
let delivery = state
let published = state
.tree
.delivery
.board
.get()
.ok_or(ReviewPreparationError::EvidenceUnavailable)?;
let binding = LiveRetrievalBinding::new(board, self.actor, self.path.clone(), delivery)
.map_err(|_| ReviewPreparationError::EvidenceUnavailable)?;
let binding =
LiveRetrievalBinding::new(board, self.actor, self.path.clone(), &published.delivery)
.map_err(|_| ReviewPreparationError::EvidenceUnavailable)?;
Ok(state.binding.insert(binding).clone())
}
+78 -52
View File
@@ -26,7 +26,7 @@ use codex_extension_api::TurnAbortInput;
use codex_extension_api::TurnLifecycleContributor;
use codex_extension_api::TurnStartInput;
use codex_extension_api::TurnStopInput;
use codex_features::GuardianV3HousekeeperConfigToml;
use codex_features::GuardianV3ConfigToml;
use codex_guardian_reviewer::ReviewerTasks;
use codex_guardian_reviewer::routes_approval_policy_to_guardian;
use codex_history::HistoryInitialization;
@@ -64,29 +64,10 @@ pub fn install(
config: &Config,
board_host: impl Fn(ThreadId) -> Arc<dyn MessageBoardHost> + Send + Sync + 'static,
) {
let settings = config.guardian_v3.as_deref();
let host = Arc::new(Host {
shadow: false,
live: Some(Arc::new(BoardSettings::live(config))),
manager,
deliveries: Arc::default(),
storage: if settings
.and_then(|settings| settings.message_board_in_memory)
.unwrap_or(false)
{
BoardStorage::Memory
} else {
BoardStorage::File(config.sqlite_config().clone())
},
housekeeper: Arc::new(
settings
.and_then(|settings| settings.housekeeper.clone())
.unwrap_or_default(),
),
retrieval: crate::board_retrieval(
settings
.and_then(|settings| settings.reviewer.as_ref())
.and_then(|reviewer| reviewer.retrieval_instructions.as_deref()),
),
board_host: Arc::new(board_host),
});
registry.thread_lifecycle_contributor(host.clone());
@@ -100,12 +81,9 @@ pub fn install_shadow(
board_host: impl Fn(ThreadId) -> Arc<dyn MessageBoardHost> + Send + Sync + 'static,
) {
let host = Arc::new(Host {
shadow: true,
live: None,
manager,
deliveries: Arc::default(),
storage: BoardStorage::Memory,
housekeeper: Arc::default(),
retrieval: crate::board_retrieval(/*instructions*/ None),
board_host: Arc::new(board_host),
});
registry.thread_lifecycle_contributor(host.clone());
@@ -115,11 +93,13 @@ pub fn install_shadow(
impl Host {
fn enabled(&self, config: &Config) -> bool {
!self.shadow
self.live.is_some()
|| (config
.features
.enabled(codex_features::Feature::GuardianV3Shadow)
&& config.features.enabled(codex_features::Feature::GuardianV2)
// A shadow must never open the durable board used by live GV3.
&& message_board_in_memory(config).unwrap_or(true)
&& routes_approval_policy_to_guardian(
config.permissions.approval_policy.value(),
config.approvals_reviewer,
@@ -136,17 +116,57 @@ enum IntakeStart {
Restart,
}
#[derive(Clone)]
fn message_board_in_memory(config: &Config) -> Option<bool> {
config.guardian_v3.as_ref()?.message_board_in_memory
}
enum BoardStorage {
File(SqliteConfig),
Memory,
}
struct BoardSettings {
storage: BoardStorage,
config: Arc<GuardianV3ConfigToml>,
retrieval: ReviewRetrieval,
}
impl BoardSettings {
fn live(config: &Config) -> Self {
let storage = if message_board_in_memory(config).unwrap_or(false) {
BoardStorage::Memory
} else {
BoardStorage::File(config.sqlite_config().clone())
};
Self::new(config, storage)
}
fn new(config: &Config, storage: BoardStorage) -> Self {
let config = config.guardian_v3.clone().unwrap_or_default();
let retrieval = crate::board_retrieval(
config
.reviewer
.as_ref()
.and_then(|reviewer| reviewer.retrieval_instructions.as_deref()),
);
Self {
storage,
config,
retrieval,
}
}
}
pub(super) struct PublishedBoard {
pub(super) delivery: Arc<LiveDelivery>,
retrieval: ReviewRetrieval,
}
// Shared by loaded actors, even before their first review.
// Only the root can initialize the cursor, using its own history.
#[derive(Default)]
pub(super) struct TreeDelivery {
pub(super) delivery: OnceLock<Arc<LiveDelivery>>,
pub(super) board: OnceLock<PublishedBoard>,
stop: CancellationToken,
shadow_intake_stopped: CancellationToken,
actors: Mutex<Vec<Weak<ActorReviewer>>>,
@@ -154,12 +174,10 @@ pub(super) struct TreeDelivery {
#[derive(Clone)]
struct Host {
shadow: bool,
// Live settings come from server startup. Shadow settings come from each root.
live: Option<Arc<BoardSettings>>,
manager: Weak<ThreadManager>,
deliveries: Arc<Mutex<HashMap<ThreadId, Weak<TreeDelivery>>>>,
storage: BoardStorage,
housekeeper: Arc<GuardianV3HousekeeperConfigToml>,
retrieval: ReviewRetrieval,
board_host: Arc<dyn Fn(ThreadId) -> Arc<dyn MessageBoardHost> + Send + Sync>,
}
@@ -208,6 +226,7 @@ impl Host {
&self,
identity: &shadow::Actor,
tree: &Arc<TreeDelivery>,
retrieval: &ReviewRetrieval,
cancellation: CancellationToken,
) -> Arc<ActorReviewer> {
Arc::new(ActorReviewer::new(
@@ -215,7 +234,7 @@ impl Host {
identity.root,
identity.actor,
identity.path.clone(),
self.retrieval.clone(),
retrieval.clone(),
Arc::clone(tree),
cancellation,
))
@@ -227,6 +246,7 @@ impl Host {
tree: &TreeDelivery,
thread: &ExtensionData,
start: IntakeStart,
settings: &BoardSettings,
) -> anyhow::Result<()> {
let history = self
.manager
@@ -235,7 +255,7 @@ impl Host {
.thread_store();
let cursor = match start {
IntakeStart::Initial(mode, initialization) => {
if matches!(self.storage, BoardStorage::Memory) {
if matches!(settings.storage, BoardStorage::Memory) {
anyhow::ensure!(
matches!(
initialization,
@@ -253,7 +273,7 @@ impl Host {
}
};
let board_host = (self.board_host)(root);
let board = match &self.storage {
let board = match &settings.storage {
BoardStorage::File(sqlite) => {
local_board(sqlite.clone(), root.into())
.read_write()
@@ -282,10 +302,11 @@ impl Host {
};
let (wake, mut wakes) = mpsc::channel::<Option<oneshot::Sender<()>>>(1);
let initial_position = cursor.position();
let delivery = Arc::clone(
tree.delivery
.get_or_init(|| Arc::new(LiveDelivery::from_cursor(cursor))),
);
let published = tree.board.get_or_init(|| PublishedBoard {
delivery: Arc::new(LiveDelivery::from_cursor(cursor)),
retrieval: settings.retrieval.clone(),
});
let delivery = Arc::clone(&published.delivery);
let saved = delivery.cursor();
// A surviving child can keep a cursor behind the resumed root's history tail.
if saved.position().thread_id == initial_position.thread_id
@@ -293,11 +314,11 @@ impl Host {
{
let _ = wake.try_send(None);
}
let shadow = self.shadow;
let shadow = self.live.is_none();
let intake_guard = shadow.then(|| tree.shadow_intake_stopped.clone().drop_guard());
let metrics = thread.get::<ShadowMetrics>();
let manager = self.manager.clone();
let settings = Arc::clone(&self.housekeeper);
let config = Arc::clone(&settings.config);
let cancellation = lifetime.cancellation.clone();
lifetime.tasks.spawn(async move {
let mut failure_stage = "housekeeper";
@@ -360,13 +381,10 @@ impl Host {
Arc::clone(&delivery),
&parent,
&manager,
&settings,
config.housekeeper.as_ref().unwrap_or(&Default::default()),
).await?;
if shadow {
let config = parent.config().await;
let limit = config.guardian_v3.as_ref()
.and_then(|v3| v3.shadow_board_limit_mib);
worker.shadow_size = Some(BoardSize::new(limit));
worker.shadow_size = Some(BoardSize::new(config.shadow_board_limit_mib));
}
anyhow::Ok(worker)
};
@@ -409,7 +427,7 @@ impl Host {
}
});
thread.insert(RootWorker {
shadow: self.shadow,
shadow,
wake,
lifetime,
reader,
@@ -430,7 +448,7 @@ impl ThreadLifecycleContributor<Config> for Host {
&& !input.session_source.is_internal()
&& input.thread_store.level_id() == input.session_store.level_id()
{
if self.shadow {
if self.live.is_none() {
// Observe settings changes even before the root is ready.
input.thread_store.insert(shadow::Enrollment::default());
if let Some(metrics) = input.extension_metrics {
@@ -470,7 +488,7 @@ impl ThreadLifecycleContributor<Config> for Host {
return;
};
let identity = shadow::Actor { root, actor, path };
if self.shadow {
let Some(settings) = &self.live else {
// Only the root supplies history. Children can inherit context and share its board.
if actor == root
&& (input.history_mode
@@ -482,10 +500,15 @@ impl ThreadLifecycleContributor<Config> for Host {
input.thread_store.insert(identity);
self.start_shadow_if_needed(input.thread_store);
return;
}
};
let tree = self.tree_delivery(root);
// The authoritative reviewer must stay attached even if intake fails.
let reviewer = self.reviewer(&identity, &tree, tree.stop.child_token());
let reviewer = self.reviewer(
&identity,
&tree,
&settings.retrieval,
tree.stop.child_token(),
);
let attached: Arc<dyn codex_core::guardian_review::AttachedReviewer> = reviewer.clone();
input.thread_store.insert_arc(Arc::clone(&reviewer));
input.thread_store.insert(attached);
@@ -493,7 +516,10 @@ impl ThreadLifecycleContributor<Config> for Host {
return;
}
let start = IntakeStart::Initial(input.history_mode, input.history_initialization);
if let Err(error) = self.activate(root, &tree, input.thread_store, start).await {
if let Err(error) = self
.activate(root, &tree, input.thread_store, start, settings)
.await
{
tracing::warn!(%root, error = %error, "Guardian intake unavailable");
return;
}
+38 -8
View File
@@ -533,6 +533,8 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
use core_test_support::load_guardian_policy_snapshot;
use futures::FutureExt;
const ROUTING: &str = "Group deployment requests by service.";
const ROOT_GUIDANCE: &str = "Look for revocations in release channels.";
type ReviewerChange = (ApprovalsReviewer, ApprovalsReviewer);
struct RecordReviewerChange;
@@ -564,6 +566,16 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
.with_config(|config| {
config.features.enable(Feature::GuardianV2).unwrap();
config.features.enable(Feature::GuardianV3Shadow).unwrap();
config.guardian_v3 = Some(Arc::new(codex_features::GuardianV3ConfigToml {
housekeeper: Some(codex_features::GuardianV3HousekeeperConfigToml {
routing_instructions: Some(ROUTING.to_owned()),
..Default::default()
}),
reviewer: Some(codex_features::GuardianV3ReviewerConfigToml {
retrieval_instructions: Some(ROOT_GUIDANCE.to_owned()),
}),
..Default::default()
}));
config.requested_approvals_reviewer = Some(ApprovalsReviewer::AutoReview);
config.approvals_reviewer = ApprovalsReviewer::AutoReview;
config
@@ -614,12 +626,15 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
};
let turns = &registry.turn_lifecycle_contributors()[0];
// Force the first lookup to fail, then retry with the live manager on a turn.
for (enrolled, history, expected) in [
(false, HistoryInitialization::New, false),
(true, HistoryInitialization::ColdResume, false),
(true, HistoryInitialization::WarmFork, false),
(true, HistoryInitialization::New, true),
for (enrolled, in_memory, history, expected) in [
(false, None, HistoryInitialization::New, false),
(true, Some(false), HistoryInitialization::New, false),
(true, None, HistoryInitialization::ColdResume, false),
(true, None, HistoryInitialization::WarmFork, false),
(true, None, HistoryInitialization::New, true),
] {
Arc::make_mut(config.guardian_v3.as_mut().context("root settings")?)
.message_board_in_memory = in_memory;
if enrolled {
config.features.enable(Feature::GuardianV3Shadow)?;
}
@@ -678,9 +693,12 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
agent_nickname: None,
agent_role: None,
});
// A child can lack the root's thread-start prompt override.
let mut child_config = config.clone();
child_config.guardian_v3 = None;
lifecycle
.on_thread_ready(ThreadReadyInput {
config: &config,
config: &child_config,
session_source: &source,
history_initialization: HistoryInitialization::WarmFork,
history_mode: ThreadHistoryMode::Paginated,
@@ -691,6 +709,13 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
let child_reviewer = child_store
.get::<ShadowReviewer>()
.context("child reviewer")?;
assert!(child_store.get::<super::RootWorker>().is_none());
for reviewer in [&old_reviewer, &child_reviewer] {
assert!(matches!(
reviewer.reviewer.retrieval(),
codex_core::guardian_review::ReviewRetrieval::Extension(prompt) if prompt.contains(ROOT_GUIDANCE)
));
}
if let Some((message_kib, expected_calls)) = overflow {
use serde_json::json;
@@ -719,7 +744,7 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
.map(|name| json!({"channel": name, "description": "Seed"}))
.collect();
let seed = json!({"routes": [channels], "descriptions": descriptions});
let _seed = mount_sse_once(
let seed_request = mount_sse_once(
&server,
sse(vec![
ev_assistant_message("seed", &seed.to_string()),
@@ -730,6 +755,12 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
let mut routed = NamedTraceEvents::subscribe("guardian_v3.housekeeping_routed");
append(/*order*/ 1, /*kib*/ 62).await?;
routed.next().await?;
assert!(
seed_request
.single_request()
.instructions_text()
.contains(ROUTING)
);
let query = codex_message_board::ChannelQuery {
query: None,
direction: codex_message_board::SortDirection::OldestFirst,
@@ -770,7 +801,6 @@ async fn shadow_intake_enrolls_only_new_opted_in_roots(
test.codex.shutdown_and_wait().await?;
return Ok(());
}
assert!(child_store.get::<super::RootWorker>().is_none());
// A terminal capture error closes admission for the whole board, even without metrics.
test.thread_store
+9 -3
View File
@@ -17,6 +17,8 @@ use codex_protocol::ThreadId;
use tokio_util::task::TaskTracker;
use super::ActorReviewer;
use super::BoardSettings;
use super::BoardStorage;
use super::Host;
use super::IntakeStart;
use super::RootWorker;
@@ -112,11 +114,14 @@ impl ConfigContributor<Config> for Host {
impl Host {
fn attach_shadow(&self, thread: &ExtensionData, identity: &Actor, tree: &Arc<TreeDelivery>) {
let mut actors = tree.actors.lock().unwrap_or_else(PoisonError::into_inner);
if tree.stop.is_cancelled() || tree.delivery.get().is_none() {
if tree.stop.is_cancelled() {
return;
}
let Some(board) = tree.board.get() else {
return;
};
let cancellation = tree.stop.child_token();
let reviewer = self.reviewer(identity, tree, cancellation.clone());
let reviewer = self.reviewer(identity, tree, &board.retrieval, cancellation.clone());
actors.retain(|actor| actor.strong_count() > 0);
actors.push(Arc::downgrade(&reviewer));
thread.insert_arc(Arc::clone(&reviewer));
@@ -189,7 +194,8 @@ impl Host {
}
}
let thread = root_thread.thread_extension_data();
host.activate(root, &tree, thread, start).await?;
let settings = BoardSettings::new(root_thread.config().await.as_ref(), BoardStorage::Memory);
host.activate(root, &tree, thread, start, &settings).await?;
host.attach_shadow(thread, &identity, &tree);
if !tree.stop.is_cancelled() {
let event_name = match start {
+4 -1
View File
@@ -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")]
+6 -1
View File
@@ -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,
},
+11
View File
@@ -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 {