finished better review prep (better execution capture of git)

This commit is contained in:
2026-08-09 15:23:01 -04:00
parent c29fdd750a
commit d31fca3cb3
2 changed files with 19 additions and 7 deletions

View File

@@ -19,10 +19,7 @@ import {
buildConflictResolutionPrompt,
MAX_DIFF_BYTES,
} from "./prompts";
import {
compileIgnorePatterns,
type DiffOptions,
} from "./diff";
import { compileIgnorePatterns } from "./diff";
import { extractReflection } from "./reflection";
import {
extractReview,
@@ -49,6 +46,7 @@ import {
ensureDir,
captureGitCommits,
captureGitHead,
canComputeRange,
getCommitRangeDiff,
hasUncommittedChanges,
getGitStatusPorcelain,
@@ -918,6 +916,15 @@ async function executeTask(
);
break;
}
// Cheap guard mirroring canCompareToBase: if the captured base ref no
// longer resolves (stale/broken worktree ref), warn explicitly and
// never treat the task as review-verified.
if (!canComputeRange(worktreeDir, baseRef)) {
sendChatMessage?.(
`~ review for ${task.id} · ${task.title} — diff could not be computed (base ref ${baseRef} no longer resolves)`,
);
break;
}
const rangeDiff = getCommitRangeDiff(worktreeDir, baseRef);
if (rangeDiff.kind === "error") {
sendChatMessage?.(