mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Guardian -> Auto-Review (#18021)
This PR is a user-facing change for our rebranding of guardian to auto-review.
This commit is contained in:
+11
-11
@@ -271,8 +271,8 @@ struct GuardianApprovalsMode {
|
||||
sandbox_policy: SandboxPolicy,
|
||||
}
|
||||
|
||||
/// Enabling the Guardian Approvals experiment in the TUI should also switch the
|
||||
/// current `/approvals` settings to the matching Guardian Approvals mode. Users
|
||||
/// Enabling the Auto-review experiment in the TUI should also switch the
|
||||
/// current `/approvals` settings to the matching Auto-review mode. Users
|
||||
/// can still change `/approvals` afterward; this just assumes that opting into
|
||||
/// the experiment means they want guardian review enabled immediately.
|
||||
fn guardian_approvals_mode() -> GuardianApprovalsMode {
|
||||
@@ -1279,7 +1279,7 @@ impl App {
|
||||
let mut approvals_reviewer_override = None;
|
||||
let mut sandbox_policy_override = None;
|
||||
let mut feature_updates_to_apply = Vec::with_capacity(updates.len());
|
||||
// Guardian Approvals owns `approvals_reviewer`, but disabling the feature
|
||||
// Auto-Review owns `approvals_reviewer`, but disabling the feature
|
||||
// from inside a profile should not silently clear a value configured at
|
||||
// the root scope.
|
||||
let (root_approvals_reviewer_blocks_profile_disable, profile_approvals_reviewer_configured) = {
|
||||
@@ -1312,7 +1312,7 @@ impl App {
|
||||
&& root_approvals_reviewer_blocks_profile_disable
|
||||
{
|
||||
self.chat_widget.add_error_message(
|
||||
"Cannot disable Guardian Approvals in this profile because `approvals_reviewer` is configured outside the active profile.".to_string(),
|
||||
"Cannot disable Auto-review in this profile because `approvals_reviewer` is configured outside the active profile.".to_string(),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -1345,7 +1345,7 @@ impl App {
|
||||
.into(),
|
||||
});
|
||||
if previous_approvals_reviewer != guardian_approvals_preset.approvals_reviewer {
|
||||
permissions_history_label = Some("Guardian Approvals");
|
||||
permissions_history_label = Some("Auto-review");
|
||||
}
|
||||
} else if !effective_enabled {
|
||||
if profile_approvals_reviewer_configured || self.active_profile.is_none() {
|
||||
@@ -1362,13 +1362,13 @@ impl App {
|
||||
}
|
||||
if feature == Feature::GuardianApproval && effective_enabled {
|
||||
// The feature flag alone is not enough for the live session.
|
||||
// We also align approval policy + sandbox to the Guardian
|
||||
// Approvals preset so enabling the experiment immediately
|
||||
// We also align approval policy + sandbox to the Auto-review
|
||||
// preset so enabling the experiment immediately
|
||||
// makes guardian review observable in the current thread.
|
||||
if !self.try_set_approval_policy_on_config(
|
||||
&mut feature_config,
|
||||
guardian_approvals_preset.approval_policy,
|
||||
"Failed to enable Guardian Approvals",
|
||||
"Failed to enable Auto-review",
|
||||
"failed to set guardian approvals approval policy on staged config",
|
||||
) {
|
||||
continue;
|
||||
@@ -1376,7 +1376,7 @@ impl App {
|
||||
if !self.try_set_sandbox_policy_on_config(
|
||||
&mut feature_config,
|
||||
guardian_approvals_preset.sandbox_policy.clone(),
|
||||
"Failed to enable Guardian Approvals",
|
||||
"Failed to enable Auto-review",
|
||||
"failed to set guardian approvals sandbox policy on staged config",
|
||||
) {
|
||||
continue;
|
||||
@@ -1439,7 +1439,7 @@ impl App {
|
||||
"failed to set guardian approvals sandbox policy on chat config"
|
||||
);
|
||||
self.chat_widget
|
||||
.add_error_message(format!("Failed to enable Guardian Approvals: {err}"));
|
||||
.add_error_message(format!("Failed to enable Auto-review: {err}"));
|
||||
}
|
||||
|
||||
if approval_policy_override.is_some()
|
||||
@@ -8419,7 +8419,7 @@ mod tests {
|
||||
.map(|line| line.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
assert!(rendered.contains("Permissions updated to Guardian Approvals"));
|
||||
assert!(rendered.contains("Permissions updated to Auto-review"));
|
||||
|
||||
let config = std::fs::read_to_string(codex_home.path().join("config.toml"))?;
|
||||
assert!(config.contains("guardian_approval = true"));
|
||||
|
||||
@@ -8495,9 +8495,9 @@ impl ChatWidget {
|
||||
|
||||
if guardian_approval_enabled {
|
||||
items.push(SelectionItem {
|
||||
name: "Guardian Approvals".to_string(),
|
||||
name: "Auto-review".to_string(),
|
||||
description: Some(
|
||||
"Same workspace-write permissions as Default, but eligible `on-request` approvals are routed through the guardian reviewer subagent."
|
||||
"Same workspace-write permissions as Default, but eligible `on-request` approvals are routed through the auto-reviewer subagent."
|
||||
.to_string(),
|
||||
),
|
||||
is_current: current_review_policy == ApprovalsReviewer::GuardianSubagent
|
||||
@@ -8509,7 +8509,7 @@ impl ChatWidget {
|
||||
actions: Self::approval_preset_actions(
|
||||
preset.approval,
|
||||
preset.sandbox.clone(),
|
||||
"Guardian Approvals".to_string(),
|
||||
"Auto-review".to_string(),
|
||||
ApprovalsReviewer::GuardianSubagent,
|
||||
),
|
||||
dismiss_on_select: true,
|
||||
|
||||
@@ -329,7 +329,7 @@ async fn permissions_selection_history_snapshot_full_access_to_default() {
|
||||
chat.open_permissions_popup();
|
||||
let popup = render_bottom_popup(&chat, /*width*/ 120);
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Up));
|
||||
if popup.contains("Guardian Approvals") {
|
||||
if popup.contains("Auto-review") {
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Up));
|
||||
}
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Enter));
|
||||
@@ -400,8 +400,8 @@ async fn permissions_selection_hides_guardian_approvals_when_feature_disabled()
|
||||
let popup = render_bottom_popup(&chat, /*width*/ 120);
|
||||
|
||||
assert!(
|
||||
!popup.contains("Guardian Approvals"),
|
||||
"expected Guardian Approvals to stay hidden until the experimental feature is enabled: {popup}"
|
||||
!popup.contains("Auto-review"),
|
||||
"expected Auto-review to stay hidden until the experimental feature is enabled: {popup}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -432,8 +432,8 @@ async fn permissions_selection_hides_guardian_approvals_when_feature_disabled_ev
|
||||
let popup = render_bottom_popup(&chat, /*width*/ 120);
|
||||
|
||||
assert!(
|
||||
!popup.contains("Guardian Approvals"),
|
||||
"expected Guardian Approvals to stay hidden when the experimental feature is disabled: {popup}"
|
||||
!popup.contains("Auto-review"),
|
||||
"expected Auto-review to stay hidden when the experimental feature is disabled: {popup}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -477,8 +477,8 @@ async fn permissions_selection_marks_guardian_approvals_current_after_session_co
|
||||
let popup = render_bottom_popup(&chat, /*width*/ 120);
|
||||
|
||||
assert!(
|
||||
popup.contains("Guardian Approvals (current)"),
|
||||
"expected Guardian Approvals to be current after SessionConfigured sync: {popup}"
|
||||
popup.contains("Auto-review (current)"),
|
||||
"expected Auto-review to be current after SessionConfigured sync: {popup}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -531,8 +531,8 @@ async fn permissions_selection_marks_guardian_approvals_current_with_custom_work
|
||||
let popup = render_bottom_popup(&chat, /*width*/ 120);
|
||||
|
||||
assert!(
|
||||
popup.contains("Guardian Approvals (current)"),
|
||||
"expected Guardian Approvals to be current even with custom workspace-write details: {popup}"
|
||||
popup.contains("Auto-review (current)"),
|
||||
"expected Auto-review to be current even with custom workspace-write details: {popup}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ async fn permissions_selection_can_disable_guardian_approvals() {
|
||||
event,
|
||||
AppEvent::UpdateApprovalsReviewer(ApprovalsReviewer::User)
|
||||
)),
|
||||
"expected selecting Default from Guardian Approvals to switch back to manual approval review: {events:?}"
|
||||
"expected selecting Default from Auto-review to switch back to manual approval review: {events:?}"
|
||||
);
|
||||
assert!(
|
||||
!events
|
||||
@@ -613,8 +613,8 @@ async fn permissions_selection_sends_approvals_reviewer_in_override_turn_context
|
||||
assert!(
|
||||
popup
|
||||
.lines()
|
||||
.any(|line| line.contains("Guardian Approvals") && line.contains('›')),
|
||||
"expected one Down from Default to select Guardian Approvals: {popup}"
|
||||
.any(|line| line.contains("Auto-review") && line.contains('›')),
|
||||
"expected one Down from Default to select Auto-review: {popup}"
|
||||
);
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Enter));
|
||||
|
||||
|
||||
@@ -1465,11 +1465,11 @@ async fn experimental_popup_includes_guardian_approval() {
|
||||
let normalized_popup = popup.split_whitespace().collect::<Vec<_>>().join(" ");
|
||||
assert!(
|
||||
popup.contains(guardian_name),
|
||||
"expected guardian approvals entry in experimental popup, got:\n{popup}"
|
||||
"expected auto-review entry in experimental popup, got:\n{popup}"
|
||||
);
|
||||
assert!(
|
||||
normalized_popup.contains(guardian_description),
|
||||
"expected guardian approvals description in experimental popup, got:\n{popup}"
|
||||
"expected auto-review description in experimental popup, got:\n{popup}"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user