Skip to content

Add hidden Windows sandbox wrapper entrypoint#28358

Merged
iceweasel-oai merged 2 commits into
mainfrom
codex/windows-sandbox-wrapper-entrypoint
Jun 15, 2026
Merged

Add hidden Windows sandbox wrapper entrypoint#28358
iceweasel-oai merged 2 commits into
mainfrom
codex/windows-sandbox-wrapper-entrypoint

Conversation

@iceweasel-oai

@iceweasel-oai iceweasel-oai commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Why

This is the second PR in the Windows fs-helper sandbox stack. The fs-helper path needs a Windows sandbox launcher that has the same argv-shaped contract as macOS sandbox-exec and codex-linux-sandbox, but this PR only introduces that hidden launcher. It does not route fs-helper through it yet.

The hidden launcher still needs to be policy-complete before later direct-spawn callers use it. In particular, it has to carry the same Windows sandbox policy details that the existing spawn paths already understand: proxy enforcement, read/write root overrides, and deny-read/deny-write overrides.

What Changed

  • Added the hidden codex.exe --run-as-windows-sandbox arg1 dispatch path.
  • Added windows-sandbox-rs/src/wrapper.rs, which parses the wrapper argv, launches the requested command through the shared Windows sandbox session runner from PR1, and forwards stdio.
  • Added create_windows_sandbox_command_args_for_permission_profile() so later direct-spawn callers can build the wrapper argv consistently.
  • Made the wrapper argv round-trip the full Windows sandbox policy surface it needs later: workspace roots, environment, permission profile, sandbox level, private desktop, proxy enforcement, read/write root overrides, and deny-read/deny-write overrides.
  • Carried proxy_enforced through the shared Windows session request so proxy-managed executions continue to use the offline/elevated sandbox identity.
  • Added wrapper argument round-trip coverage for the full policy fields.

Verification

  • just test -p codex-windows-sandbox windows_wrapper_args_round_trip
  • just test -p codex-arg0
  • just test -p codex-core exec::tests::windows_
  • just fix -p codex-windows-sandbox -p codex-core -p codex-cli

Local note: the full just fmt command still fails on this workstation in non-Rust formatter setup (uv cache access denied and missing dotslash/buildifier), but the Rust formatter phase completed.

@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: 36421a9d53

ℹ️ 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/windows-sandbox-rs/src/wrapper.rs Outdated
Comment thread codex-rs/windows-sandbox-rs/src/wrapper.rs
cwd: request.command_cwd.as_path(),
env_map: request.env_map,
windows_sandbox_level: request.windows_sandbox_level,
timeout_ms: None,

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.

P2 Badge Propagate timeouts to the sandboxed child

For direct-spawn callers that enforce a timeout/cancellation by supervising the wrapper process, the inner Windows sandbox session is launched with timeout_ms: None. If the parent kills only codex.exe --run-as-windows-sandbox, the elevated runner waits indefinitely and the sandboxed command can continue orphaned; pass the caller timeout/cancellation through the wrapper or terminate the session when the wrapper is torn down.

Useful? React with 👍 / 👎.

Comment thread codex-rs/windows-sandbox-rs/src/wrapper.rs Outdated
@iceweasel-oai
iceweasel-oai force-pushed the codex/windows-sandbox-wrapper-entrypoint branch from 36421a9 to a6155c2 Compare June 15, 2026 18:25
Base automatically changed from codex/windows-sandbox-shared-runner to main June 15, 2026 18:30
@iceweasel-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@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: a6155c29ff

ℹ️ 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/arg0/Cargo.toml
@iceweasel-oai
iceweasel-oai force-pushed the codex/windows-sandbox-wrapper-entrypoint branch from a6155c2 to 60d8329 Compare June 15, 2026 20:27
@iceweasel-oai
iceweasel-oai requested a review from a team as a code owner June 15, 2026 21:01
@iceweasel-oai
iceweasel-oai enabled auto-merge (squash) June 15, 2026 21:27
@iceweasel-oai
iceweasel-oai merged commit fbbe770 into main Jun 15, 2026
60 of 63 checks passed
@iceweasel-oai
iceweasel-oai deleted the codex/windows-sandbox-wrapper-entrypoint branch June 15, 2026 21:30
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 15, 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