Improve edit_files diff match failure errors
Description
Improves the error message returned to the agent when edit_files diff application fails because one or more search blocks cannot be matched. The response now includes all failed search blocks and expected line ranges when parsed. Each individual failure excerpt is capped to 1k bytes so the retry signal stays bounded without hiding additional failed hunks.
This also covers V4A hunks by recording the combined unmatched context/search block while keeping the additional failure details out of serialized telemetry payloads.
Context here: https://warpdev.slack.com/archives/C09769R5GBT/p1778528642584199?thread_ts=1778528430.538039&cid=C09769R5GBT.
Linked Issue
N/A
- [ ] The linked issue is labeled
ready-to-specorready-to-implement. - [ ] Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).
Testing
Quick walkthrough of what this looks like in practice: https://www.loom.com/share/d8cbf155bf884cbdb30019665dc40dce.
- [x]
cargo fmt - [x]
cargo test -p ai diff_validation - [x]
cargo test -p warp test_format_match_error - [x]
cargo clippy --workspace --all-targets --all-features --tests -- -D warnings - [ ] I have manually tested my changes locally with
./script/run
Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
Conversation: https://staging.warp.dev/conversation/93cc055d-2e87-4c89-a84c-a468c5b10c43
CHANGELOG-NONE
Co-Authored-By: Oz [email protected]
- #11841
👈 (View in Graphite) master
This stack of pull requests is managed by Graphite. Learn more about stacking.
@vkodithala
I'm starting a first review of this pull request.
You can view the conversation on Warp.
I completed the review and no human review was requested for this pull request.
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
@szgupta Took a look. Agree with this direction high-level, but is this in-scope for these changes? This seems like a longstanding proto-level issue, see here where ApplyFileDiffsResult::Error is defined as a plain string vs. enum. Would require changes on client, server, and protos that I'm very happy to get in, but would likely be best on an upstream PR. Wdyt?