mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:50:52 +00:00
Avoid warning for unset Windows sandbox mode
This commit is contained in:
@@ -9540,6 +9540,37 @@ async fn explicit_sandbox_mode_falls_back_when_disallowed_by_requirements() -> s
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unset_windows_sandbox_mode_uses_requirements_default_without_warning()
|
||||
-> std::io::Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
r#"[windows]
|
||||
allowed_sandbox_implementations = ["elevated"]
|
||||
"#,
|
||||
),
|
||||
)
|
||||
.build()
|
||||
.await?;
|
||||
|
||||
assert_eq!(
|
||||
config.permissions.windows_sandbox_mode,
|
||||
Some(codex_config::types::WindowsSandboxModeToml::Elevated)
|
||||
);
|
||||
assert!(
|
||||
config.startup_warnings.iter().all(|warning| !warning
|
||||
.contains("Configured value for `windows.sandbox` is disallowed by requirements")),
|
||||
"{:?}",
|
||||
config.startup_warnings
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn windows_sandbox_mode_falls_back_when_disallowed_by_requirements() -> std::io::Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
|
||||
@@ -3070,12 +3070,14 @@ impl Config {
|
||||
WindowsSandboxLevel::Disabled => None,
|
||||
}
|
||||
});
|
||||
apply_requirement_constrained_value(
|
||||
"windows.sandbox",
|
||||
selected_windows_sandbox_mode,
|
||||
&mut constrained_windows_sandbox_mode,
|
||||
&mut startup_warnings,
|
||||
)?;
|
||||
if let Some(selected_windows_sandbox_mode) = selected_windows_sandbox_mode {
|
||||
apply_requirement_constrained_value(
|
||||
"windows.sandbox",
|
||||
Some(selected_windows_sandbox_mode),
|
||||
&mut constrained_windows_sandbox_mode,
|
||||
&mut startup_warnings,
|
||||
)?;
|
||||
}
|
||||
let effective_windows_sandbox_mode = *constrained_windows_sandbox_mode.get();
|
||||
let windows_sandbox_mode = if constrained_windows_sandbox_mode.source.is_some() {
|
||||
effective_windows_sandbox_mode
|
||||
|
||||
Reference in New Issue
Block a user