Skip to content

[Bug]: Cursor adapter consistently emits invalid Codex apply_patch payloads #1017

Description

@Vincent-HD

Environment

  • OpenCodex: 2.10.0
  • Provider: Cursor
  • Model: cursor/grok-4.5
  • Codex Desktop: 0.146.0
  • OS: Linux
  • Current config: nativeLocalExec is enabled
  • The same behavior was previously observed with nativeLocalExec disabled as well

Problem

When using cursor/grok-4.5 through OpenCodex with Codex Desktop, file edits repeatedly produce malformed Codex apply_patch calls.

Observed failures include:

  • Add-file lines missing the required + prefix
  • Invalid hunk/context formatting
  • Patch-like text that is not valid Codex freeform patch syntax

Codex then rejects the call locally with errors such as:

apply_patch verification failed: invalid hunk

The OpenCodex request itself completes with HTTP 200, so this does not look like a transport or filesystem failure. The failure appears to occur at the Cursor adapter/model tool-contract boundary.

Expected behavior

The Cursor adapter should either:

  1. preserve apply_patch as a native custom/freeform tool;
  2. expose a provider-compatible structured edit tool; or
  3. clearly report that this model/provider combination cannot reliably execute Codex apply_patch.

A model producing patch-like text that is rejected on every edit attempt makes the Cursor route effectively unusable for repository changes.

Related

I can provide a redacted session capture with the malformed tool arguments and local rejection results if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions