From 415ade72e7d45f645a63269d73b1ce98f3f0be18 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Wed, 28 Oct 2026 10:54:41 +0800 Subject: [PATCH] fix(agents): Compare a local-checkout task's changes against the current HEAD Commits made in the project while a local task runs no longer show up in its Changes pane, and Refresh lists what is actually uncommitted. --- crates/ide-agent/src/lib.rs | 8 +++++++- crates/ide-agent/src/model.rs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/ide-agent/src/lib.rs b/crates/ide-agent/src/lib.rs index e2b7fd46..f58cd5da 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 50276ca6..369882ee 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, /// Branch (or revision) the worktree was created from. pub base: Option, - /// 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, /// Why the task failed, when it did. pub error: Option,