GPT-4.1 failing to use `apply_patch`
Resolved 💬 16 comments Opened Apr 23, 2025 by fouad-openai Closed May 15, 2025
💡 Likely answer: A maintainer (fouad-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.1.2504221401
Which model were you using?
gpt-4.1
What platform is your computer?
darwin 24.3.0 arm64 arm
What steps can reproduce the bug?
Using gpt-4.1 as model, it doesn't call apply_patch - it just writes the patch in the assistant message.
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
16 Comments
Yes, the same here:
Same issue
Same issue!
Same. Not sure if this is a duplicate of another issue already or a quirk of the LLM itself, but it seems to consistently (~80%) of the time refuse to apply patches with o4.1, might be a function of size. Noticed it starts off, e.g. patching json, etc. but then fails spectacularly once it tries to edit "real" code.
I did some tests out of curiosity, it doesn't seem to be a blanket failure (It worked once), but it is extremely weird that the failure rate is that high.
same issue on mac, none of the new models apply anything.
Same on macbook M2 - wasted quite a lot of credits to get empty files.
During early testing with o3 this was not an issue, but it is consistently an issue with GPT4.1 at present. E.g.
But the file is empty. Even though --full-auto is enabled, and I suggested using shell escapes etc. to try writing.
So...
I opened up this repo, and asked it to debug itself, eventually it learned that it was generating malformed patches. There is apparently a mismatch between the patch syntax expected and generated (_ vs *), the parser vs the prompt.
At least in bfe6fac463474d8a0583fc03364eb9a08bd764c7
This makes it unusable tbh. Are we even getting credits lost back?
Im having the same issue, effectively makes 4.1 unusable for a lot of tasks, what a shame.
same here. not writing anything on macOS with gpt 4.1
same issue
how is this not fixed? GPT-4.1 is supposed to be a flagship developer model. It's unusable from my perspective.
same with 4.1
this should be fixed by #930 and included in the latest release!
thanks @fouad-openai !
Thanks again @fouad-openai, fast delivery 🔥