Skip to content

Failed to apply patch consantly #12241

Open

Description

@miniq15

What version of the Codex App are you using (From “About Codex” dialog)?

104

What subscription do you have?

200$

What platform is your computer?

Linux 6.17.0-14-generic x86_64 unknown ubuntu

What issue are you seeing?

codex hits failed to patch CONSTANTLY, even so on version 102 it was Never,. I litereally have never seen it.

I’m moving to implementation now: adding a dedicated live open_search extractor that targets the 5 requested sections and writes a readable HTML
document report. I’ll also include downloaded filename/extension in extraction metadata so the report can show which document format was parsed.

Search text_extraction|open_search|downloaded_filename|text_source|_extract_opened_document_text in tests

• Edited mcp_tools/e_court/src/tool_tree.py (+2 -0)
4119 filename = f"document_{index}"
4120 + meta["downloaded_filename"] = filename
4121 + meta["downloaded_extension"] = Path(filename).suffix.lower()
4122

✘ Failed to apply patch
└ execution error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

• I’m making a small metadata patch in tool_tree so each extracted document includes filename/extension in the report. Then I’ll add the dedicated 5-
document HTML runner.

• Edited mcp_tools/e_court/src/tool_tree.py (+2 -0)
4119 filename = f"document_{index}"
4120 + meta["downloaded_filename"] = filename
4121 + meta["downloaded_extension"] = Path(filename).suffix.lower()
4122

✘ Failed to apply patch
└ execution error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

• Ran pwd && ls -la mcp_tools/e_court/src/tool_tree.py
└ /home/william3/Desktop/projects/site-deepresrach/deepresearch
-rw-rw-r-- 1 william3 william3 237101 Feb 19 16:45 mcp_tools/e_court/src/tool_tree.py

• Edited mcp_tools/e_court/src/tool_tree.py (+2 -0)
4119 filename = f"document_{index}"
4120 + meta["downloaded_filename"] = filename
4121 + meta["downloaded_extension"] = Path(filename).suffix.lower()
4122

✘ Failed to apply patch
│ tool_tree.py
└ (no output)

• Explored
└ Search downloaded_filename|downloaded_extension in tool_tree.py
Read tool_tree.py

What steps can reproduce the bug?

I use 5.3 xhigh, 104 version of cli codex.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    app
    on Feb 19, 2026
  2. added
    bug
    CLI
    tool-calls
    on Feb 19, 2026
  3. github-actions commented on Feb 19, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. removed
    app
    on Feb 19, 2026
  5. miniq15 commented on Feb 19, 2026

    @miniq15
    Author

    mention my thread ID 019c76a9-3e43-7881-b5c1-81d2ec9ca869 in an existing issue.

  6. miniq15 commented on Feb 19, 2026

    @miniq15
    Author

    Update: downgraded to 0.103, it works again !!

  7. etraut-openai commented on Feb 25, 2026

    @etraut-openai
    Contributor

    We haven't heard of this issue from any other users, so there must be something specific about your system or configuration that's causing it.

    Do you have any non-default configuration settings in your config.toml file?

    I reviewed your log file. You said that you were having problems when running 0.104.0, but the log file contained logs for 0.103.0.

  8. StevenShen3641 commented on Feb 27, 2026

    @StevenShen3641

    Same issues here after upgrading to 0.105.0

  9. etraut-openai commented on Feb 27, 2026

    @etraut-openai
    Contributor

    @StevenShen3641, please use /feedback to upload your logs and session details and post the thread ID here. Without this information, we don't have enough information to investigate further.

  10. StevenShen3641 commented on Feb 27, 2026

    @StevenShen3641

    @StevenShen3641, please use /feedback to upload your logs and session details and post the thread ID here. Without this information, we don't have enough information to investigate further.

    Hi,

    Thanks for the reply!

    The error conversation using codex v0.105.0: 019c9dec-8979-7e60-aca7-beb012173479

    The compared conversation using codex v0.81.0 with the same user prompt: 019c9e6f-bfcc-76d1-96eb-b2bed13fe49d

    FYI, I am using gpt-5 with codex to do some evaluation. But similar behavior also happens on 5.1-codex and 5.2-codex, which I believe is a bug introduced in some latest version. This phenomena appears for almost half of our evaluations.

    The bug seems to be the model keeps using terminal command "applypatch" and fails, and finally, it create some python files under /tmp to apply the patch.

    This leads to two consequences:

    1. the model does not use the agent provided tools such as apply_patch and other file edit tools, which will not emit item that represents a file edit happening (or proposed) during a turn. It would be hard for developer to find which file is modified by the model, but not by other stuff (e.g., file change during compilation);
    2. the model keeps failing apply the patch. See items 24 to 41. This leads to unnecessarily extensive token consumption. While this conversation cost 1.51 dollars in total, the same user-prompt using codex v0.81.0 only cost 0.26 dollars.

    A possible reason could be: At the start of the conversation, codex failed to feed in the system prompt which contains codex built-in tools.

  11. jif-oai commented on Feb 28, 2026

    @jif-oai
    Contributor

    Checking

  12. self-assigned this
    on Feb 28, 2026
  13. jif-oai commented on Feb 28, 2026

    @jif-oai
    Contributor

    @miniq15 on 019c76a9-3e43-7881-b5c1-81d2ec9ca869 I can see some successful apply_patch and I don't see the errors you mention

    @StevenShen3641 we disabled apply_patch for gpt-5 in December because the model was not trained on it

  14. StevenShen3641 commented on Feb 28, 2026

    @StevenShen3641

    @miniq15 on 019c76a9-3e43-7881-b5c1-81d2ec9ca869 I can see some successful apply_patch and I don't see the errors you mention

    @StevenShen3641 we disabled apply_patch for gpt-5 in December because the model was not trained on it

    Hi,

    Thanks for the reply! This is weird, since for later version such as 0.93.0 in Jan, the model can apply the patch successfully for almost all conversations. And in some of the conversations in 0.105.0, the model could apply the patch using built-in tools as well. Is it disabled on Codex side?

  15. jif-oai commented on Mar 6, 2026

    @jif-oai
    Contributor

    @StevenShen3641 the model does not see the tool but it can still "remember" how to use it based on his training

  16. hackermirror commented on Mar 22, 2026

    @hackermirror

    @StevenShen3641, please use /feedback to upload your logs and session details and post the thread ID here. Without this information, we don't have enough information to investigate further.

    019d1648-017b-70f1-958c-22161c073aa8

  17. veilm commented on Apr 15, 2026

    @veilm

    I was seeing this consistently today with gpt-5.4 high. I don't have a /feedback for reference because the codebase is sensitive, but anecdotally I think it may have started, in my previously open codex instance, around the time I upgraded codex through npm in a new terminal.

    Closing that failing codex instance and using codex resume to start it again, seemed to fix it; I didn't see any ✘ Failed to apply patch after that

  18. miniq15 commented on Apr 21, 2026

    @miniq15
    Author

    i know the issue.
    it is because you can have a session THEN if you leave it , update code to newer version then you come back to the session you will have 100% of failed to apply patch.

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

Metadata

Metadata

Assignees

Labels

CLIbugtool-calls

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions