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:
chess authored and copyberry committed 2026-09-10 22:17:03 +00:00
1 parent c8a8295e79
commit 4caa5d615d
13 files changed
+504 -165

No files matched your search

@@ -80,7 +80,7 @@ pub(crate) struct LegacyAclSids<'a> {
pub(crate) write_root_sids: &'a [RootCapabilitySid],
}
fn prepare_spawn_context_common(
pub(crate) fn prepare_spawn_context_common(
permission_profile: &PermissionProfile,
workspace_roots: &[AbsolutePathBuf],
codex_home: &Path,