Describe the bug
The diff information produced by apply_patch tool is incorrect. The patch diff shown to the user does not accurately reflect the changes being applied.
Current behavior
When apply_patch makes changes to files, the resulting diff displayed in the UI is wrong — it may show incorrect line numbers, wrong context, or missing changes.
Suggested approach
Instead of the current implementation, consider using git ghost commits to generate accurate diffs:
- Stage the current state
- Apply the patch
- Generate a diff between the committed state and the new state
- Optionally clean up the ghost commit
This guarantees the diff is always accurate since it uses git's built-in diff engine.
Where to look
crates/core/src/tools/apply_patch.rs — current apply_patch implementation
- The diff output at
crates/core/src/tools/apply_patch.rs:911 and the completion path at line 196
Related files
crates/core/src/tools/apply_patch.rs
Describe the bug
The diff information produced by
apply_patchtool is incorrect. The patch diff shown to the user does not accurately reflect the changes being applied.Current behavior
When
apply_patchmakes changes to files, the resulting diff displayed in the UI is wrong — it may show incorrect line numbers, wrong context, or missing changes.Suggested approach
Instead of the current implementation, consider using git ghost commits to generate accurate diffs:
This guarantees the diff is always accurate since it uses git's built-in diff engine.
Where to look
crates/core/src/tools/apply_patch.rs— current apply_patch implementationcrates/core/src/tools/apply_patch.rs:911and the completion path at line 196Related files
crates/core/src/tools/apply_patch.rs