@jojonax/codex-copilot 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/run.js +26 -15
- package/src/utils/github.js +14 -1
package/package.json
CHANGED
package/src/commands/run.js
CHANGED
|
@@ -317,21 +317,27 @@ async function reviewLoop(projectDir, task, prInfo, { maxRounds: _maxRounds, pol
|
|
|
317
317
|
|
|
318
318
|
log.info('Checking for review feedback...');
|
|
319
319
|
|
|
320
|
-
// Always proactively check for existing reviews first.
|
|
321
320
|
let gotReview = false;
|
|
322
|
-
const existingReviews = github.getReviews(projectDir, prInfo.number);
|
|
323
|
-
const existingComments = github.getIssueComments(projectDir, prInfo.number);
|
|
324
|
-
const hasReview = existingReviews.some(r => r.state !== 'PENDING');
|
|
325
|
-
const hasBotComment = existingComments.some(c =>
|
|
326
|
-
c.user?.type === 'Bot' || c.user?.login?.includes('bot')
|
|
327
|
-
);
|
|
328
321
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
322
|
+
// Round 1 (or resume): proactively check for existing reviews.
|
|
323
|
+
// After a fix push (round > 1): ONLY wait for NEW reviews
|
|
324
|
+
// to avoid re-processing the same stale feedback in a loop.
|
|
325
|
+
if (round <= 1 || round === startRound) {
|
|
326
|
+
const existingReviews = github.getReviews(projectDir, prInfo.number);
|
|
327
|
+
const existingComments = github.getIssueComments(projectDir, prInfo.number);
|
|
328
|
+
const hasReview = existingReviews.some(r => r.state !== 'PENDING');
|
|
329
|
+
const hasBotComment = existingComments.some(c =>
|
|
330
|
+
c.user?.type === 'Bot' || c.user?.login?.includes('bot')
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
if (hasReview || hasBotComment) {
|
|
334
|
+
log.info('Review found — processing immediately');
|
|
335
|
+
gotReview = true;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (!gotReview) {
|
|
340
|
+
log.info(`Waiting for ${round > 1 ? 'new ' : ''}review... (timeout: ${waitTimeout}s)`);
|
|
335
341
|
gotReview = await waitForReview(projectDir, prInfo.number, pollInterval, waitTimeout);
|
|
336
342
|
}
|
|
337
343
|
|
|
@@ -432,8 +438,13 @@ async function reviewLoop(projectDir, task, prInfo, { maxRounds: _maxRounds, pol
|
|
|
432
438
|
const skipCI = github.isPrivateRepo(projectDir) ? ' [skip ci]' : '';
|
|
433
439
|
git.commitAll(projectDir, `fix(task-${task.id}): address review comments (round ${round})${skipCI}`);
|
|
434
440
|
git.pushBranch(projectDir, task.branch);
|
|
435
|
-
log.info('Fix pushed
|
|
436
|
-
|
|
441
|
+
log.info('Fix pushed');
|
|
442
|
+
|
|
443
|
+
// Request bot to re-review the updated code
|
|
444
|
+
log.info('Requesting re-review...');
|
|
445
|
+
github.requestReReview(projectDir, prInfo.number);
|
|
446
|
+
|
|
447
|
+
// Wait for review bot to react
|
|
437
448
|
await sleep(15000);
|
|
438
449
|
} else {
|
|
439
450
|
// AI fix produced no code changes — it cannot resolve this issue
|
package/src/utils/github.js
CHANGED
|
@@ -305,10 +305,23 @@ export function isPrivateRepo(cwd) {
|
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
/**
|
|
309
|
+
* Request bots to re-review the PR by posting a /review comment.
|
|
310
|
+
* Triggers Gemini Code Assist and similar bots to run a fresh review.
|
|
311
|
+
*/
|
|
312
|
+
export function requestReReview(cwd, prNumber) {
|
|
313
|
+
try {
|
|
314
|
+
gh(`pr comment ${prNumber} --body "/review"`, cwd);
|
|
315
|
+
return true;
|
|
316
|
+
} catch {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
308
321
|
export const github = {
|
|
309
322
|
checkGhAuth, createPR, createPRWithRecovery, findExistingPR,
|
|
310
323
|
ensureRemoteBranch, hasCommitsBetween,
|
|
311
324
|
getReviews, getReviewComments, getIssueComments,
|
|
312
325
|
getLatestReviewState, mergePR, collectReviewFeedback,
|
|
313
|
-
isPrivateRepo,
|
|
326
|
+
isPrivateRepo, requestReReview,
|
|
314
327
|
};
|