Windows: apply_patch and sandboxed shell commands hang silently in one worktree (escalated commands still work)
What version of Codex CLI are you using?
codex-cli 0.172.0, model gpt-6.1-sol, reasoning effort xhigh
What platform is your computer?
Windows 11 Pro (build 26300), x64. Codex runs as a non-interactive agent session started by a local orchestrator, inside a git worktree on a local NTFS drive.
What issue are you seeing?
In one git worktree, apply_patch and normal (sandboxed) shell commands hang with no result at all. There is no error message: the tool call simply never returns (more than 1 minute for a one-line edit). Escalated commands (outside the sandbox) keep working in the same session, so git and file reads still succeed.
- Two sessions in a row hit this in the same worktree. The first was a resumed session that had already edited about 30 files and committed earlier the same day. The second was a fresh session, and it hung on its very first
apply_patch, a one-line insertion in a Markdown file. - In the same time window, other Codex sessions in other worktrees on the same machine edited and committed normally.
- A different agent (not Codex) then edited files in that same worktree with no problem. That points at the Codex sandbox for that path, not at the files or ACLs themselves.
- No live process referenced the worktree when the evidence was collected (checked by process command line), so there was no stray handle from an earlier session.
- It started right after a machine reboot and an update of the orchestrator; the worktree itself existed before the reboot.
This looks related to #42463 (Windows sandbox prevents editing existing files), but the symptom here is a silent hang instead of an error.
What steps can reproduce the bug?
Not reproducible on demand. What we observed:
- Create a git worktree and let a Codex session edit files and commit in it.
- Reboot the machine.
- Start a Codex session (resumed or new) in the same worktree and ask for a one-line
apply_patchedit. - The
apply_patchcall (and sandboxed read commands) never return; escalated commands work.
What is the expected behavior?
apply_patch either succeeds or fails with an error that can be acted on. It should not hang with no output.
Additional information
We worked around it by moving that task to another agent. Happy to collect logs if you can tell us which ones (sandbox setup logs, ~/.codex session files).
Another occurrence on the same machine and day, in a different worktree: a codex-cli 0.172.0 session (gpt-6.1-sol) started a git merge-resolution task, and its sandboxed native commands stopped returning. The session made no changes to the tree before we stopped it. Escalated commands still worked. That makes 3 sessions across 2 worktrees after the reboot, while other Codex sessions on the same machine kept working normally.