Skip to content

core: stop threading SandboxPolicy through exec#25700

Merged
bolinfest merged 1 commit into
mainfrom
pr25700
Jun 3, 2026
Merged

core: stop threading SandboxPolicy through exec#25700
bolinfest merged 1 commit into
mainfrom
pr25700

Conversation

@bolinfest

@bolinfest bolinfest commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Why

#25450 attempts a broad SandboxPolicy removal across several unrelated surfaces, which makes it hard to review and still leaves new helper code moving legacy policies around. This PR is a narrower alternative: migrate only the exec-side Windows sandbox plumbing so the review can focus on one production path and one compatibility boundary.

The goal is to stop threading SandboxPolicy through exec code without expanding the migration into app-server, protocol, telemetry, config, or session behavior.

What changed

  • Removed ExecRequest::compatibility_sandbox_policy().
  • Changed the Windows restricted-token and elevated filesystem override helpers to accept PermissionProfile plus the split filesystem/network policies instead of a SandboxPolicy.
  • Kept the remaining legacy projection local to the writable-root comparison that still needs to compare split policy behavior against the legacy Windows backend model.
  • Rejected restricted split filesystem policies that still grant full-disk writes before using the Windows restricted-token backend, preserving the previous clear-failure behavior for profiles that project to ExternalSandbox.
  • Updated the Windows sandbox override tests to exercise the new call shape and cover the full-write split-profile regression.

Verification

  • just test -p codex-core windows_restricted_token
  • just test -p codex-core windows_elevated

@bolinfest bolinfest requested a review from a team as a code owner June 1, 2026 21:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7c4bd59ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/exec.rs Outdated

@viyatb-oai viyatb-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. the error message with permission_profile={permission_profile:?} might be too large to show - should we truncate it or replace it with the name of the profile?

Replace the exec-side legacy SandboxPolicy plumbing with PermissionProfile-based Windows sandbox override resolution.

The runtime still needs a legacy SandboxPolicy projection for a few compatibility surfaces and for Windows override baseline comparisons, but that projection is now derived from a single PermissionProfile instead of accepting separately materialized FileSystemSandboxPolicy and NetworkSandboxPolicy inputs. This avoids mismatched permission arguments while keeping the migration scoped to the existing compatibility boundary.

Keep the Windows exec tests aligned with that shape by constructing PermissionProfile values through the highest-level available helpers instead of routing test setup through SandboxPolicy compatibility conversions.

Keep unsupported Windows sandbox error messages concise by reporting the PermissionProfile variant name instead of dumping the full profile payload.

Validation:
- just fmt
- CI for tests
@bolinfest bolinfest merged commit 52b359b into main Jun 3, 2026
47 of 64 checks passed
@bolinfest bolinfest deleted the pr25700 branch June 3, 2026 17:41
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants