fix: review skipped silently when task diff exceeds 1MB maxBuffer
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
This commit is contained in:
@@ -877,7 +877,15 @@ async function executeTask(
|
|||||||
const reviewInfo = baseRef
|
const reviewInfo = baseRef
|
||||||
? getCommitRangeDiff(worktreeDir, baseRef)
|
? getCommitRangeDiff(worktreeDir, baseRef)
|
||||||
: null;
|
: 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(
|
const reviewPrompt = buildReviewPrompt(
|
||||||
task,
|
task,
|
||||||
|
|||||||
11
src/utils.ts
11
src/utils.ts
@@ -795,11 +795,12 @@ export function getLatestCommitDiff(
|
|||||||
encoding: "utf-8",
|
encoding: "utf-8",
|
||||||
}).trim();
|
}).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", {
|
const diff = execSync("git show HEAD --stat --patch", {
|
||||||
cwd: projectDir,
|
cwd: projectDir,
|
||||||
encoding: "utf-8",
|
encoding: "utf-8",
|
||||||
maxBuffer: 1024 * 1024,
|
maxBuffer: 10 * 1024 * 1024,
|
||||||
}).trim();
|
}).trim();
|
||||||
|
|
||||||
return { hash, subject, diff };
|
return { hash, subject, diff };
|
||||||
@@ -868,10 +869,14 @@ export function getCommitRangeDiff(
|
|||||||
|
|
||||||
// Diff from baseRef to HEAD — shows all committed changes made since
|
// Diff from baseRef to HEAD — shows all committed changes made since
|
||||||
// the snapshot. Includes stat overview + full patch.
|
// 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`, {
|
const diff = execSync(`git diff ${baseRef} HEAD --stat --patch`, {
|
||||||
cwd: projectDir,
|
cwd: projectDir,
|
||||||
encoding: "utf-8",
|
encoding: "utf-8",
|
||||||
maxBuffer: 1024 * 1024,
|
maxBuffer: 10 * 1024 * 1024,
|
||||||
}).trim();
|
}).trim();
|
||||||
|
|
||||||
if (!diff) return null; // no changes since baseRef
|
if (!diff) return null; // no changes since baseRef
|
||||||
|
|||||||
Reference in New Issue
Block a user