Skip to content

Fix race condition in update_last_checkpoint#44801

Merged
nathansobo merged 1 commit intomainfrom
fix-update-last-checkpoint-race
Dec 20, 2025
Merged

Fix race condition in update_last_checkpoint#44801
nathansobo merged 1 commit intomainfrom
fix-update-last-checkpoint-race

Conversation

@nathansobo
Copy link
Contributor

@nathansobo nathansobo commented Dec 14, 2025

Release Notes:

  • Fixed spurious "no checkpoint" error in agent panel

Summary

update_last_checkpoint would call last_user_message() twice - once at the start to capture the checkpoint, and again in an async closure after the checkpoint comparison completed. If a new user message without a checkpoint was added between these two calls, the second call would find the new message and fail with "no checkpoint".

Fix

Capture the user message ID at the start and use user_message_mut(&id) in the async closure to find the specific message.

cc @mikayla-maki

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 14, 2025
update_last_checkpoint would call last_user_message() twice - once at the
start to capture the checkpoint, and again in an async closure after the
checkpoint comparison completed. If a new user message without a checkpoint
was added between these two calls, the second call would find the new message
and fail with 'no checkpoint'.

Fix by capturing the user message's ID at the start and using
user_message_mut(&id) in the async closure to find the specific message.
@nathansobo nathansobo force-pushed the fix-update-last-checkpoint-race branch from f146f02 to a98f402 Compare December 14, 2025 08:40
@MrSubidubi MrSubidubi changed the title Fix race condition in update_last_checkpoint Fix race condition in update_last_checkpoint Dec 15, 2025
@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Dec 19, 2025
@nathansobo nathansobo merged commit 32621dc into main Dec 20, 2025
43 of 45 checks passed
@nathansobo nathansobo deleted the fix-update-last-checkpoint-race branch December 20, 2025 17:43
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
Release Notes:

- Fixed spurious "no checkpoint" error in agent panel

---

## Summary

`update_last_checkpoint` would call `last_user_message()` twice - once
at the start to capture the checkpoint, and again in an async closure
after the checkpoint comparison completed. If a new user message without
a checkpoint was added between these two calls, the second call would
find the new message and fail with "no checkpoint".

## Fix

Capture the user message ID at the start and use `user_message_mut(&id)`
in the async closure to find the specific message.

cc @mikayla-maki
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Release Notes:

- Fixed spurious "no checkpoint" error in agent panel

---

## Summary

`update_last_checkpoint` would call `last_user_message()` twice - once
at the start to capture the checkpoint, and again in an async closure
after the checkpoint comparison completed. If a new user message without
a checkpoint was added between these two calls, the second call would
find the new message and fail with "no checkpoint".

## Fix

Capture the user message ID at the start and use `user_message_mut(&id)`
in the async closure to find the specific message.

cc @mikayla-maki
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Release Notes:

- Fixed spurious "no checkpoint" error in agent panel

---

## Summary

`update_last_checkpoint` would call `last_user_message()` twice - once
at the start to capture the checkpoint, and again in an async closure
after the checkpoint comparison completed. If a new user message without
a checkpoint was added between these two calls, the second call would
find the new message and fail with "no checkpoint".

## Fix

Capture the user message ID at the start and use `user_message_mut(&id)`
in the async closure to find the specific message.

cc @mikayla-maki
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
Release Notes:

- Fixed spurious "no checkpoint" error in agent panel

---

## Summary

`update_last_checkpoint` would call `last_user_message()` twice - once
at the start to capture the checkpoint, and again in an async closure
after the checkpoint comparison completed. If a new user message without
a checkpoint was added between these two calls, the second call would
find the new message and fail with "no checkpoint".

## Fix

Capture the user message ID at the start and use `user_message_mut(&id)`
in the async closure to find the specific message.

cc @mikayla-maki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants