Skip to content

fix: add ApplyPatch support to Cursor preset#1426

Open
svarlamov wants to merge 1 commit into
mainfrom
fix/1421-1779475825
Open

fix: add ApplyPatch support to Cursor preset#1426
svarlamov wants to merge 1 commit into
mainfrom
fix/1421-1779475825

Conversation

@svarlamov
Copy link
Copy Markdown
Member

@svarlamov svarlamov commented May 22, 2026

Summary

Fixes #1421

  • Adds "ApplyPatch" to the Cursor tool classifier so it's treated as ToolClass::FileEdit instead of being skipped
  • Extracts file paths from patch text (*** Update File:, *** Add File:, *** Delete File:, *** Move to:) — the same format already supported by Droid, Codex, OpenCode, and GitHub Copilot presets
  • Resolves relative paths against workspace root, consistent with other Cursor file-edit tools

Test plan

  • Unit test: test_cursor_apply_patch_pre_file_edit — preToolUse with patch containing *** Update File: produces PreFileEdit with correct path
  • Unit test: test_cursor_apply_patch_post_file_edit — postToolUse with patch containing multiple file directives extracts all paths
  • Unit test: test_cursor_apply_patch_with_absolute_path_in_patch — absolute paths in patch text are handled correctly
  • Unit test: test_tool_classification_all_agents — classifier correctly maps ApplyPatch to FileEdit for Cursor
  • Full test suite passes

🤖 Generated with Claude Code


Open in Devin Review

Cursor can emit `tool_name: "ApplyPatch"` for file edits that use the
patch format (common with OpenAI/Codex models). Previously these were
classified as ToolClass::Skip, leaving edited lines unattributed.

Add "ApplyPatch" to the Cursor file-edit whitelist and extract file
paths from patch text using the same `*** Update File:` / `*** Add File:`
conventions used by Droid, Codex, and GitHub Copilot presets.

Fixes #1421

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@peckfly
Copy link
Copy Markdown
Contributor

peckfly commented May 26, 2026

Can this PR be merged now?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cursor preset may skip ApplyPatch file edits, causing unknown attribution,

2 participants