From 6dcbd064a698f1ae5e1cc5b25172041d1d5939f0 Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Wed, 22 Jul 2026 21:53:29 -0400 Subject: [PATCH] fix: review skipped silently when task diff exceeds 1MB maxBuffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getCommitRangeDiff and getLatestCommitDiff had maxBuffer set to 1MB. When a task produced a larger diff (common for 10+ minute tasks), execSync threw, the catch block returned null, and the review loop broke immediately with no message — reviews were silently skipped for larger tasks while smaller tasks reviewed fine. - Increase maxBuffer to 10MB in both functions (the review prompt builder already truncates to MAX_DIFF_BYTES = 50KB before sending to the model, so the full diff in memory is fine) - Add a diagnostic sendChatMessage when the review loop is skipped (baseRef undefined or no diff), so silent skips are visible --- src/executor.ts | 10 +++++++++- src/utils.ts | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) 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