# agent: Rejecting agent changes shouldn't discard user edits \(\#31617\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a5a116439e711772190b7fb8e5507eb5dbd95237

Requested commit: a5a116439e711772190b7fb8e5507eb5dbd95237

Commit: a5a116439e711772190b7fb8e5507eb5dbd95237

Tree: 52a704457e2555b7d52af989717a7be3d476c691

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
agent: Rejecting agent changes shouldn't discard user edits (#31617)

The fix prevents data loss, but it also results in a somewhat confusing
UX. Specifically, after the user has made changes to an AI-created file,
selecting "Reject" will leave AI changes in place.

This is because there's no trivial way to disentangle user edits from
the edits made by the AI.

A better solution might exist. In the meantime, this change should do.
    
Closes
* #30527 

Release Notes:

- Prevent data loss when reverting changes in an agent-created file
```

## Parents

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

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