Disable Guardian V2 for managed automatic reviewers (#39005)

## Why

Guardian V2 should not override a managed approval-reviewer policy that excludes
the user reviewer.

## What changed

- Force `features.guardianv2` off when `allowed_approvals_reviewers` does not
  include `user`, for both local requirements and cloud config bundles.
- Preserve Guardian V2 when the user reviewer remains allowed or when only
  legacy Guardian feature settings are present.
- Return the effective disabled value through `config/read`.

## Testing

Added coverage for cloud requirements and the app-server config RPC.

GitOrigin-RevId: 82b6d0aaf47fbaa58ae349d4e56777cd442f5807
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-08-17 13:16:05 +00:00
1 parent 8e89e98cf6
commit 02e9bfaac7
4 files changed
+91

No files matched your search

+9
View File
@@ -2,7 +2,9 @@ use codex_config::ConfigRequirements;
use codex_config::RequirementSource;
use codex_config::Sourced;
use codex_config::config_toml::ConfigToml;
use codex_config::types::ApprovalsReviewer;
use codex_config::types::FeedbackConfigToml;
use codex_features::FeatureToml;
use codex_utils_absolute_path::AbsolutePathBuf;
use std::path::Path;
@@ -31,6 +33,13 @@ pub(super) fn apply_to_config(
apply_exact!(model_catalog_json);
apply_exact!(check_for_update_on_startup);
apply_exact!(allow_login_shell);
if requirements
.approvals_reviewer
.can_set(&ApprovalsReviewer::User)
.is_err()
{
config.features.get_or_insert_default().guardianv2 = Some(FeatureToml::Enabled(false));
}
apply_feedback_requirement(
&mut config.feedback,
requirements.feedback.as_ref(),