Compare commits

...

1 Commits

Author SHA1 Message Date
David Wiesen
2a3b2d1b65 fix(windows-sandbox): disable private desktop by default in headless sessions 2026-04-15 04:11:48 -07:00
2 changed files with 32 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ use codex_features::Features;
use codex_features::FeaturesToml;
use codex_otel::sanitize_metric_tag_value;
use codex_protocol::config_types::WindowsSandboxLevel;
use codex_utils_path::env::is_headless_environment;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::path::Path;
@@ -85,7 +86,21 @@ pub fn resolve_windows_sandbox_private_desktop(cfg: &ConfigToml, profile: &Confi
.as_ref()
.and_then(|windows| windows.sandbox_private_desktop)
})
.unwrap_or(true)
.unwrap_or_else(default_windows_sandbox_private_desktop)
}
fn default_windows_sandbox_private_desktop() -> bool {
default_windows_sandbox_private_desktop_for_environment(
cfg!(target_os = "windows"),
is_headless_environment(),
)
}
fn default_windows_sandbox_private_desktop_for_environment(
is_windows: bool,
is_headless: bool,
) -> bool {
!is_windows || !is_headless
}
fn legacy_windows_sandbox_keys_present(features: Option<&FeaturesToml>) -> bool {

View File

@@ -155,9 +155,8 @@ fn resolve_windows_sandbox_private_desktop_prefers_profile_windows() {
#[test]
fn resolve_windows_sandbox_private_desktop_defaults_to_true() {
assert!(resolve_windows_sandbox_private_desktop(
&ConfigToml::default(),
&ConfigProfile::default()
assert!(default_windows_sandbox_private_desktop_for_environment(
/*is_windows*/ true, /*is_headless*/ false
));
}
@@ -176,3 +175,17 @@ fn resolve_windows_sandbox_private_desktop_respects_explicit_cfg_value() {
&ConfigProfile::default()
));
}
#[test]
fn resolve_windows_sandbox_private_desktop_defaults_to_false_for_headless_windows() {
assert!(!default_windows_sandbox_private_desktop_for_environment(
/*is_windows*/ true, /*is_headless*/ true
));
}
#[test]
fn resolve_windows_sandbox_private_desktop_non_windows_default_stays_true() {
assert!(default_windows_sandbox_private_desktop_for_environment(
/*is_windows*/ false, /*is_headless*/ true
));
}