Skip to content

action_log: Accept deleted hunks after commit#56892

Merged
bennetbo merged 1 commit into
mainfrom
fix-action-log-sometimes-not-accepting
May 15, 2026
Merged

action_log: Accept deleted hunks after commit#56892
bennetbo merged 1 commit into
mainfrom
fix-action-log-sometimes-not-accepting

Conversation

@bennetbo

Copy link
Copy Markdown
Member

Sometimes the action log would not auto-accept deleted hunks, and I finally found a repro for this, here's an explanation of what went wrong

// Before
use crate::{Alpha, Beta};

fn keep() {
    work();
}

fn remove() {
    work();
}

fn after() {
    work();
}
// After commit
use crate::{Alpha};

fn keep() {
    work();
}

fn after() {
    work();
}

The action log may track the deletion as:

 fn keep() {
     work();
 }

-fn remove() {
-    work();
-}
-
 fn after() {
     work();
 }

But the commit diff may choose different boundaries because nearby lines repeat:

 fn keep() {
     work();
-}
-
-fn remove() {
-    work();
 }

 fn after() {
     work();
 }

Both diffs produce the same final file, but their row ranges differ. The previous logic only accepted committed edits when those row ranges matched exactly, so already-committed edits could remain marked as unaccepted.

Now we have a fast path for checking if the base_text matches exactly, which works fine in this case.

Release Notes:

  • Fixed an issue where agent edits would sometimes not get auto-accepted when they were commited

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 15, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label May 15, 2026
@bennetbo bennetbo force-pushed the fix-action-log-sometimes-not-accepting branch from e93d66f to 68b7b5e Compare May 15, 2026 15:35
@bennetbo bennetbo requested a review from benbrandt May 15, 2026 15:37
@bennetbo bennetbo added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit 1fb9207 May 15, 2026
33 checks passed
@bennetbo bennetbo deleted the fix-action-log-sometimes-not-accepting branch May 15, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants