mirror of
https://github.com/openai/codex.git
synced 2026-11-25 15:24:26 +00:00
forgot to add some windows sandbox nux events. (#9624)
This commit is contained in:
1 parent
ab8415dcf5
commit
7a9c9b8636
2 files changed
+148
-84
No files matched your search
@@ -3988,22 +3988,8 @@ impl ChatWidget {
|
|||||||
.is_some_and(|preset| {
|
.is_some_and(|preset| {
|
||||||
Self::preset_matches_current(current_approval, current_sandbox, preset)
|
Self::preset_matches_current(current_approval, current_sandbox, preset)
|
||||||
});
|
});
|
||||||
let stay_actions = if stay_full_access {
|
self.otel_manager
|
||||||
Vec::new()
|
.counter("codex.windows_sandbox.elevated_prompt_shown", 1, &[]);
|
||||||
} 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 header = ColumnRenderable::new();
|
let mut header = ColumnRenderable::new();
|
||||||
header.push(*Box::new(
|
header.push(*Box::new(
|
||||||
@@ -4016,11 +4002,39 @@ impl ChatWidget {
|
|||||||
.wrap(Wrap { trim: false }),
|
.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![
|
let items = vec![
|
||||||
SelectionItem {
|
SelectionItem {
|
||||||
name: "Set up agent sandbox (requires elevation)".to_string(),
|
name: "Set up agent sandbox (requires elevation)".to_string(),
|
||||||
description: None,
|
description: None,
|
||||||
actions: vec![Box::new(move |tx| {
|
actions: vec![Box::new(move |tx| {
|
||||||
|
accept_otel.counter("codex.windows_sandbox.elevated_prompt_accept", 1, &[]);
|
||||||
tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {
|
tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {
|
||||||
preset: preset.clone(),
|
preset: preset.clone(),
|
||||||
});
|
});
|
||||||
@@ -4068,23 +4082,6 @@ impl ChatWidget {
|
|||||||
.is_some_and(|preset| {
|
.is_some_and(|preset| {
|
||||||
Self::preset_matches_current(current_approval, current_sandbox, 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();
|
let mut lines = Vec::new();
|
||||||
lines.push(line!["Use Non-Elevated Sandbox?".bold()]);
|
lines.push(line!["Use Non-Elevated Sandbox?".bold()]);
|
||||||
lines.push(line![""]);
|
lines.push(line![""]);
|
||||||
@@ -4100,14 +4097,44 @@ impl ChatWidget {
|
|||||||
|
|
||||||
let elevated_preset = preset.clone();
|
let elevated_preset = preset.clone();
|
||||||
let legacy_preset = preset;
|
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![
|
let items = vec![
|
||||||
SelectionItem {
|
SelectionItem {
|
||||||
name: "Try elevated agent sandbox setup again".to_string(),
|
name: "Try elevated agent sandbox setup again".to_string(),
|
||||||
description: None,
|
description: None,
|
||||||
actions: vec![Box::new(move |tx| {
|
actions: vec![Box::new({
|
||||||
tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {
|
let otel = self.otel_manager.clone();
|
||||||
preset: elevated_preset.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,
|
dismiss_on_select: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -4115,11 +4142,16 @@ impl ChatWidget {
|
|||||||
SelectionItem {
|
SelectionItem {
|
||||||
name: "Use non-elevated agent sandbox".to_string(),
|
name: "Use non-elevated agent sandbox".to_string(),
|
||||||
description: None,
|
description: None,
|
||||||
actions: vec![Box::new(move |tx| {
|
actions: vec![Box::new({
|
||||||
tx.send(AppEvent::EnableWindowsSandboxForAgentMode {
|
let otel = self.otel_manager.clone();
|
||||||
preset: legacy_preset.clone(),
|
let preset = legacy_preset;
|
||||||
mode: WindowsSandboxEnableMode::Legacy,
|
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,
|
dismiss_on_select: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|||||||
@@ -3682,22 +3682,8 @@ impl ChatWidget {
|
|||||||
.is_some_and(|preset| {
|
.is_some_and(|preset| {
|
||||||
Self::preset_matches_current(current_approval, current_sandbox, preset)
|
Self::preset_matches_current(current_approval, current_sandbox, preset)
|
||||||
});
|
});
|
||||||
let stay_actions = if stay_full_access {
|
self.otel_manager
|
||||||
Vec::new()
|
.counter("codex.windows_sandbox.elevated_prompt_shown", 1, &[]);
|
||||||
} 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 header = ColumnRenderable::new();
|
let mut header = ColumnRenderable::new();
|
||||||
header.push(*Box::new(
|
header.push(*Box::new(
|
||||||
@@ -3710,11 +3696,39 @@ impl ChatWidget {
|
|||||||
.wrap(Wrap { trim: false }),
|
.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![
|
let items = vec![
|
||||||
SelectionItem {
|
SelectionItem {
|
||||||
name: "Set up agent sandbox (requires elevation)".to_string(),
|
name: "Set up agent sandbox (requires elevation)".to_string(),
|
||||||
description: None,
|
description: None,
|
||||||
actions: vec![Box::new(move |tx| {
|
actions: vec![Box::new(move |tx| {
|
||||||
|
accept_otel.counter("codex.windows_sandbox.elevated_prompt_accept", 1, &[]);
|
||||||
tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {
|
tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {
|
||||||
preset: preset.clone(),
|
preset: preset.clone(),
|
||||||
});
|
});
|
||||||
@@ -3762,23 +3776,6 @@ impl ChatWidget {
|
|||||||
.is_some_and(|preset| {
|
.is_some_and(|preset| {
|
||||||
Self::preset_matches_current(current_approval, current_sandbox, 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();
|
let mut lines = Vec::new();
|
||||||
lines.push(line!["Use Non-Elevated Sandbox?".bold()]);
|
lines.push(line!["Use Non-Elevated Sandbox?".bold()]);
|
||||||
lines.push(line![""]);
|
lines.push(line![""]);
|
||||||
@@ -3794,14 +3791,44 @@ impl ChatWidget {
|
|||||||
|
|
||||||
let elevated_preset = preset.clone();
|
let elevated_preset = preset.clone();
|
||||||
let legacy_preset = preset;
|
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![
|
let items = vec![
|
||||||
SelectionItem {
|
SelectionItem {
|
||||||
name: "Try elevated agent sandbox setup again".to_string(),
|
name: "Try elevated agent sandbox setup again".to_string(),
|
||||||
description: None,
|
description: None,
|
||||||
actions: vec![Box::new(move |tx| {
|
actions: vec![Box::new({
|
||||||
tx.send(AppEvent::BeginWindowsSandboxElevatedSetup {
|
let otel = self.otel_manager.clone();
|
||||||
preset: elevated_preset.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,
|
dismiss_on_select: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -3809,11 +3836,16 @@ impl ChatWidget {
|
|||||||
SelectionItem {
|
SelectionItem {
|
||||||
name: "Use non-elevated agent sandbox".to_string(),
|
name: "Use non-elevated agent sandbox".to_string(),
|
||||||
description: None,
|
description: None,
|
||||||
actions: vec![Box::new(move |tx| {
|
actions: vec![Box::new({
|
||||||
tx.send(AppEvent::EnableWindowsSandboxForAgentMode {
|
let otel = self.otel_manager.clone();
|
||||||
preset: legacy_preset.clone(),
|
let preset = legacy_preset;
|
||||||
mode: WindowsSandboxEnableMode::Legacy,
|
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,
|
dismiss_on_select: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|||||||
Reference in new issue
Block a user