Use turn environment settings for sandbox execution (#40771)

## Why

Tool execution can use an environment whose sandbox configuration differs from the turn-wide configuration. Sandbox selection and process setup need to follow the environment that owns the tool request.

## What changed

- Source Windows sandbox level, legacy Landlock mode, and Windows private desktop settings from the selected turn environment across tool orchestration, unified exec, patch application, and zsh fork escalation.
- Preserve Windows sandbox level overrides in restorable thread settings and invalidate MCP configuration when that level changes.

## Testing

- Add a resume test that verifies an elevated Windows sandbox override survives thread restoration.

GitOrigin-RevId: 9d8fc46404919f5ae97c9ed712c0932a1f095e36
This commit is contained in:
sayan-oai authored and copyberry committed 2026-08-26 03:28:57 +00:00
1 parent 3ba7b6941d
commit e24190caa9
9 files changed
+53 -37

No files matched your search

@@ -140,7 +140,7 @@ pub(crate) async fn prepare_unified_exec_zsh_fork(
sandbox_policy_cwd,
windows_sandbox_workspace_roots: exec_request.windows_sandbox_workspace_roots.clone(),
codex_linux_sandbox_exe: ctx.step_context.turn.config.codex_linux_sandbox_exe.clone(),
use_legacy_landlock: ctx.step_context.turn.config.features.use_legacy_landlock(),
use_legacy_landlock: req.turn_environment.config().use_legacy_landlock,
};
let escalation_policy = CoreShellActionProvider {
policy: Arc::clone(&exec_policy),