Skip to content

[codex] Tighten unified exec sandbox setup#22207

Open
bookholt-oai wants to merge 2 commits into
mainfrom
dev/bookholt/cli-8744-workdir-sandbox-root
Open

[codex] Tighten unified exec sandbox setup#22207
bookholt-oai wants to merge 2 commits into
mainfrom
dev/bookholt/cli-8744-workdir-sandbox-root

Conversation

@bookholt-oai
Copy link
Copy Markdown

@bookholt-oai bookholt-oai commented May 11, 2026

Summary

  • tighten unified exec sandbox initialization
  • preserve the requested process workdir independently from sandbox setup
  • add regression coverage for the updated invariant

Validation

  • Ran /tmp/cargo-tools/bin/just fmt.
  • Ran focused codex-core regression tests successfully.
  • Ran cargo test -p codex-core; it did not complete cleanly because unrelated existing agent/config-loader tests failed and the run later aborted on a stack overflow in tools::handlers::multi_agents::tests::tool_handlers_cascade_close_and_resume_and_keep_explicitly_closed_subtrees_closed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@bookholt-oai bookholt-oai changed the title [codex] Fix model-controlled workdir from changing sandbox cwd [codex] Keep unified exec policy cwd anchored to the turn cwd May 11, 2026
@bookholt-oai bookholt-oai changed the title [codex] Keep unified exec policy cwd anchored to the turn cwd [codex] Tighten unified exec sandbox setup May 11, 2026
@bookholt-oai bookholt-oai force-pushed the dev/bookholt/cli-8744-workdir-sandbox-root branch from aafd6f8 to afec29e Compare May 11, 2026 21:46
@bookholt-oai
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@bookholt-oai
Copy link
Copy Markdown
Author

recheck

github-actions Bot added a commit that referenced this pull request May 11, 2026
@bookholt-oai bookholt-oai marked this pull request as ready for review May 11, 2026 22:18
@bookholt-oai bookholt-oai requested a review from a team as a code owner May 11, 2026 22:18
@bookholt-oai bookholt-oai enabled auto-merge (squash) May 11, 2026 22:18
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

💡 Codex Review

let mut exec_env = attempt
.env_for(command, options, managed_network)
.map_err(|err| ToolError::Codex(err.into()))?;
exec_env.exec_server_env_config = req.exec_server_env_config.clone();
match zsh_fork_backend::maybe_prepare_unified_exec(

P1 Badge Keep zsh-fork interception on the selected environment cwd

The zsh-fork path passes an ExecRequest whose policy cwd now comes from the orchestrator default. For a non-primary environment_id, intercepted execs in the long-lived shell are evaluated against the primary cwd rather than the environment actually running the process, so later subcommands can be incorrectly allowed, prompted, or escalated.

ℹ️ 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/unified_exec/process_manager.rs Outdated
Comment thread codex-rs/core/src/tools/runtimes/unified_exec.rs
bookholt-oai and others added 2 commits May 11, 2026 23:27
Refine unified exec sandbox initialization while preserving the requested process workdir.

Co-authored-by: Codex <noreply@openai.com>
Keep sandbox and approval evaluation aligned with the selected turn environment while allowing the process workdir to vary independently.

Co-authored-by: Codex <noreply@openai.com>
@bookholt-oai bookholt-oai force-pushed the dev/bookholt/cli-8744-workdir-sandbox-root branch from f635339 to ca2e4bb Compare May 11, 2026 23:30
Copy link
Copy Markdown
Contributor

@evawong-oai evawong-oai left a comment

Choose a reason for hiding this comment

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

Approved based on macOS validation.

Validated PR head ca2e4bbca18cb814776d0aca0a6038c3eb65269e.

  1. macOS: full report shaped validation passed on the macOS validation host. The model supplied workdir no longer becomes the sandbox policy root, and the outside marker write is denied.

  2. Windows: same report shaped validation still reproduces on the Windows validation host. Base and PR head both allowed the outside marker write. This looks like a Windows specific remaining gap, because the Windows sandbox setup still grants write access to the command cwd for workspace write. I am treating that as next PR scope, not a blocker for this macOS scoped fix.

This approval is for the macOS fix in this PR. Windows should be handled in a follow up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants