Persist full access when warning hidden

This commit is contained in:
Ahmed Ibrahim
2026-01-13 10:51:27 -08:00
parent 74425ba6ad
commit 03ce86346b
2 changed files with 32 additions and 10 deletions

View File

@@ -3012,6 +3012,7 @@ impl ChatWidget {
.notices
.hide_full_access_warning
.unwrap_or(false);
let persist_preset = self.should_persist_approval_preset(&preset);
let actions: Vec<SelectionAction> = if requires_confirmation {
let preset_clone = preset.clone();
vec![Box::new(move |tx| {
@@ -3058,7 +3059,7 @@ impl ChatWidget {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
persist_preset,
)
}
}
@@ -3067,14 +3068,14 @@ impl ChatWidget {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
persist_preset,
)
}
} else {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
persist_preset,
)
};
items.push(SelectionItem {
@@ -3153,6 +3154,16 @@ impl ChatWidget {
})]
}
fn should_persist_approval_preset(&self, preset: &ApprovalPreset) -> bool {
if preset.id != "full-access" {
return true;
}
self.config
.notices
.hide_full_access_warning
.unwrap_or(false)
}
fn preset_matches_current(
current_approval: AskForApproval,
current_sandbox: &SandboxPolicy,
@@ -3335,7 +3346,7 @@ impl ChatWidget {
}
let persist_approval = preset
.as_ref()
.is_some_and(|preset| preset.id != "full-access");
.is_some_and(|preset| self.should_persist_approval_preset(preset));
if let (Some(approval), Some(sandbox)) = (approval, sandbox.clone()) {
accept_actions.extend(Self::approval_preset_actions(
approval,
@@ -3462,7 +3473,7 @@ impl ChatWidget {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
self.should_persist_approval_preset(preset),
)
})
.unwrap_or_default()
@@ -3546,7 +3557,7 @@ impl ChatWidget {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
self.should_persist_approval_preset(preset),
)
})
.unwrap_or_default()

View File

@@ -2763,6 +2763,7 @@ impl ChatWidget {
.notices
.hide_full_access_warning
.unwrap_or(false);
let persist_preset = self.should_persist_approval_preset(&preset);
let actions: Vec<SelectionAction> = if requires_confirmation {
let preset_clone = preset.clone();
vec![Box::new(move |tx| {
@@ -2809,7 +2810,7 @@ impl ChatWidget {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
persist_preset,
)
}
}
@@ -2818,14 +2819,14 @@ impl ChatWidget {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
persist_preset,
)
}
} else {
Self::approval_preset_actions(
preset.approval,
preset.sandbox.clone(),
preset.id != "full-access",
persist_preset,
)
};
items.push(SelectionItem {
@@ -2884,6 +2885,16 @@ impl ChatWidget {
})]
}
fn should_persist_approval_preset(&self, preset: &ApprovalPreset) -> bool {
if preset.id != "full-access" {
return true;
}
self.config
.notices
.hide_full_access_warning
.unwrap_or(false)
}
fn preset_matches_current(
current_approval: AskForApproval,
current_sandbox: &SandboxPolicy,
@@ -3066,7 +3077,7 @@ impl ChatWidget {
}
let persist_approval = preset
.as_ref()
.is_some_and(|preset| preset.id != "full-access");
.is_some_and(|preset| self.should_persist_approval_preset(preset));
if let (Some(approval), Some(sandbox)) = (approval, sandbox.clone()) {
accept_actions.extend(Self::approval_preset_actions(
approval,