Preserve Windows sandbox proxy settings in guardian sessions (#35036)

## Why

Guardian review commands can run without the proxy-port environment used to
configure the parent session. Reconciling persistent Windows sandbox settings
for those commands can discard the parent's proxy configuration.

## What changed

- Add a session-level Windows sandbox proxy-settings mode and use `Preserve`
  for guardian review sessions while keeping `Reconcile` as the default.
- Carry the mode through unified exec and the exec-server sandbox context to
  Windows process launches.
- In preserve mode, reuse the proxy settings recorded by the existing sandbox
  setup marker.

## Testing

Added coverage for guardian session configuration, exec-server transport, and
preserving an existing setup marker when proxy-port environment variables are
absent.

GitOrigin-RevId: 214655c6e6d97360906431773dc0de0fdda2db6e
This commit is contained in:
iceweasel-oai authored and copyberry committed 2026-07-23 23:35:29 +00:00
1 parent d45055ae58
commit b115de97d7
23 files changed
+181 -35

No files matched your search

@@ -371,4 +371,36 @@ mod tests {
vec![8080]
);
}
#[test]
fn guardian_preserve_mode_does_not_churn_marker_with_empty_proxy_ports() {
let marker = SetupMarker {
version: crate::setup::SETUP_VERSION,
offline_username: "offline".to_string(),
online_username: "online".to_string(),
created_at: None,
proxy_ports: vec![3128, 8081],
allow_local_binding: true,
};
let env_map = HashMap::new();
let reconciled = desired_offline_proxy_settings(
Some(&marker),
WindowsSandboxProxySettingsMode::Reconcile,
&env_map,
SandboxNetworkIdentity::Offline,
);
assert_eq!(reconciled.proxy_ports, Vec::<u16>::new());
let desired = desired_offline_proxy_settings(
Some(&marker),
WindowsSandboxProxySettingsMode::Preserve,
&env_map,
SandboxNetworkIdentity::Offline,
);
assert_eq!(desired, marker.offline_proxy_settings());
assert_eq!(
marker.request_mismatch_reason(SandboxNetworkIdentity::Offline, &desired),
None
);
}
}
+1 -8
View File
@@ -35,14 +35,7 @@ impl fmt::Debug for WindowsSandboxCancellationToken {
}
}
/// Controls whether a Windows sandbox launch reconciles persistent proxy
/// firewall settings or preserves the settings established by another launch.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum WindowsSandboxProxySettingsMode {
#[default]
Reconcile,
Preserve,
}
pub use codex_protocol::config_types::WindowsSandboxProxySettingsMode;
/// Network settings installed by an administrator during managed Windows sandbox setup.
#[derive(Clone, Debug, Default, PartialEq, Eq)]