Add Windows sandbox unified exec runtime support (#15578)

## Summary

This is the runtime/foundation half of the Windows sandbox unified-exec
work.

- add Windows sandbox `unified_exec` session support in
`windows-sandbox-rs` for both:
  - the legacy restricted-token backend
  - the elevated runner backend
- extend the PTY/process runtime so driver-backed sessions can support:
  - stdin streaming
  - stdout/stderr separation
  - exit propagation
  - PTY resize hooks
- add Windows sandbox runtime coverage in `codex-windows-sandbox` /
`codex-utils-pty`

This PR does **not** enable Windows sandbox `UnifiedExec` for product
callers yet because hooking this up to app-server comes in the next PR.

Windows sandbox advertising is intentionally kept aligned with `main`,
so sandboxed Windows callers still fall back to `ShellCommand`.

This PR isolates the runtime/session layer so it can be reviewed
independently from product-surface enablement.

---------

Co-authored-by: jif-oai <jif@openai.com>
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
authored and GitHub committed 2026-04-21 10:44:49 -07:00
1 parent 38ba876ea9
commit 8612714aa6
32 files changed
+2620 -210

No files matched your search

+5
View File
@@ -49,6 +49,7 @@ pub struct ExecRequest {
pub expiration: ExecExpiration,
pub capture_policy: ExecCapturePolicy,
pub sandbox: SandboxType,
pub windows_sandbox_policy_cwd: AbsolutePathBuf,
pub windows_sandbox_level: WindowsSandboxLevel,
pub windows_sandbox_private_desktop: bool,
pub sandbox_policy: SandboxPolicy,
@@ -75,6 +76,7 @@ impl ExecRequest {
network_sandbox_policy: NetworkSandboxPolicy,
arg0: Option<String>,
) -> Self {
let windows_sandbox_policy_cwd = cwd.clone();
Self {
command,
cwd,
@@ -84,6 +86,7 @@ impl ExecRequest {
expiration,
capture_policy,
sandbox,
windows_sandbox_policy_cwd,
windows_sandbox_level,
windows_sandbox_private_desktop,
sandbox_policy,
@@ -97,6 +100,7 @@ impl ExecRequest {
pub(crate) fn from_sandbox_exec_request(
request: SandboxExecRequest,
options: ExecOptions,
windows_sandbox_policy_cwd: AbsolutePathBuf,
) -> Self {
let SandboxExecRequest {
command,
@@ -134,6 +138,7 @@ impl ExecRequest {
expiration,
capture_policy,
sandbox,
windows_sandbox_policy_cwd,
windows_sandbox_level,
windows_sandbox_private_desktop,
sandbox_policy,