mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
## What changed - Accept `windows.sandbox = "mxc"` and preserve the selected backend through environment configuration, command execution, patch writes, and sandbox metadata. - Treat MXC as enabled in the TUI and report Windows sandbox readiness as `ready`, avoiding legacy setup prompts. - Keep `allowed_sandbox_implementations` scoped to the legacy elevated and unelevated backends without restricting MXC. - Default `windows.sandbox_private_desktop` to `false` for MXC while retaining `true` for legacy sandboxes. ## Testing Add coverage for MXC configuration precedence, legacy requirement handling, sandbox selection, and TUI state. Add a Wine integration test that verifies command and patch routing fails when native MXC is unavailable and reports `windows_mxc` in turn metadata. GitOrigin-RevId: e2162447d0750f60753864c92a20e02a7f297bca
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
//! Identifies the platform sandbox implementation selected for execution.
|
|
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
use crate::config_types::WindowsSandboxLevel;
|
|
|
|
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub enum SandboxType {
|
|
None,
|
|
MacosSeatbelt,
|
|
LinuxSeccomp,
|
|
WindowsRestrictedToken,
|
|
WindowsMxc,
|
|
}
|
|
|
|
impl SandboxType {
|
|
pub fn as_metric_tag(self) -> &'static str {
|
|
match self {
|
|
Self::None => "none",
|
|
Self::MacosSeatbelt => "seatbelt",
|
|
Self::LinuxSeccomp => "seccomp",
|
|
Self::WindowsRestrictedToken => "windows_sandbox",
|
|
Self::WindowsMxc => "windows_mxc",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Preserves explicit MXC selection while honoring legacy runtime level updates.
|
|
pub fn effective_windows_sandbox_type(
|
|
sandbox_type: SandboxType,
|
|
sandbox_level: WindowsSandboxLevel,
|
|
) -> SandboxType {
|
|
match (sandbox_type, sandbox_level) {
|
|
(SandboxType::WindowsMxc, _) => SandboxType::WindowsMxc,
|
|
(_, WindowsSandboxLevel::Disabled) => SandboxType::None,
|
|
(_, WindowsSandboxLevel::RestrictedToken | WindowsSandboxLevel::Elevated) => {
|
|
SandboxType::WindowsRestrictedToken
|
|
}
|
|
}
|
|
}
|