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
a5a116439eOleksiy Syvokon committed on 5/28/2025, 6:44:49 PM· committed by GitHubparent361ceee
1 file changedLine totals unavailable