Codex Desktop on WSL: apply_patch always requests approval in writable workspace, while normal shell writes do not
What version of the Codex App are you using (From “About Codex” dialog)?
26.415.20818
What subscription do you have?
Pro $200
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What issue are you seeing?
The issue began after the latest app update. It includes desktop runtime codex-cli 0.122.0-alpha.1
- apply_patch always triggers the approval flow, even for tiny writes in the current writable workspace like Playground, or in git-controlled repos. This did not happen before.
- The session logs show those attempts ending as patch_apply_end with status:"declined" and stderr:"patch rejected by user".
- Ordinary shell writes in the same workspace succeeded without approval. I created shell_write_probe.txt directly with touch, and that worked.
What steps can reproduce the bug?
Uploaded thread: 019d9c61-6002-79a1-b36b-6459c0afa675
Ask the agent to edit a file within a Git-repo. It will attempt to use apply_patch and ask you for permissions, even though permissions are configured to allow edits. Other edit tools work fine.
What is the expected behavior?
apply_patch works without asking for permission.
Additional information
Here is my config.toml that is active. However switching to default permissions did not fix this problem either. Nor did changing the windows sandbox values.
#:schema https://developers.openai.com/codex/config-schema.json
model = "gpt-5.4"
model_reasoning_effort = "high"
personality = "pragmatic"
full-auto mode
approval_policy = "on-request"
sandbox_mode = "workspace-write"
file_opener = "vscode"
plan_mode_reasoning_effort = "high"
[features]
unified_exec = true
shell_snapshot = true
undo = true
prevent_idle_sleep = true
multi_agent = true
[shell_environment_policy]
inherit = "all"
ignore_default_excludes = true
Allow the agent to use the network when running in your workspace
[sandbox_workspace_write]
network_access = true
writable_roots = [ "/home/ekane/.m2", "/mnt/c/Users/eschu/.codex/skills/playwright-skill",
"/home/ekane/src/github.com/sentrylink/webapp", "/home/ekane/src/github.com/sentrylink/terraform",
"/home/ekane/src/github.com/sentrylink/sysadmin", "/tmp" ]
[tui]
notifications = true
status_line = ["model-with-reasoning", "current-dir", "git-branch"]
[history]
persistence = "save-all"
max_bytes = 104857600 # 100 MB
[projects."/home/ekane/src/github.com"]
trust_level = "trusted"
[projects."/home/ekane/src/github.com/sentrylink/webapp"]
trust_level = "trusted"
[projects."/home/ekane/src/github.com/sentrylink/batchjobs"]
trust_level = "trusted"
[projects."/home/ekane/src/github.com/novalabs/NovaPassServer"]
trust_level = "trusted"
[projects."/home/ekane/src/github.com/sentrylink/terraform"]
trust_level = "trusted"
[projects."/home/ekane/src/github.com/sentrylink/sysadmin"]
trust_level = "trusted"
[projects."/home/ekane"]
trust_level = "trusted"
[projects."/mnt/c/Users/eschu/OneDrive/Documents/Playground"]
trust_level = "trusted"
[plugins."google-calendar@openai-curated"]
enabled = true
[plugins."gmail@openai-curated"]
enabled = true
[plugins."github@openai-curated"]
enabled = true
[plugins."google-drive@openai-curated"]
enabled = true
[windows]
sandbox = "unelevated"
11 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I believe this relates to https://github.com/openai/codex/issues/18069 . I was forced to revert to version 0.120.0 on WSL to even get this to work properly in the CLI. Since the app uses a higher version, the problem shows up there as well.
Although #18069 has resolved the issue in the CLI now via the codex-cli 0.122.0-alpha.9 release, the Windows app is still on 122-alpha.1 and so not usable for me or other WSL users. Guess I'm back to the CLI. Hopefully we get a Windows app update soon...
Still failing with the same issue in version 26.415.30602
Still failing with the same issue in version 26.415.40636. Well at least the app is getting regular updates...
The real edit path for apply_patch is not “agent writes file directly”. It is:
The bug was in how Codex prepared that helper sandbox.
The core fix
In codex/codex-rs/exec-server/src/fs_sandbox.rs:45, the helper sandbox policy is built from the outer workspace-write policy before the helper is launched.
Old behavior:
That mismatch sat right here:
I changed codex/codex-rs/exec-server/src/fs_sandbox.rs:264 so the helper policy is normalized to what the helper actually needs:
That matters because the fs-helper does not need network. Once the helper policy says “no network” and the split policy also says “restricted network”, the policy set becomes internally consistent.
So the pure-bwrap fix was:
The second fix
In codex/codex-rs/exec-server/src/fs_sandbox.rs:114, I also made the extra helper executable read-root conditional on legacy mode.
That part was mainly to stop legacy mode from producing a filesystem policy Landlock could not represent. It is not the reason pure bwrap works now, but it removed the other half of the failure you
were hitting earlier.
Why it now works without legacy Landlock
With your current config:
Codex is taking the pure bwrap branch in codex/codex-rs/linux-sandbox/src/linux_run_main.rs:177.
That path was already structurally fine. What was broken was the helper policy being handed into it. After the helper-policy normalization fix, the helper child can be sandboxed and started
correctly, so apply_patch completes instead of dying and triggering the approval fallback.
What the Linux fallback patch did
The changes in codex/codex-rs/linux-sandbox/src/linux_run_main.rs:404 added a real fallback when bwrap setup genuinely fails. That is a robustness fix.
It is not the code path your working restarted session is using now.
Your current successful path is:
So the precise answer is:
That is why, after removing legacy Landlock and restarting, apply_patch now works directly.
@yarsawyer are you a contributor to this repo or are you describing a fork?
I did quite a few experiments. Once Open AI updates the underlying codex CLI the desktop app calls within WSL to version 0.122.0-alpha.9 or higher it should fix this issue. Presumably (hopefully) this will happen when version 0.123 stable is out.
i am describing what has helped me to fix the problem.
Thank you very much. I guess I will wait a few days for Open AI to fix this as I don't really want to fork such an active repo. I was at least happy to get the CLI working again with 0.122.0-alpha.9, I can live without the app for a while.
I'm experiencing this too since version 26.415.20818 and still happening on pre-release version 26.5415.20818
Using Codex VS Code extension on windows with ssh remote to debian based devcontainer image
apply_patch always requests approval even after selecting "yes, and don't ask again this session"
The app has updated to
codex-cli 0.122.0-alpha.13and as predicted, that fixed the issue.