Skip to content

GPT-4.1 failing to use apply_patch #593

Closed

Description

@fouad-openai

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

Activity

  1. added
    bug
    on Apr 23, 2025
  2. Yamilquery commented on Apr 23, 2025

    @Yamilquery

    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
    
  3. WalkerHi11 commented on Apr 23, 2025

    @WalkerHi11

    Same issue

  4. brad-kenstler commented on Apr 24, 2025

    @brad-kenstler

    Same issue!

  5. brickfrog commented on Apr 24, 2025

    @brickfrog

    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.

  6. XxUnkn0wnxX commented on Apr 24, 2025

    @XxUnkn0wnxX

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

  7. afspies commented on Apr 25, 2025

    @afspies

    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.

  8. arynaq commented on Apr 25, 2025

    @arynaq

    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 bfe6fac

  9. ferrufino commented on Apr 27, 2025

    @ferrufino

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

  10. toastloaf commented on Apr 29, 2025

    @toastloaf

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

  11. liviuios commented on May 6, 2025

    @liviuios

    same here. not writing anything on macOS with gpt 4.1

  12. hadoopjax commented on May 6, 2025

    @hadoopjax

    same issue

  13. kohl00 commented on May 13, 2025

    @kohl00

    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
  14. sernote commented on May 14, 2025

    @sernote

    same with 4.1

  15. fouad-openai commented on May 15, 2025

    @fouad-openai
    ContributorAuthor

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

  16. kohl00 commented on May 15, 2025

    @kohl00

    thanks @fouad-openai !

  17. ferrufino commented on May 15, 2025

    @ferrufino

    Thanks again @fouad-openai, fast delivery 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions