diff --git a/src/executor.ts b/src/executor.ts index 46f32bb..35a618b 100644 --- a/src/executor.ts +++ b/src/executor.ts @@ -877,7 +877,15 @@ async function executeTask( const reviewInfo = baseRef ? getCommitRangeDiff(worktreeDir, baseRef) : null; - if (!reviewInfo || !reviewInfo.diff) break; // nothing to review + if (!reviewInfo || !reviewInfo.diff) { + const reason = !baseRef + ? "could not capture base ref before execution" + : "no changes found between base and HEAD"; + sendChatMessage?.( + `~ review for ${task.id} ยท ${task.title} โ€” skipping review (${reason})`, + ); + break; + } const reviewPrompt = buildReviewPrompt( task, diff --git a/src/utils.ts b/src/utils.ts index 794b468..bcf10cc 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -795,11 +795,12 @@ export function getLatestCommitDiff( encoding: "utf-8", }).trim(); - // Full diff of the latest commit: stat overview + patch + // Full diff of the latest commit: stat overview + patch. + // maxBuffer set high โ€” the prompt builder truncates to MAX_DIFF_BYTES. const diff = execSync("git show HEAD --stat --patch", { cwd: projectDir, encoding: "utf-8", - maxBuffer: 1024 * 1024, + maxBuffer: 10 * 1024 * 1024, }).trim(); return { hash, subject, diff }; @@ -868,10 +869,14 @@ export function getCommitRangeDiff( // Diff from baseRef to HEAD โ€” shows all committed changes made since // the snapshot. Includes stat overview + full patch. + // + // maxBuffer is set high (10 MB) so larger tasks don't cause execSync to + // throw. The review prompt builder truncates to MAX_DIFF_BYTES (50 KB) + // before sending to the model, so the full diff in memory is fine. const diff = execSync(`git diff ${baseRef} HEAD --stat --patch`, { cwd: projectDir, encoding: "utf-8", - maxBuffer: 1024 * 1024, + maxBuffer: 10 * 1024 * 1024, }).trim(); if (!diff) return null; // no changes since baseRef