Skip to content

[Regression] gpt-oss no longer has access to apply_patch #11940

Open

Description

@Mushoz

What version of Codex CLI is running?

0.101.0

What subscription do you have?

Business

Which model were you using?

gpt-oss-120b

What platform is your computer?

Archlinux

What terminal emulator and version are you using (if applicable)?

Gnome Console

What issue are you seeing?

In the following commit: a1abd53

The code to add the apply_patch tool when using gpt-oss was removed:

} else if slug.starts_with("gpt-oss") || slug.starts_with("openai/gpt-oss") {
        model_info!(
            slug,
            apply_patch_tool_type: Some(ApplyPatchToolType::Function),
            context_window: Some(96_000),
        )

This leaves the gpt-oss models without any tool to edit, making them close to useless.

What steps can reproduce the bug?

  1. Start Codex with gpt-oss
  2. Ask the model to edit a random file

What is the expected behavior?

  1. The model will use apply_patch to apply edits

Actual outcome:

  1. The model will try to use workarounds, such as editing with sed

Additional information

Either the behavior before this commit must be reintroduced, but a cleaner fix would probably be to make this configurable, as hardcoded values for gpt-oss models is a lot less maintainable. Right now, we can actually already do the following in the configuration .toml:

[features]
apply_patch_freeform = true

Which will give the model access to the freeform version of apply_patch. Since gpt-oss expects the json version, this does not work (well). Ideally a new configuration option is introduced to give a model access to the json/function version of apply_patch.

Note: I am more than happy to write a PR to introduce such a configuration option. Kindly let me know if such a approach would be accepted, since I'd hate for me to write a pull request only for it to be rejected. If a different approach is preferred, kindly let me know and I will try to implement such an alternatively approach in a PR.

Activity

  1. added
    bug
    on Feb 16, 2026
  2. added
    CLI
    tool-calls
    on Feb 16, 2026
  3. added
    agent
    custom-model
    and removed
    CLI
    on Feb 16, 2026
  4. vt-alt commented on Feb 21, 2026

    @vt-alt

    The regression is still present in 0.104.0.

  5. vsrinivas commented on Feb 27, 2026

    @vsrinivas

    models.json now has slugs for gpt-oss-20b / gpt-oss-120b -- can we just change apply_patch_tool_type -> 'function' there?

  6. Mushoz commented on Feb 27, 2026

    @Mushoz
    Author

    models.json now has slugs for gpt-oss-20b / gpt-oss-120b -- can we just change apply_patch_tool_type -> 'function' there?

    While that would solve the issue at hand for the gpt-oss models, I'd rather see a more generic solution which allows us to define the apply_patch_tool_type in each of our profiles. That way, we can also use different, non-gpt-oss models. Furthermore, slug parsing can be brittle. I am not sure exactly how the slug matching is done, but if it's checking if the model string starts with gpt-oss that will not match models/aliases such as high-gpt-oss-120b or medium-gpt-oss-120b where the same model is loaded with different reasoning effort settings.

  7. coder543 commented on May 27, 2026

    @coder543

    Well, the function-style tool is now gone entirely, and gpt-oss defaults to not having a patch tool at all now: #21651

    Which is quite a sad demonstration of support for gpt-oss.

  8. 66Ton99 commented on Jul 4, 2026

    @66Ton99

    Confirm with Codex CLI 0.142.3

  9. iqdoctor commented on Jul 9, 2026

    @iqdoctor

    +!

  10. TheMiNuS commented on Aug 30, 2026

    @TheMiNuS

    if it can help some of you i did a patch for my LocalAI/Qwen that was suffering of the same problem. You can find it here : https://github.com/TheMiNuS/codex-localai-qwen

    It exposes apply_patch as a JSON Function tool when the Qwen model entry select it.

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

    agentbugcustom-modeltool-calls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions