# agent: Do not fail if buffer has changed on disk \(\#55606\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/7de96710e227f3d1219c9fb7aed6123e88084084)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 7de96710e227f3d1219c9fb7aed6123e88084084

Requested commit: 7de96710e227f3d1219c9fb7aed6123e88084084

Commit: 7de96710e227f3d1219c9fb7aed6123e88084084

Tree: 56aec4fca898970f8021dae922bc1256c85a96b6

Author: Bennet Bo Fenner

Committer: GitHub

## Message

```
agent: Do not fail if buffer has changed on disk (#55606)

Previously, we would always return an error if the LLM attempted to edit
a file that had been modified on disk or by the user in the meantime.
However, this often led to unnecessary failures and slowdowns. So,
instead of failing every time, we now attempt to resolve a match. If we
don't find one, we return an error to inform the LLM that the file has
been modified since the last read.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- agent: Do not fail edit tool if file has unsaved changes
```

## Parents

- [038e2136fb983e497998b0465d729f0758531a29](https://git.cafe/gitcafe/zed/commit/038e2136fb983e497998b0465d729f0758531a29?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/7de96710e227f3d1219c9fb7aed6123e88084084?format=markdown)
