next-issue 6.6.52 → 6.6.54
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/README.md +4 -1
- package/dist/review.mjs +31 -6
- package/dist/state.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,7 +96,10 @@ the run handles one issue. For each issue:
|
|
|
96
96
|
change that the reviewer left in the worktree, so no such change can reach a
|
|
97
97
|
later commit. When the reviewer left another branch or a detached `HEAD`
|
|
98
98
|
checked out, the harness checks out the issue branch again at its commit
|
|
99
|
-
from before the review.
|
|
99
|
+
from before the review. It does the same when the reviewer times out or
|
|
100
|
+
fails. The state file keeps that commit while the reviewer runs, so when
|
|
101
|
+
the run stops during the review, the resumed review first puts the issue
|
|
102
|
+
branch back at that commit, and the diff it reads holds no reviewer commit.
|
|
100
103
|
The first reviewer also gets the reply of the implementer, and raises a
|
|
101
104
|
finding when a behaviour change has no failing run of its test. A later
|
|
102
105
|
reviewer gets the reply of the last review fixer instead, who quotes the
|
package/dist/review.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { REVIEWING } from './agents.mjs';
|
|
2
|
+
import { runStopped } from './children.mjs';
|
|
2
3
|
import { budgetUse, spendBudget } from './budget.mjs';
|
|
4
|
+
import { message } from './errors.mjs';
|
|
3
5
|
import { fixRound } from './fix.mjs';
|
|
4
6
|
import { escalateAndFinish } from './handover.mjs';
|
|
5
7
|
import { ROUND_CONTINUE, runRole, setStatus } from './job.mjs';
|
|
@@ -55,6 +57,14 @@ function recordVerdict(job, verdict, open) {
|
|
|
55
57
|
async function runReviewer(job, earlier) {
|
|
56
58
|
const { context, issue, log, state, worktree, comments } = job;
|
|
57
59
|
const { config, ports } = context;
|
|
60
|
+
const before = state.reviewing ?? (await ports.revision(worktree));
|
|
61
|
+
if (state.reviewing === undefined) {
|
|
62
|
+
state.reviewing = before;
|
|
63
|
+
await writeState(context.repo, state);
|
|
64
|
+
}
|
|
65
|
+
if (await ports.discardChanges(worktree, before, job.branch)) {
|
|
66
|
+
log.event('review.clean', { round: state.reviewRounds }, 'quiet');
|
|
67
|
+
}
|
|
58
68
|
const full = await ports.diff(worktree, context.base, config.remote);
|
|
59
69
|
const patch = capDiff(full, config.diffMaxChars);
|
|
60
70
|
const fields = {
|
|
@@ -62,16 +72,31 @@ async function runReviewer(job, earlier) {
|
|
|
62
72
|
diffChars: full.length,
|
|
63
73
|
cut: full.length > config.diffMaxChars,
|
|
64
74
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
log.
|
|
75
|
+
let review;
|
|
76
|
+
try {
|
|
77
|
+
review = await log.step('review', fields, () => runRole(job, 'reviewer', reviewPrompt(issue, comments, patch, earlier, earlier.length === 0 ? state.implementerReply : state.fixerReply), REVIEWING));
|
|
68
78
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (!runStopped()) {
|
|
81
|
+
await undoReview(job, before).catch((cleanup) => {
|
|
82
|
+
log.event('review.discard.error', { error: message(cleanup) }, 'quiet');
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
if (!runStopped()) {
|
|
88
|
+
await undoReview(job, before);
|
|
72
89
|
}
|
|
73
90
|
return review.text;
|
|
74
91
|
}
|
|
92
|
+
async function undoReview(job, before) {
|
|
93
|
+
const { context, log, state, worktree } = job;
|
|
94
|
+
if (await context.ports.discardChanges(worktree, before, job.branch)) {
|
|
95
|
+
log.event('review.discard', { round: state.reviewRounds }, 'quiet');
|
|
96
|
+
}
|
|
97
|
+
state.reviewing = undefined;
|
|
98
|
+
await writeState(context.repo, state);
|
|
99
|
+
}
|
|
75
100
|
async function unfixedRound(job, fix) {
|
|
76
101
|
const { context, issue, state } = job;
|
|
77
102
|
const { repo, ports } = context;
|
package/dist/state.mjs
CHANGED
|
@@ -60,6 +60,7 @@ function isState(value) {
|
|
|
60
60
|
isOptional(value.pushing, 'string') &&
|
|
61
61
|
isOptional(value.reverting, 'string') &&
|
|
62
62
|
isOptional(value.rerun, 'string') &&
|
|
63
|
+
isOptional(value.reviewing, 'string') &&
|
|
63
64
|
typeof value.reviewRounds === 'number' &&
|
|
64
65
|
Array.isArray(value.reviewLog) &&
|
|
65
66
|
value.reviewLog.every(isReviewRound) &&
|