Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

chore(tui) cleanup /approvals (#10215)

Dylan Hurdb61ea47e8355
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs
index 644bcae8c7..30f3d17b20 100644
--- a/codex-rs/tui/src/chatwidget.rs
+++ b/codex-rs/tui/src/chatwidget.rs
@@ -3285,7 +3285,7 @@ impl ChatWidget {
self.app_event_tx.send(AppEvent::OpenAgentPicker);
}
SlashCommand::Approvals => {
- self.open_approvals_popup();
+ self.open_permissions_popup();
}
SlashCommand::Permissions => {
self.open_permissions_popup();
@@ -5207,18 +5207,14 @@ impl ChatWidget {
);
}
- /// Open a popup to choose the approvals mode (ask for approval policy + sandbox policy).
+ /// Open the permissions popup (alias for /permissions).
pub(crate) fn open_approvals_popup(&mut self) {
- self.open_approval_mode_popup(true);
+ self.open_permissions_popup();
}
/// Open a popup to choose the permissions mode (approval policy + sandbox policy).
pub(crate) fn open_permissions_popup(&mut self) {
let include_read_only = cfg!(target_os = "windows");
- self.open_approval_mode_popup(include_read_only);
- }
-
- fn open_approval_mode_popup(&mut self, include_read_only: bool) {
let current_approval = self.config.approval_policy.value();
let current_sandbox = self.config.sandbox_policy.get();
let mut items: Vec<SelectionItem> = Vec::new();
@@ -5247,7 +5243,7 @@ impl ChatWidget {
} else {
preset.label.to_string()
};
- let description = Some(preset.description.to_string());
+ let description = Some(preset.description.replace(" (Identical to Agent mode)", ""));
let disabled_reason = match self.config.approval_policy.can_set(&preset.approval) {
Ok(()) => None,
Err(err) => Some(err.to_string()),
@@ -5565,8 +5561,8 @@ impl ChatWidget {
// Build actions ensuring acknowledgement happens before applying the new sandbox policy,
// so downstream policy-change hooks don't re-trigger the warning.
let mut accept_actions: Vec<SelectionAction> = Vec::new();
- // Suppress the immediate re-scan only when a preset will be applied (i.e., via /approvals),
- // to avoid duplicate warnings from the ensuing policy change.
+ // Suppress the immediate re-scan only when a preset will be applied (i.e., via /approvals or
+ // /permissions), to avoid duplicate warnings from the ensuing policy change.
if preset.is_some() {
accept_actions.push(Box::new(|tx| {
tx.send(AppEvent::SkipNextWorldWritableScan);
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup.snap
index 5e372cc0a2..e6b067b4e5 100644
--- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup.snap
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup.snap
@@ -1,18 +1,15 @@
---
source: tui/src/chatwidget/tests.rs
+assertion_line: 3092
expression: popup
---
Update Model Permissions
-› 1. Read Only (current) Codex can read files in the current workspace.
- Approval is required to edit files or access the
- internet.
- 2. Default Codex can read and edit files in the current
- workspace, and run commands. Approval is required to
- access the internet or edit other files. (Identical
- to Agent mode)
- 3. Full Access Codex can edit files outside this workspace and
- access the internet without asking for approval.
- Exercise caution when using.
+› 1. Default Codex can read and edit files in the current workspace, and
+ run commands. Approval is required to access the internet or
+ edit other files.
+ 2. Full Access Codex can edit files outside this workspace and access the
+ internet without asking for approval. Exercise caution when
+ using.
Press enter to confirm or esc to go back
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows.snap
index 87ec529268..c25b68d1d5 100644
--- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows.snap
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows.snap
@@ -1,6 +1,6 @@
---
source: tui/src/chatwidget/tests.rs
-assertion_line: 2654
+assertion_line: 3925
expression: popup
---
Update Model Permissions
@@ -10,8 +10,7 @@ expression: popup
internet.
2. Default Codex can read and edit files in the current
workspace, and run commands. Approval is required to
- access the internet or edit other files. (Identical
- to Agent mode)
+ access the internet or edit other files.
3. Full Access Codex can edit files outside this workspace and
access the internet without asking for approval.
Exercise caution when using.
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows_degraded.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows_degraded.snap
index 29220fb1c1..7556f84aae 100644
--- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows_degraded.snap
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approvals_selection_popup@windows_degraded.snap
@@ -1,6 +1,6 @@
---
source: tui/src/chatwidget/tests.rs
-assertion_line: 2003
+assertion_line: 3945
expression: popup
---
Update Model Permissions
@@ -11,8 +11,7 @@ expression: popup
2. Default (non-elevated sandbox) Codex can read and edit files in the
current workspace, and run commands.
Approval is required to access the
- internet or edit other files. (Identical
- to Agent mode)
+ internet or edit other files.
3. Full Access Codex can edit files outside this
workspace and access the internet without
asking for approval. Exercise caution
diff --git a/codex-rs/tui/src/slash_command.rs b/codex-rs/tui/src/slash_command.rs
index 1220c3aca0..e4e1c9d891 100644
--- a/codex-rs/tui/src/slash_command.rs
+++ b/codex-rs/tui/src/slash_command.rs
@@ -75,7 +75,7 @@ impl SlashCommand {
SlashCommand::Plan => "switch to Plan mode",
SlashCommand::Collab => "change collaboration mode (experimental)",
SlashCommand::Agent => "switch the active agent thread",
- SlashCommand::Approvals => "choose what Codex can do without approval",
+ SlashCommand::Approvals => "choose what Codex is allowed to do",
SlashCommand::Permissions => "choose what Codex is allowed to do",
SlashCommand::ElevateSandbox => "set up elevated agent sandbox",
SlashCommand::Experimental => "toggle experimental features",