Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Create checkpoint before/after every edit operation (#36253)
Oleksiy Syvokon7671f34f88ae
diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rsindex 1d417efbbae..f3f10884830 100644--- a/crates/agent/src/thread.rs+++ b/crates/agent/src/thread.rs@@ -844,11 +844,17 @@ impl Thread {.await.unwrap_or(false);- if !equal {- this.update(cx, |this, cx| {- this.insert_checkpoint(pending_checkpoint, cx)- })?;- }+ this.update(cx, |this, cx| {+ this.pending_checkpoint = if equal {+ Some(pending_checkpoint)+ } else {+ this.insert_checkpoint(pending_checkpoint, cx);+ Some(ThreadCheckpoint {+ message_id: this.next_message_id,+ git_checkpoint: final_checkpoint,+ })+ }+ })?;Ok(())}