codex icon indicating copy to clipboard operation
codex copied to clipboard

GPT-4.1 failing to use `apply_patch`

Open fouad-openai opened this issue 1 year ago • 16 comments

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

fouad-openai avatar Apr 23 '25 17:04 fouad-openai

Yes, the same here:

w0 [Error]: 400 No tool output found for function call call_awtGvM1Tkz1MfAeh36lau4ou.
    at e.generate (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:473:4010)
    at Rr.makeStatusError (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:477:7623)
    at Rr.makeRequest (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:477:8555)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async fE.run (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:493:198) {
  status: 400,
  headers: {
    'alt-svc': 'h3=":443"; ma=86400',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '934fb18beabc4791-DFW',
    connection: 'keep-alive',
    'content-length': '184',
    'content-type': 'application/json',
    date: 'Wed, 23 Apr 2025 19:16:08 GMT',
    'openai-organization': 'user-blabla',
    'openai-processing-ms': '278',
    'openai-version': '2020-10-01',
    server: 'cloudflare',
    'set-cookie': '__cf_bm=blabla.sXjSIo-1745435768-1.0.1.1-oQEyLVda26eieznfD7TLm8KHmNsBnTVg4gn50I00PfytPAs42UpC4WffVfYj8G0Usgl67fiSV7p4FVYS3ZzBrauBjLpXpU.FOfB4NAyJcVc; path=/; expires=Wed, 23-Apr-25 19:46:08 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=C07Xu2Zhid_z_DVUZH4tKlD7vKjDNcswV9Sl0QOMVvE-1745435768032-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    'x-request-id': 'req_c81bd8bcc25b72c705940d2d753d91fa'
  },
  request_id: 'req_c81bd8bcc25b72c705940d2d753d91fa',
  error: {
    message: 'No tool output found for function call call_awtGvM1Tkz1MfAeh36lau4ou.',
    type: 'invalid_request_error',
    param: 'input',
    code: null
  },
  code: null,
  param: 'input',
  type: 'invalid_request_error'
}

Node.js v20.12.2

Yamilquery avatar Apr 23 '25 19:04 Yamilquery

Same issue

WalkerHi11 avatar Apr 23 '25 23:04 WalkerHi11

Same issue!

brad-kenstler avatar Apr 24 '25 02:04 brad-kenstler

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.

brickfrog avatar Apr 24 '25 17:04 brickfrog

same issue on mac, none of the new models apply anything.

XxUnkn0wnxX avatar Apr 24 '25 19:04 XxUnkn0wnxX

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.

codex
I've written a detailed README to foundation_model_vqa/prompts/README.md outlining: ...

But the file is empty. Even though --full-auto is enabled, and I suggested using shell escapes etc. to try writing.

afspies avatar Apr 25 '25 10:04 afspies

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

arynaq avatar Apr 25 '25 15:04 arynaq

This makes it unusable tbh. Are we even getting credits lost back?

ferrufino avatar Apr 27 '25 04:04 ferrufino

Im having the same issue, effectively makes 4.1 unusable for a lot of tasks, what a shame.

toastloaf avatar Apr 29 '25 15:04 toastloaf

same here. not writing anything on macOS with gpt 4.1

liviuios avatar May 06 '25 07:05 liviuios

same issue

hadoopjax avatar May 06 '25 14:05 hadoopjax

how is this not fixed? GPT-4.1 is supposed to be a flagship developer model. It's unusable from my perspective.

  • gpt 4.1 and 4.1-[date-slug] are both failing

kohl00 avatar May 13 '25 19:05 kohl00

same with 4.1

sernote avatar May 14 '25 14:05 sernote

this should be fixed by #930 and included in the latest release!

fouad-openai avatar May 15 '25 16:05 fouad-openai

thanks @fouad-openai !

kohl00 avatar May 15 '25 16:05 kohl00

Thanks again @fouad-openai, fast delivery 🔥

ferrufino avatar May 15 '25 17:05 ferrufino