fix(dashboard): prevent foreign-branch diffs after worktree pool reuse

When the worktree-recycle pool reassigned a path to a new task, the old
task's diff endpoints kept reading the new task's branch state — surfacing
unrelated commits as the original task's "files changed" list.

- Clear task.worktree/branch in the merger after the worktree is released
  to the pool or removed, so the path no longer points anywhere.
- Validate the worktree's current branch matches task.branch in the three
  worktree-backed diff endpoints; on mismatch return empty rather than
  diffing against a foreign branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fusion
2026-04-27 11:04:42 -07:00
committed by gsxdsm
parent 9650019877
commit 399c7048cb
3 changed files with 153 additions and 151 deletions

View File

@@ -1046,9 +1046,10 @@ export function TerminalModal({ isOpen, onClose, initialCommand, projectId }: Te
}
};
// Determine loading state — when bootstrapError or xtermInitError is set, we are NOT loading
// (we have a definitive error to show instead of an indefinite spinner).
const isLoading = !isReady || (!activeTab && !bootstrapError) || (!xtermReady && !xtermInitError);
// Determine loading state for session bootstrap only.
// Once a tab exists we keep the xterm container visible while UI init runs,
// avoiding a retry-loop spinner flash after bootstrap recovery.
const isLoading = !isReady || (!activeTab && !bootstrapError);
return (
<div