# Improve distinguishing user from agent edits \(\#34716\) · gitcafe/zed

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

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

Visibility: public

Requested revision: c7158f0bd7ec3324fe299b4cf3e6b4e34a492436

Requested commit: c7158f0bd7ec3324fe299b4cf3e6b4e34a492436

Commit: c7158f0bd7ec3324fe299b4cf3e6b4e34a492436

Tree: eaaa07d05dbbd6f433fb0786b92290eede9f5952

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
Improve distinguishing user from agent edits (#34716)

We no longer rely on the `author` field to tell if a change was made by
the user or the agent. The `author` can be set to `User` in many
situations that are not really user-made edits, such as saving a file,
accepting a change, auto-formatting, and more. I started tracking and
fixing some of these cases, but found that inspecting changes in
`diff_base` is a more reliable method.

Also, we no longer show empty diffs. For example, if the user adds a
line and then removes the same line, the final diff is empty, even
though the buffer is marked as user-changed. Now we won't show such
edit.

There are still some issues to address:

- When a user edits within an unaccepted agent-written block, this
change becomes a part of the agent's edit. Rejecting this block will
lose user edits. It won't be displayed in project notifications, either.

- Accepting an agent block counts as a user-made edit.

- Agent start to call `project_notifications` tool after seeing enough
auto-calls.

Release Notes:

- N/A
```

## Parents

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

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