config.yaml not respected (approvalMode ignored), error spawn ENOTDIR and ENAMETOOLONG

Resolved 💬 4 comments Opened Apr 22, 2025 by lucasrod Closed Aug 7, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator) responded on this thread — see the highlighted reply below.

What version of Codex is running?

v0.1.2504161551

Which model were you using?

gpt-4o

What platform is your computer?

Darwin 24.4.0 arm64 arm

What steps can reproduce the bug?

  1. Create ~/.codex/config.yaml with the following contents:

``yaml
model: gpt-4o # Modelo más inteligente disponible
approvalMode: auto-edit # Requiere aprobación para cambios
fullAutoErrorMode: ask-user # Pregunta si algo falla en modo full-auto
notify: true # Enable desktop notifications for responses
``

  1. In any Git‑tracked project directory, run:

``bash
cd ~/Repos/P1/Tarea\ 1
codex "start implementing siguienteDigito, tell me in spanish what should the function do and what strategy you will be using to implement this."
``

  1. Observe that Codex reports:

``
↳ model: gpt-4o
↳ approval: suggest ← should be “auto-edit”
``

  1. Try to apply a multi‑line patch, for example:

```bash
codex <<EOF
apply_patch "* Begin Patch
* Update File: pruebas/tarea1.pas
@@ -1,3 +1,8 @@
procedure siguienteDigito(...);
begin

  • digito := num mod 10;
  • num := num div 10;

end;
*** End Patch"
EOF
``
– this triggers:
`
Error: spawn ENOTDIR
``

  1. Alternatively, attempt a long cat <<EOF > … heredoc patch and get:

``
Error: spawn ENAMETOOLONG
``

What is the expected behavior?

  • Configuration: Codex CLI should read ~/.codex/config.yaml at startup and set:

``
approvalMode: auto‑edit
``

  • Patch application: Codex should apply both incremental patches and larger heredoc patches without spawning into a non‑directory path or exceeding command‑line length limits.
  • Working directory resolution: When running apply_patch against pruebas/tarea1.pas, the CLI should locate that file and write the changes there, not throw ENOTDIR.

What do you see instead?

  • Config ignored: After /clear and restart, Codex still shows:

``
↳ approval: suggest
``

  • Spawn errors:
  • Error: spawn ENOTDIR when applying a small patch.
  • Error: spawn ENAMETOOLONG when attempting a larger heredoc.
  • Patch text never applied, leaving the stub implementation unchanged.

Additional information

  • ~/.codex/instructions.md and project codex.md are being loaded correctly.
  • The project path contains a space (Tarea 1), which may be contributing to ENOTDIR errors.
  • Manual invocation of patch or editing the file outside Codex works fine.
  • Using flags --approval-mode auto-edit on the CLI invocation does work, suggesting only the config file load is broken.
  • Node.js version: v23.11.0
  • Codex CLI installed via npm install -g @openai/codex

View original on GitHub ↗

4 Comments

tibo-openai collaborator · 1 year ago
Jakc4der · 1 year ago

Yup. Same for me on both points. Its now at a point for me using just the cli where it wont even detect files in folder whatsoever. The rare time it does go through i get an error file too large when its only a few hundred lines long. And refuses to pull it. But then when i force it to head the lines i can get all. But then after heading the lines i say apply the patch or fix, 'cannot find/detect x.py .. '. Rip my sanity.

dedsecorg · 1 year ago

Here it says:
╭──────────────────────────────────────────────────────────────╮
│ localhost session: bfe8943439744db49d18d9d2e05b8169 │
│ ↳ workdir: ~/projects/Ov3rIDE-X │
│ ↳ model: gpt-4o │
│ ↳ provider: openai │
│ ↳ approval: full-edit │
╰──────────────────────────────────────────────────────────────╯
But, it doesn't "respect it" until i change approval to "full-edit" manually

codex-maintainers · 1 year ago

Thank you for the detailed feedback! Please try again on the latest version of Codex CLI. If the issue persists, we'd appreciate it if you could contribute to the codex-rs/ implementation. You can find more information about our ongoing updates here: https://github.com/openai/codex/discussions/1174.