fix: tighten auto review checkpoints

This commit is contained in:
Eyejoker
2026-03-29 03:58:14 +09:00
parent d460933229
commit 03ff69fdd0
3 changed files with 542 additions and 0 deletions

View File

@@ -197,6 +197,14 @@ function listAllowedUntrackedFiles(sourceDir: string): string[] {
]).filter(shouldIncludeUntrackedReviewerPath);
}
function listReviewableTrackedDiffFiles(
sourceDir: string,
sourceRef: string,
): string[] {
return listGitPaths(sourceDir, ['diff', '--name-only', '-z', sourceRef, '--'])
.filter((relativePath) => !isReviewerSnapshotDeniedPath(relativePath));
}
function copySnapshotPaths(
sourceDir: string,
targetDir: string,
@@ -347,6 +355,25 @@ export function resolvePairedTaskSourceFingerprint(taskId: string): string | nul
});
}
export function hasReviewableOwnerWorkspaceChanges(taskId: string): boolean {
const { task } = getTaskAndProject(taskId);
const ownerWorkspace = getPairedWorkspace(taskId, 'owner');
if (!ownerWorkspace) {
return false;
}
ensureGitRepository(ownerWorkspace.workspace_dir);
const reviewableTrackedDiffs = listReviewableTrackedDiffFiles(
ownerWorkspace.workspace_dir,
task.source_ref || 'HEAD',
);
if (reviewableTrackedDiffs.length > 0) {
return true;
}
return listAllowedUntrackedFiles(ownerWorkspace.workspace_dir).length > 0;
}
export function provisionOwnerWorkspaceForPairedTask(
taskId: string,
): PairedWorkspace {