Skip to content

fix: fix fs sandbox helper for apply_patch#18296

Merged
viyatb-oai merged 7 commits intomainfrom
codex/viyatb/fix-fs-sandbox-apply-patch
Apr 17, 2026
Merged

fix: fix fs sandbox helper for apply_patch#18296
viyatb-oai merged 7 commits intomainfrom
codex/viyatb/fix-fs-sandbox-apply-patch

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Apr 17, 2026

Summary

  • pass split filesystem sandbox policy/cwd through apply_patch contexts, while omitting legacy-equivalent policies to keep payloads small
  • keep the fs helper compatible with legacy Landlock by avoiding helper read-root permission expansion in that mode and disabling helper network access

Root Cause

d626dc38950fb40a1a5ad0a8ffab2485e3348c53 routed exec-server filesystem operations through a sandboxed helper. That path forwarded legacy Landlock into a helper policy shape that could require direct split-policy enforcement. Sandboxed apply_patch hit that edge through the filesystem abstraction.

The same 0.121 edit-regression path is consistent with #18354: normal writes route through the apply_patch filesystem helper, fail under sandbox, and then surface the generic retry-without-sandbox prompt.

Fixes #18069
Fixes #18354

Validation

  • cd codex-rs && just fmt
  • earlier branch validation before merging current origin/main and dropping the now-separate PATH fix:
    • cd codex-rs && cargo test -p codex-exec-server
    • cd codex-rs && cargo test -p codex-core file_system_sandbox_context
    • cd codex-rs && just fix -p codex-exec-server
    • cd codex-rs && just fix -p codex-core
    • git diff --check
    • cd codex-rs && cargo clean

Co-authored-by: Codex noreply@openai.com
…andbox-apply-patch

# Conflicts:
#	codex-rs/core/src/codex.rs
Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai marked this pull request as ready for review April 17, 2026 17:30
@viyatb-oai viyatb-oai requested a review from starr-openai April 17, 2026 17:30
@viyatb-oai viyatb-oai changed the title [codex] Fix fs sandbox helper for apply_patch fix: fix fs sandbox helper for apply_patch Apr 17, 2026
…andbox-apply-patch

# Conflicts:
#	codex-rs/exec-server/src/fs_sandbox.rs
@viyatb-oai viyatb-oai merged commit f705f42 into main Apr 17, 2026
35 of 36 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/fix-fs-sandbox-apply-patch branch April 17, 2026 22:39
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 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.

Regression with writes on 0.121.0 v0.121.0: apply_patch fails with use_legacy_landlock=true and prompts sandbox retry for workspace edits

2 participants