Skip to content

windows-sandbox: pass workspace roots to runner#24108

Merged
bolinfest merged 1 commit into
mainfrom
pr24108
May 28, 2026
Merged

windows-sandbox: pass workspace roots to runner#24108
bolinfest merged 1 commit into
mainfrom
pr24108

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented May 22, 2026

Why

#23813 switches the Windows sandbox runner path to PermissionProfile, but it still left one runtime anchor for resolving symbolic :workspace_roots entries. That is not enough once a turn has multiple effective workspace roots: exact entries and deny globs under :workspace_roots need to be materialized for every runtime root before the command runner chooses token mode or builds ACL plans.

What Changed

  • Replaces the Windows runner/setup permission_profile_cwd plumbing with workspace_roots: Vec<AbsolutePathBuf>.
  • Resolves Windows-local PermissionProfile data with materialize_project_roots_with_workspace_roots(...) instead of the single-cwd helper.
  • Threads Config::effective_workspace_roots() through core execution, unified exec, TUI setup/read-grant flows, app-server setup, app-server command/exec, and debug sandbox on Windows.
  • Preserves those workspace roots through the zsh-fork escalation executor instead of rebuilding them from sandbox_policy_cwd.
  • Makes ExecRequest::new(...) and the remaining build_exec_request(...) helper path take windows_sandbox_workspace_roots explicitly so new call sites cannot silently fall back to vec![cwd].
  • Clarifies the debug sandbox non-Windows comment: remaining cwd-dependent resolution still uses sandbox_policy_cwd, while :workspace_roots entries are already materialized from config roots.
  • Updates elevated runner IPC SpawnRequest to send workspace_roots and bumps the framed IPC protocol version to 3 for the payload shape change.
  • Adds Windows-local resolver coverage for expanding exact and glob :workspace_roots entries across multiple roots, plus core helper coverage proving explicit roots are preserved.

Verification

  • cargo check -p codex-windows-sandbox -p codex-core -p codex-tui -p codex-cli -p codex-app-server
  • cargo test -p codex-windows-sandbox
  • cargo test -p codex-core windows_sandbox
  • cargo test -p codex-core unix_escalation
  • cargo test -p codex-app-server windows_sandbox
  • cargo test -p codex-tui windows_sandbox
  • cargo test -p codex-cli debug_sandbox
  • just test -p codex-core unified_exec
  • just test -p codex-core build_exec_request_preserves_windows_workspace_roots
  • env -u CODEX_NETWORK_PROXY_ACTIVE -u CODEX_NETWORK_ALLOW_LOCAL_BINDING just test -p codex-app-server --lib command_exec
  • just test -p codex-windows-sandbox
  • just test -p codex-exec sandbox
  • just fix -p codex-core -p codex-app-server -p codex-windows-sandbox

A local macOS cross-check with cargo check --target x86_64-pc-windows-msvc ... did not reach crate Rust code because native dependencies require Windows SDK headers (windows.h / assert.h) in this environment; Windows CI remains the real target validation.

Two local targeted filters compile but do not run assertions on macOS: env -u CODEX_NETWORK_PROXY_ACTIVE -u CODEX_NETWORK_ALLOW_LOCAL_BINDING just test -p codex-app-server --lib command_exec_processor matched zero tests, and just test -p codex-linux-sandbox landlock matched zero tests because the landlock suite is Linux-only.

@bolinfest bolinfest requested a review from a team as a code owner May 22, 2026 17:40
@bolinfest bolinfest changed the base branch from main to pr23813 May 22, 2026 17:40
@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

💡 Codex Review

command_cwd.as_path(),
command_cwd.as_path(),

P1 Badge Pass workspace-roots slice to setup refresh helper

run_setup_refresh now takes workspace_roots: &[AbsolutePathBuf], but this test still passes command_cwd.as_path() as the second argument. On Windows test builds, that is a type mismatch and prevents codex-windows-sandbox tests from compiling at all, so CI for this crate will fail before running any tests. The same argument mismatch appears again in the run_setup_refresh_with_extra_read_roots call immediately below.

ℹ️ 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".

bolinfest added a commit that referenced this pull request May 26, 2026
## Why

The Windows sandbox runner still carried the old `SandboxPolicy`
compatibility path even though core now computes `PermissionProfile`.
That meant Windows command-runner execution could only see the legacy
projection, so profile-only filesystem rules such as deny globs were not
part of the runner input.

## What Changed

- Removed the Windows-local `SandboxPolicy` parser/export and deleted
`windows-sandbox-rs/src/policy.rs`.
- Changed restricted-token capture/session setup, elevated setup,
world-writable audit, read-root grant, and command-runner session APIs
to accept `PermissionProfile` plus the profile cwd.
- Bumped the elevated command-runner IPC protocol to version 2 because
`SpawnRequest` now carries `permission_profile` /
`permission_profile_cwd` instead of the legacy `policy_json_or_preset` /
`sandbox_policy_cwd` fields.
- Updated core exec, unified exec, debug-sandbox, TUI setup/grant flows,
and app-server setup to pass the actual effective `PermissionProfile`.
- Left regression coverage asserting the old IPC policy fields are
absent and the runner serializes tagged `PermissionProfile` JSON.

## Verification

- `cargo test -p codex-windows-sandbox`
- `cargo test -p codex-core windows_sandbox`
- `cargo test -p codex-app-server
request_processors::windows_sandbox_processor`
- `just fix -p codex-windows-sandbox -p codex-core -p codex-app-server
-p codex-cli -p codex-tui`
- `just fix -p codex-cli -p codex-tui`
- `just fix -p codex-windows-sandbox -p codex-tui`
- `rg "\\bSandboxPolicy\\b" codex-rs/windows-sandbox-rs` returned no
matches.

Note: `cargo test -p codex-cli` was attempted but did not reach crate
tests because local disk filled while compiling dependencies (`No space
left on device`). The targeted clippy pass compiled the affected CLI/TUI
surfaces afterward.




---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/23813).
* #24108
* __->__ #23813
Base automatically changed from pr23813 to main May 26, 2026 21:56
@bolinfest bolinfest force-pushed the pr24108 branch 2 times, most recently from 7e648d7 to d3ed08c Compare May 26, 2026 22:03
@bolinfest
Copy link
Copy Markdown
Collaborator Author

Addressed in d3ed08c: the setup refresh test now builds a workspace-roots slice with workspace_roots_for(command_cwd.as_path()) and passes it to both run_setup_refresh and run_setup_refresh_with_extra_read_roots.

@bolinfest
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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".

@bolinfest bolinfest merged commit 986c604 into main May 28, 2026
47 of 62 checks passed
@bolinfest bolinfest deleted the pr24108 branch May 28, 2026 22:26
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 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.

3 participants