macOS: internal apply_patch intermittently times out on simple edits
Open 💬 1 comment Opened Apr 14, 2026 by andrewalex
Summary
On macOS ARM64 with codex-cli 0.120.0, the internal apply_patch tool intermittently hangs for about 10 seconds and returns exit code 124 on simple file edits. The same patch often succeeds on a later retry. In one repro, adding *** End of File to the patch made the retry succeed immediately.
This does not appear to be an installation problem:
codex --versionreportscodex-cli 0.120.0- the native binary is present via the normal npm-installed wrapper
- there is no standalone
apply_patchexecutable onPATH, which appears to be expected becauseapply_patchis an internal tool
Environment
- Host: Mac mini
- OS: Darwin 25.3.0 / macOS ARM64
- Codex CLI:
0.120.0 - Install path:
/opt/homebrew/bin/codex - Wrapper target:
/opt/homebrew/lib/node_modules/@openai/codex/bin/codex.js - Native package:
@openai/codex-darwin-arm64
Repro
Create a scratch file:
tmpdir=$(mktemp -d /tmp/codex-applypatch2.XXXXXX)
printf 'one\ntwo\n' > "$tmpdir/sample.txt"
Run Codex in writable exec mode:
codex exec --json --full-auto --skip-git-repo-check --cd "$tmpdir" \
'Edit sample.txt to replace two with two patched, using apply_patch if available.'
What happened in the recorded session:
- Codex read
sample.txtcorrectly. - Codex invoked internal
apply_patchwith:
*** Begin Patch
*** Update File: sample.txt
@@
-two
+two patched
*** End Patch
- The tool returned:
command timed out after 10010 milliseconds
with metadata:
{"exit_code":124,"duration_seconds":10.0}
- The file was unchanged after the timeout.
- A retry with the same minimal patch also timed out.
- A later retry with:
*** Begin Patch
*** Update File: sample.txt
@@
-two
+two patched
*** End of File
*** End Patch
then succeeded immediately.
Observed Behavior
- First
apply_patchattempt often times out after ~10 seconds. - The target file remains unchanged after the timeout.
- A later retry may succeed.
- In at least one repro, adding
*** End of Filechanged the outcome from timeout to success. - Enabling
apply_patch_freeformdid not eliminate the first-attempt timeout in my testing.
Expected Behavior
The minimal patch should either:
- apply successfully on the first attempt, or
- fail quickly with a deterministic parse/verification error
It should not hang for ~10 seconds on a tiny local file.
Notes
- This was reproducible outside the local harness sandbox, so it does not appear to be caused by the harness blocking writes.
- I also found the same
command timed out after 10010 millisecondspattern in earlier interactive Codex logs, so this does not look specific tocodex exec.
If useful, I can provide the exact JSONL session log excerpt and the matching codex-tui.log lines.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗