mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Keep Windows sandbox private desktops alive across helper exits (#44658)
## Why Private desktops owned by short-lived sandbox wrappers disappear when those wrappers exit, preventing reuse across filesystem helper requests. ## What changed - Select and cache private desktops in the calling process, keeping desktops separate for different sandbox permissions. - Pass the desktop name through the wrapper to the restricted-token and elevated backends so helpers reuse the selected desktop. - Separate sandbox account preparation from filesystem ACL refresh so desktop selection does not perform the wrapper's refresh. - Propagate desktop preparation errors and require a desktop name when the wrapper's private desktop flag is set. ## Testing Add a Windows filesystem regression test covering desktop survival and reuse across reads, writes, metadata queries, and streaming reads, plus separate read-only permissions and rejected writes. Extend wrapper argument tests to cover named desktops and rejection of a missing desktop name. GitOrigin-RevId: 05a1cb829a902732248bfa7f4ad7470d911fa9f6
This commit is contained in:
1 parent
c8a8295e79
commit
4caa5d615d
13 files changed
+504
-165
No files matched your search
@@ -49,6 +49,13 @@ pub struct WindowsSandboxSessionRequest<'a> {
|
||||
|
||||
pub async fn spawn_windows_sandbox_session_for_level(
|
||||
request: WindowsSandboxSessionRequest<'_>,
|
||||
) -> Result<SpawnedProcess> {
|
||||
spawn_windows_sandbox_session_with_desktop(request, /*private_desktop_name*/ None).await
|
||||
}
|
||||
|
||||
pub(crate) async fn spawn_windows_sandbox_session_with_desktop(
|
||||
request: WindowsSandboxSessionRequest<'_>,
|
||||
private_desktop_name: Option<String>,
|
||||
) -> Result<SpawnedProcess> {
|
||||
if matches!(request.windows_sandbox_level, WindowsSandboxLevel::Elevated) {
|
||||
backends::elevated::spawn_windows_sandbox_session_elevated_for_permission_profile(
|
||||
@@ -70,6 +77,7 @@ pub async fn spawn_windows_sandbox_session_for_level(
|
||||
request.tty,
|
||||
request.stdin_open,
|
||||
request.use_private_desktop,
|
||||
private_desktop_name,
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
@@ -79,7 +87,7 @@ pub async fn spawn_windows_sandbox_session_for_level(
|
||||
if request.network_proxy_restricting_sid.is_some() {
|
||||
bail!("network proxy restricting SID requires the elevated Windows sandbox backend");
|
||||
}
|
||||
spawn_windows_sandbox_session_legacy(
|
||||
backends::legacy::spawn_windows_sandbox_session_legacy(
|
||||
request.permission_profile,
|
||||
request.workspace_roots,
|
||||
request.codex_home,
|
||||
@@ -92,6 +100,7 @@ pub async fn spawn_windows_sandbox_session_for_level(
|
||||
request.tty,
|
||||
request.stdin_open,
|
||||
request.use_private_desktop,
|
||||
private_desktop_name,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -125,6 +134,7 @@ pub async fn spawn_windows_sandbox_session_legacy(
|
||||
tty,
|
||||
stdin_open,
|
||||
use_private_desktop,
|
||||
/*private_desktop_name*/ None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -168,6 +178,7 @@ pub async fn spawn_windows_sandbox_session_elevated_for_permission_profile(
|
||||
tty,
|
||||
stdin_open,
|
||||
use_private_desktop,
|
||||
/*private_desktop_name*/ None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user