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

+1 -3
View File
@@ -37,14 +37,12 @@ impl Session {
next: &SessionConfiguration,
updates: &SessionSettingsUpdate,
) -> bool {
// TODO(anp): Reconcile invalidation with TurnEnvironment::sandbox_context.
// This gap predates that API: an internal Windows-level-only settings update
// can leave the published MCP configuration stale.
current.cwd() != next.cwd()
|| current.step_settings.approval_policy.value()
!= next.step_settings.approval_policy.value()
|| current.step_settings.approvals_reviewer != next.step_settings.approvals_reviewer
|| current.permission_profile() != next.permission_profile()
|| current.windows_sandbox_level != next.windows_sandbox_level
|| updates.environments.as_ref().is_some_and(|environments| {
environments.environments != self.services.turn_environments.selections()
})