# acp_thread: Log error when checkpoint comparison fails \(\#59196\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 05530c9b354d487bda520a3c74bb02e90988b2fd

Requested commit: 05530c9b354d487bda520a3c74bb02e90988b2fd

Commit: 05530c9b354d487bda520a3c74bb02e90988b2fd

Tree: 5ad16160ca82dd9077bff08925a05d316f87bb41

Author: Patryk

Committer: GitHub

## Message

```
acp_thread: Log error when checkpoint comparison fails (#59196)

`update_last_checkpoint` swallows `compare_checkpoints` errors with
`.unwrap_or(true)`. The "Restore checkpoint" button silently disappears
and nothing gets logged, which is what made the linked issue painful to
track down in the first place.

The sibling `update_last_checkpoint_if_changed` a few lines up already
handles the same call with `.context(...).log_err()` and an early
return, so I did the same here. On error the checkpoint's visibility is
left alone instead of being forced to hidden. I didn't propagate the
error because the task result gets `?`'d in `run_turn`'s cleanup, and
failing there would leave the panel stuck in its generating state.

Added a regression test that breaks the comparison mid-turn (recreating
`.git` makes the fake repo forget its checkpoints) and asserts an
already-visible checkpoint stays visible. It fails on main and passes
with this change. The new log line shows up when it runs: `failed to
compare checkpoints: invalid left checkpoint: ...`

Closes #59100

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:

- Fixed checkpoint comparison errors silently hiding the "Restore
Checkpoint" button in the agent panel.

Co-authored-by: pstemporowski <110726755+pstemporowski@users.noreply.github.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
```

## Parents

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

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