next-issue 6.6.8 → 6.6.9
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 +12 -8
- package/dist/gate.mjs +32 -10
- package/dist/handover.mjs +12 -1
- package/dist/implement.mjs +1 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,10 +129,11 @@ the run handles one issue. For each issue:
|
|
|
129
129
|
reruns the failed jobs once with `gh run rerun <id> --failed`, records a
|
|
130
130
|
`main-checks.rerun` event, saves the rerun in the state file and waits
|
|
131
131
|
again once the runs restart. When the rerun cannot start, or the checks
|
|
132
|
-
fail again, the fixer gets their logs from the check budget, and its fix
|
|
133
|
-
the same way. When the fixer cannot fix them, its fix cannot land,
|
|
134
|
-
budget runs out, the harness reverts every
|
|
135
|
-
base branch, pushes the revert and hands the
|
|
132
|
+
fail again, the fixer gets their logs from the check budget, and its fix
|
|
133
|
+
lands the same way. When the fixer cannot fix them, its fix cannot land,
|
|
134
|
+
an error stops the fix, or the budget runs out, the harness reverts every
|
|
135
|
+
commit of the change on the base branch, pushes the revert and hands the
|
|
136
|
+
issue to a person. A revert
|
|
136
137
|
push that the remote refuses, for example because the base moved, makes
|
|
137
138
|
the revert again on the new base, three times at most. A resume
|
|
138
139
|
that stopped while the checks of a landed commit ran waits for them
|
|
@@ -189,9 +190,10 @@ and comments the reason on the issue, when:
|
|
|
189
190
|
branches go away with the `<n>` branch when the issue is done;
|
|
190
191
|
- the reviewer gives no verdict, or the checks do not finish in time;
|
|
191
192
|
- the push to the base branch fails three times;
|
|
192
|
-
- the checks on the base branch fail and the fixer cannot fix them,
|
|
193
|
-
do not finish in time. The base branch is then
|
|
194
|
-
no new issue and ends once the running issues
|
|
193
|
+
- the checks on the base branch fail and the fixer cannot fix them, an error
|
|
194
|
+
stops the fix, or they do not finish in time. The base branch is then
|
|
195
|
+
broken, so the run claims no new issue and ends once the running issues
|
|
196
|
+
end;
|
|
195
197
|
- an agent does not finish in `agentTimeoutMinutes`;
|
|
196
198
|
- the setup command fails, or does not finish in `setupTimeoutMinutes`;
|
|
197
199
|
- a step of the run fails with an error. A `gh` call that is safe to repeat,
|
|
@@ -452,7 +454,9 @@ the prompt asks them to keep only what still holds. The reviewer only reads it.
|
|
|
452
454
|
|
|
453
455
|
When the implementer makes no change, the hand-over comment holds its full
|
|
454
456
|
reply after the note, so its reasons and questions can be answered on the issue.
|
|
455
|
-
|
|
457
|
+
Every hand-over comment is cut to fit a GitHub comment, whatever the reason, so a
|
|
458
|
+
long reply or a long run error does not lose it. A cut comment ends with a line
|
|
459
|
+
that says so.
|
|
456
460
|
|
|
457
461
|
A hand-over marks the state file as handed over. To give the issue another try,
|
|
458
462
|
take the `status:needs-human` label off, or answer the hand-over. The next run
|
package/dist/gate.mjs
CHANGED
|
@@ -48,30 +48,52 @@ async function failedChecksFix(job, sha) {
|
|
|
48
48
|
const { repo, config, ports, base } = context;
|
|
49
49
|
const { round, limit } = budgetUse(job, 'ciFixes');
|
|
50
50
|
if (round >= limit) {
|
|
51
|
-
const reverted = await
|
|
51
|
+
const reverted = await revertOrReport(job);
|
|
52
52
|
return escalateAndFinish(job, `The checks on ${base} failed and the limit of ${limit} check fixes was reached.${reverted}`, 'check budget');
|
|
53
53
|
}
|
|
54
54
|
state.ciFixes += 1;
|
|
55
55
|
await writeState(repo, state);
|
|
56
|
-
|
|
56
|
+
let logs;
|
|
57
|
+
try {
|
|
58
|
+
logs = await ports.failedBaseLogs(repo, sha, config.logMaxChars);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
return escalateError(job, error, `The read of the failed checks on ${base} failed`, 'logs error');
|
|
62
|
+
}
|
|
57
63
|
log.event('main-checks.logs', { chars: logs.length });
|
|
58
64
|
let fix;
|
|
59
65
|
try {
|
|
60
66
|
fix = await fixRound(job, `The checks on ${base} failed after the change landed there.`, logs, [], 'checks');
|
|
61
67
|
}
|
|
62
68
|
catch (error) {
|
|
63
|
-
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
66
|
-
const reverted = await revert(job);
|
|
67
|
-
const detail = message(error);
|
|
68
|
-
const stop = detail.endsWith('.') ? '' : '.';
|
|
69
|
-
return escalateAndFinish(job, `The fixer for the failed checks on ${base} failed: ${detail}${stop}${reverted}`, 'fixer error');
|
|
69
|
+
return escalateError(job, error, `The fixer for the failed checks on ${base} failed`, 'fixer error');
|
|
70
70
|
}
|
|
71
71
|
if (!fix.committed) {
|
|
72
|
-
const reverted = await
|
|
72
|
+
const reverted = await revertOrReport(job);
|
|
73
73
|
return escalateCheckFix(job, fix.unrelated, `checks on ${base}`, reverted);
|
|
74
74
|
}
|
|
75
75
|
job.repairing = true;
|
|
76
76
|
return GATE_FIXED;
|
|
77
77
|
}
|
|
78
|
+
async function escalateError(job, error, note, reason) {
|
|
79
|
+
if (runStopped()) {
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
const reverted = await revertOrReport(job);
|
|
83
|
+
return escalateAndFinish(job, `${note}: ${sentence(message(error))}${reverted}`, reason);
|
|
84
|
+
}
|
|
85
|
+
async function revertOrReport(job) {
|
|
86
|
+
try {
|
|
87
|
+
return await revert(job);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (runStopped()) {
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
job.repairing = false;
|
|
94
|
+
return ` The revert of the change on ${job.context.base} failed: ${sentence(message(error))}`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function sentence(text) {
|
|
98
|
+
return text.endsWith('.') ? text : `${text}.`;
|
|
99
|
+
}
|
package/dist/handover.mjs
CHANGED
|
@@ -89,7 +89,18 @@ async function handOver(context, log, issue, state, reason) {
|
|
|
89
89
|
log.event('hand-over', { reason }, 'quiet');
|
|
90
90
|
await writeState(repo, { ...state, handedOver: true });
|
|
91
91
|
await setStatus(context, issue, config.labels.needsHuman);
|
|
92
|
-
await ports.commentOnIssue(repo, issue,
|
|
92
|
+
await ports.commentOnIssue(repo, issue, handOverComment(reason));
|
|
93
|
+
}
|
|
94
|
+
const COMMENT_LIMIT = 65536;
|
|
95
|
+
const CUT = '\n\nThe reason was too long for a GitHub comment and was cut.';
|
|
96
|
+
function handOverComment(reason) {
|
|
97
|
+
const comment = `${HAND_OVER} ${reason}`;
|
|
98
|
+
if (comment.length <= COMMENT_LIMIT) {
|
|
99
|
+
return comment;
|
|
100
|
+
}
|
|
101
|
+
const end = COMMENT_LIMIT - CUT.length;
|
|
102
|
+
const splitsPair = /[\uD800-\uDBFF]/.test(comment.charAt(end - 1));
|
|
103
|
+
return `${comment.slice(0, splitsPair ? end - 1 : end)}${CUT}`;
|
|
93
104
|
}
|
|
94
105
|
export async function claimedError(context, log, issue, state, error, started) {
|
|
95
106
|
const { reason } = logIssueError(log, error, started);
|
package/dist/implement.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { parseCommitSubject } from './agent-reply.mjs';
|
|
2
2
|
import { CODING } from './agents.mjs';
|
|
3
3
|
import { commitWork } from './fix.mjs';
|
|
4
|
-
import { HAND_OVER } from './hand-over-comments.mjs';
|
|
5
4
|
import { escalateAndFinish } from './handover.mjs';
|
|
6
5
|
import { fallbackTitle, ROUND_CONTINUE, runRole } from './job.mjs';
|
|
7
6
|
import { implementPrompt } from './prompts.mjs';
|
|
@@ -33,14 +32,10 @@ async function useEarlierCommit(job) {
|
|
|
33
32
|
return undefined;
|
|
34
33
|
}
|
|
35
34
|
const NO_CHANGE = 'The implementer produced no change.';
|
|
36
|
-
const COMMENT_LIMIT = 65536;
|
|
37
|
-
const CUT = '\n\nThe reply was too long for a GitHub comment and was cut.';
|
|
38
35
|
function noChangeNote(reply) {
|
|
39
36
|
const text = reply.trim();
|
|
40
37
|
if (text === '') {
|
|
41
38
|
return NO_CHANGE;
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
const room = COMMENT_LIMIT - HAND_OVER.length - 1;
|
|
45
|
-
return note.length > room ? `${note.slice(0, room - CUT.length)}${CUT}` : note;
|
|
40
|
+
return `${NO_CHANGE}\n\n${text}`;
|
|
46
41
|
}
|