Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

fix(agents): Compare a local-checkout task's changes against the current HEAD

l0ng-ai415ade72e7d4
diff --git a/crates/ide-agent/src/lib.rs b/crates/ide-agent/src/lib.rs
index e2b7fd467..f58cd5da8 100644
--- a/crates/ide-agent/src/lib.rs
+++ b/crates/ide-agent/src/lib.rs
@@ -577,7 +577,13 @@ impl Task {
fn cwd_and_base(&self) -> (PathBuf, String) {
let s = self.state.lock();
- (s.task.cwd.0.clone(), s.task.base_commit.clone().unwrap_or_else(|| "HEAD".into()))
+ // In the project's own checkout the user commits too: compare against the current HEAD,
+ // as the Commit tool window does, so commits made since the task started drop out.
+ let base = match s.task.isolation {
+ Isolation::Local => None,
+ Isolation::Worktree => s.task.base_commit.clone(),
+ };
+ (s.task.cwd.0.clone(), base.unwrap_or_else(|| "HEAD".into()))
}
fn emit_task(&self) {
diff --git a/crates/ide-agent/src/model.rs b/crates/ide-agent/src/model.rs
index 50276ca67..369882ee6 100644
--- a/crates/ide-agent/src/model.rs
+++ b/crates/ide-agent/src/model.rs
@@ -44,7 +44,7 @@ pub struct AgentTask {
pub branch: Option<String>,
/// Branch (or revision) the worktree was created from.
pub base: Option<String>,
- /// Commit the task's changes are compared against.
+ /// Commit the task's changes are compared against (worktree tasks; local ones use `HEAD`).
pub base_commit: Option<String>,
/// Why the task failed, when it did.
pub error: Option<String>,