Lightweight coding agent that runs in your terminal
Rust
forgot to add some windows sandbox nux events. (#9624)
iceweasel-oai7a9c9b863654
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rsindex 1ff2466f66..cfd47da16c 100644--- a/codex-rs/tui/src/chatwidget.rs+++ b/codex-rs/tui/src/chatwidget.rs@@ -3988,22 +3988,8 @@ impl ChatWidget {.is_some_and(|preset| {Self::preset_matches_current(current_approval, current_sandbox, preset)});- let stay_actions = if stay_full_access {- Vec::new()- } else {- presets- .iter()- .find(|preset| preset.id == "read-only")- .map(|preset| {- Self::approval_preset_actions(preset.approval, preset.sandbox.clone())- })- .unwrap_or_default()- };- let stay_label = if stay_full_access {- "Stay in Agent Full Access".to_string()- } else {- "Stay in Read-Only".to_string()- };+ self.otel_manager+ .counter("codex.windows_sandbox.elevated_prompt_shown", 1, &[]);let mut header = ColumnRenderable::new();header.push(*Box::new(@@ -4016,11 +4002,39 @@ impl ChatWidget {.wrap(Wrap { trim: false }),));+ let stay_label = if stay_full_access {+ "Stay in Agent Full Access".to_string()+ } else {+ "Stay in Read-Only".to_string()+ };+ let mut stay_actions = if stay_full_access {+ Vec::new()+ } else {+ presets+ .iter()+ .find(|preset| preset.id == "read-only")+ .map(|preset| {+ Self::approval_preset_actions(preset.approval, preset.sandbox.clone())+ })+ .unwrap_or_default()+ };+ stay_actions.insert(+ 0,+ Box::new({+ let otel = self.otel_manager.clone();+ move |_tx| {+ otel.counter("codex.windows_sandbox.elevated_prompt_decline", 1, &[]);+ }+ }),+ );++ let accept_otel = self.otel_manager.clone();let items = vec![SelectionItem {name: "Set up agent sandbox (requires elevation)".to_string(),description: None,actions: vec![Box::new(move |tx| {+ accept_otel.counter("codex.windows_sandbox.elevated_prompt_accept", 1, &[]);tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {preset: preset.clone(),});@@ -4068,23 +4082,6 @@ impl ChatWidget {.is_some_and(|preset| {Self::preset_matches_current(current_approval, current_sandbox, preset)});- let stay_actions = if stay_full_access {- Vec::new()- } else {- presets- .iter()- .find(|preset| preset.id == "read-only")- .map(|preset| {- Self::approval_preset_actions(preset.approval, preset.sandbox.clone())- })- .unwrap_or_default()- };- let stay_label = if stay_full_access {- "Stay in Agent Full Access".to_string()- } else {- "Stay in Read-Only".to_string()- };-let mut lines = Vec::new();lines.push(line!["Use Non-Elevated Sandbox?".bold()]);lines.push(line![""]);@@ -4100,14 +4097,44 @@ impl ChatWidget {let elevated_preset = preset.clone();let legacy_preset = preset;+ let stay_label = if stay_full_access {+ "Stay in Agent Full Access".to_string()+ } else {+ "Stay in Read-Only".to_string()+ };+ let mut stay_actions = if stay_full_access {+ Vec::new()+ } else {+ presets+ .iter()+ .find(|preset| preset.id == "read-only")+ .map(|preset| {+ Self::approval_preset_actions(preset.approval, preset.sandbox.clone())+ })+ .unwrap_or_default()+ };+ stay_actions.insert(+ 0,+ Box::new({+ let otel = self.otel_manager.clone();+ move |_tx| {+ otel.counter("codex.windows_sandbox.fallback_stay_current", 1, &[]);+ }+ }),+ );let items = vec![SelectionItem {name: "Try elevated agent sandbox setup again".to_string(),description: None,- actions: vec![Box::new(move |tx| {- tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {- preset: elevated_preset.clone(),- });+ actions: vec![Box::new({+ let otel = self.otel_manager.clone();+ let preset = elevated_preset;+ move |tx| {+ otel.counter("codex.windows_sandbox.fallback_retry_elevated", 1, &[]);+ tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {+ preset: preset.clone(),+ });+ }})],dismiss_on_select: true,..Default::default()@@ -4115,11 +4142,16 @@ impl ChatWidget {SelectionItem {name: "Use non-elevated agent sandbox".to_string(),description: None,- actions: vec![Box::new(move |tx| {- tx.send(AppEvent::EnableWindowsSandboxForAgentMode {- preset: legacy_preset.clone(),- mode: WindowsSandboxEnableMode::Legacy,- });+ actions: vec![Box::new({+ let otel = self.otel_manager.clone();+ let preset = legacy_preset;+ move |tx| {+ otel.counter("codex.windows_sandbox.fallback_use_legacy", 1, &[]);+ tx.send(AppEvent::EnableWindowsSandboxForAgentMode {+ preset: preset.clone(),+ mode: WindowsSandboxEnableMode::Legacy,+ });+ }})],dismiss_on_select: true,..Default::default()diff --git a/codex-rs/tui2/src/chatwidget.rs b/codex-rs/tui2/src/chatwidget.rsindex ec1f06297c..6e7229606c 100644--- a/codex-rs/tui2/src/chatwidget.rs+++ b/codex-rs/tui2/src/chatwidget.rs@@ -3682,22 +3682,8 @@ impl ChatWidget {.is_some_and(|preset| {Self::preset_matches_current(current_approval, current_sandbox, preset)});- let stay_actions = if stay_full_access {- Vec::new()- } else {- presets- .iter()- .find(|preset| preset.id == "read-only")- .map(|preset| {- Self::approval_preset_actions(preset.approval, preset.sandbox.clone())- })- .unwrap_or_default()- };- let stay_label = if stay_full_access {- "Stay in Agent Full Access".to_string()- } else {- "Stay in Read-Only".to_string()- };+ self.otel_manager+ .counter("codex.windows_sandbox.elevated_prompt_shown", 1, &[]);let mut header = ColumnRenderable::new();header.push(*Box::new(@@ -3710,11 +3696,39 @@ impl ChatWidget {.wrap(Wrap { trim: false }),));+ let stay_label = if stay_full_access {+ "Stay in Agent Full Access".to_string()+ } else {+ "Stay in Read-Only".to_string()+ };+ let mut stay_actions = if stay_full_access {+ Vec::new()+ } else {+ presets+ .iter()+ .find(|preset| preset.id == "read-only")+ .map(|preset| {+ Self::approval_preset_actions(preset.approval, preset.sandbox.clone())+ })+ .unwrap_or_default()+ };+ stay_actions.insert(+ 0,+ Box::new({+ let otel = self.otel_manager.clone();+ move |_tx| {+ otel.counter("codex.windows_sandbox.elevated_prompt_decline", 1, &[]);+ }+ }),+ );++ let accept_otel = self.otel_manager.clone();let items = vec![SelectionItem {name: "Set up agent sandbox (requires elevation)".to_string(),description: None,actions: vec![Box::new(move |tx| {+ accept_otel.counter("codex.windows_sandbox.elevated_prompt_accept", 1, &[]);tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {preset: preset.clone(),});@@ -3762,23 +3776,6 @@ impl ChatWidget {.is_some_and(|preset| {Self::preset_matches_current(current_approval, current_sandbox, preset)});- let stay_actions = if stay_full_access {- Vec::new()- } else {- presets- .iter()- .find(|preset| preset.id == "read-only")- .map(|preset| {- Self::approval_preset_actions(preset.approval, preset.sandbox.clone())- })- .unwrap_or_default()- };- let stay_label = if stay_full_access {- "Stay in Agent Full Access".to_string()- } else {- "Stay in Read-Only".to_string()- };-let mut lines = Vec::new();lines.push(line!["Use Non-Elevated Sandbox?".bold()]);lines.push(line![""]);@@ -3794,14 +3791,44 @@ impl ChatWidget {let elevated_preset = preset.clone();let legacy_preset = preset;+ let stay_label = if stay_full_access {+ "Stay in Agent Full Access".to_string()+ } else {+ "Stay in Read-Only".to_string()+ };+ let mut stay_actions = if stay_full_access {+ Vec::new()+ } else {+ presets+ .iter()+ .find(|preset| preset.id == "read-only")+ .map(|preset| {+ Self::approval_preset_actions(preset.approval, preset.sandbox.clone())+ })+ .unwrap_or_default()+ };+ stay_actions.insert(+ 0,+ Box::new({+ let otel = self.otel_manager.clone();+ move |_tx| {+ otel.counter("codex.windows_sandbox.fallback_stay_current", 1, &[]);+ }+ }),+ );let items = vec![SelectionItem {name: "Try elevated agent sandbox setup again".to_string(),description: None,- actions: vec![Box::new(move |tx| {- tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {- preset: elevated_preset.clone(),- });+ actions: vec![Box::new({+ let otel = self.otel_manager.clone();+ let preset = elevated_preset;+ move |tx| {+ otel.counter("codex.windows_sandbox.fallback_retry_elevated", 1, &[]);+ tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {+ preset: preset.clone(),+ });+ }})],dismiss_on_select: true,..Default::default()@@ -3809,11 +3836,16 @@ impl ChatWidget {SelectionItem {name: "Use non-elevated agent sandbox".to_string(),description: None,- actions: vec![Box::new(move |tx| {- tx.send(AppEvent::EnableWindowsSandboxForAgentMode {- preset: legacy_preset.clone(),- mode: WindowsSandboxEnableMode::Legacy,- });+ actions: vec![Box::new({+ let otel = self.otel_manager.clone();+ let preset = legacy_preset;+ move |tx| {+ otel.counter("codex.windows_sandbox.fallback_use_legacy", 1, &[]);+ tx.send(AppEvent::EnableWindowsSandboxForAgentMode {+ preset: preset.clone(),+ mode: WindowsSandboxEnableMode::Legacy,+ });+ }})],dismiss_on_select: true,..Default::default()