-
Notifications
You must be signed in to change notification settings - Fork 713
[Bug]: Cursor's apply_patch still fails on exact-match / mid-turn drift after #1017 #1388
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-infoWaiting on reporter for a concrete spec or reproductionWaiting on reporter for a concrete spec or reproductionproviderProvider adapters, OpenAI-compat presets, upstream API quirksProvider adapters, OpenAI-compat presets, upstream API quirksstaleNo activity on a needs-info issue; will close soon unless updatedNo activity on a needs-info issue; will close soon unless updatedupstream-trackingBlocked on an upstream (Codex CLI/Desktop) fix; kept open for discoverabilityBlocked on an upstream (Codex CLI/Desktop) fix; kept open for discoverability
Description
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-infoWaiting on reporter for a concrete spec or reproductionWaiting on reporter for a concrete spec or reproductionproviderProvider adapters, OpenAI-compat presets, upstream API quirksProvider adapters, OpenAI-compat presets, upstream API quirksstaleNo activity on a needs-info issue; will close soon unless updatedNo activity on a needs-info issue; will close soon unless updatedupstream-trackingBlocked on an upstream (Codex CLI/Desktop) fix; kept open for discoverabilityBlocked on an upstream (Codex CLI/Desktop) fix; kept open for discoverability
Client or integration
Codex App
Area
Provider adapter
Summary
After #1017 / #1144, Cursor
edit_file/multi_editconvert into valid Codexapply_patchpayloads. That grammar fix works.The remaining defect is different: converted patches still fail hard at Codex apply time with:
apply_patch verification failed: Failed to find expected lines in …Failed to find context '…'especially when the worktree drifts mid-turn, whitespace does not match exactly, or
old_stringis non-unique.Expected: once OpenCodex converts a structured edit into a valid patch, apply either succeeds or fails with actionable recovery diagnostics (nearest match / already-applied / refreshed
old_string), instead of opaque exact-match rejection and retry storms.nativeLocalExec: "on"does not bypass #1017 — writes still go through structured edit →apply_patch. Follow-up to closed #1017.Reproduction
2.11.1with the Cursor provider (nativeLocalExecon or off; both hit the same apply path for writes).cursor/grok-4.5.edit_file/multi_editwhile the target can change between read and apply (dirty tree / previous partial edit / concurrent change).*** Begin Patchpayload, then Codex reject it locally withFailed to find expected lines/Failed to find context.Minimal cases of the remaining gap (OpenCodex converter semantics + Codex-style exact matcher):
Failed to find expected linesold_string@@ -n,m +n,m @@Failed to find context@@only*** Begin Patchmulti_editsecond depends on firstRelevant code:
src/adapters/cursor/tool-definitions.tssrc/adapters/cursor/protobuf-events.ts(translateStructuredEditCall/replacementHunk)src/adapters/cursor/native-exec-fs.tssrc/adapters/cursor/exec-policy.tsVersion
2.11.1Operating system
NixOS 26.11 (
Linux x86_64)Provider and model
cursor / cursor/grok-4.5Logs or error output
Checks