`apply_patch` command generates requests with illegible diff

Resolved 💬 5 comments Opened Aug 8, 2025 by nestedlogicsol Closed Aug 24, 2025
💡 Likely answer: A maintainer (gpeal, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.19.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

  1. Fresh install Codex
  2. Login with ChatGPT
  3. Run in sandbox mode (second option)
  4. Ask it to make a random edit to a random file
  5. Observe that:
  • Codex may fail to apply_patch
  • The apply_patch command lacks a proper diff—raw file content is injected instead

What is the expected behavior?

The expected behavior is that I receive a legible diff to approve.

What do you see instead?

Codex attempts to run the patch command option through the terminal, producing an illegible diff, instead of using tools available to itself and asking for approval.

<img width="826" height="506" alt="Image" src="https://github.com/user-attachments/assets/b867400d-53d7-43fa-a506-7617e0fcc5b8" />

<img width="849" height="787" alt="Image" src="https://github.com/user-attachments/assets/706a71f7-5b45-40e3-9962-a72b0fa62efe" />

Additional information

I could be assuming the correct behavior, but I seem to remember this not being a problem before the sandbox prompt added recently.

View original on GitHub ↗

5 Comments

overthetop · 1 year ago

This makes the codex cli impossible to use...I can't track any changes it makes

cthacker · 1 year ago

I also have this issue running on mac. Basically every patch I only get a proper diff AFTER it is approved

cthacker · 1 year ago

0.22.0 seems to actually fix this now

gpeal contributor · 1 year ago

This should be fixed now. Feel free to reopen if there is still an issue.

vmotta8 contributor · 10 months ago

@gpeal It looks like there are still related issues with the approval workflow (#4940, #4892). The "Don't Trust" option isn't applying the approval policy correctly. Opened PR #4941 to address this, would appreciate a review when you get a chance.