next-issue 6.6.99 → 6.6.101
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 +50 -21
- package/dist/base-checks.mjs +24 -9
- package/dist/gate.mjs +26 -12
- package/dist/handover.mjs +4 -0
- package/dist/land.mjs +52 -13
- package/dist/state.mjs +2 -1
- package/dist/unsettled.mjs +7 -1
- package/dist/worktree-setup.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -151,12 +151,14 @@ the run handles one issue. For each issue:
|
|
|
151
151
|
fetch fails too, the harness hands the issue to a person with the reason
|
|
152
152
|
`push unknown` and halts, even when the hand-over fails. The state file
|
|
153
153
|
holds the commit during the push, so a run stopped meanwhile, or the
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
resume after that hand-over (once a person answers or takes the label
|
|
155
|
+
off), checks the base and waits for the checks of the commit when it
|
|
156
|
+
landed. Until then, no run lands another change (see below). The
|
|
157
|
+
harness then waits for the checks of the pushed commit on the base
|
|
158
|
+
branch: the GitHub Actions workflow runs that a `push` of the base
|
|
159
|
+
branch started on it, its commit statuses and the check runs of every
|
|
160
|
+
other GitHub App, so checks from another CI service count too. It
|
|
161
|
+
leaves out the check runs of the GitHub Actions
|
|
160
162
|
app, since it judges GitHub Actions by its workflow runs. It leaves out
|
|
161
163
|
workflow runs that any other event (such as `issues`, `issue_comment` or
|
|
162
164
|
`schedule`) started, since GitHub gives such a run the tip of the
|
|
@@ -182,25 +184,33 @@ the run handles one issue. For each issue:
|
|
|
182
184
|
issue to a person with the reason `checks error` and halts, before the
|
|
183
185
|
next change lands. The comment holds the error and says that the landed
|
|
184
186
|
commit is on the base and its checks were not awaited. The state file
|
|
185
|
-
keeps the commit, so the
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
187
|
+
keeps the commit, so the resume after a person answers or takes the
|
|
188
|
+
label off waits for its checks, and until then no run lands another
|
|
189
|
+
change (see below). When the checks pass, the harness marks the state
|
|
190
|
+
file as closing, sets `status:done` and closes the issue. When a run
|
|
191
|
+
stops or dies before the close, the next run sees the mark, sets
|
|
192
|
+
`status:done` and closes the issue, with no new push, revert or
|
|
193
|
+
hand-over. When a run stops or dies after the close, before the state
|
|
194
|
+
file goes away, the next run finds the closed issue through its state
|
|
195
|
+
file and removes the worktree, the local branches and the state file,
|
|
196
|
+
with no new push, revert, label, close or hand-over. A label or close
|
|
197
|
+
that fails for another reason hands the issue over, and it then waits
|
|
198
|
+
for a person like any other hand-over. Then the harness fetches the
|
|
199
|
+
remote and fast-forwards the local base branch to the landed commit
|
|
200
|
+
when that is safe, and the worktree, the local branch and the state
|
|
201
|
+
file go away. A fetch that fails or a fast-forward that is
|
|
198
202
|
not safe leaves the local base branch as it is and writes a `base.behind`
|
|
199
203
|
event, and the issue is still done. When the checks fail, the harness
|
|
200
204
|
reruns the failed GitHub Actions jobs once with
|
|
201
205
|
`gh run rerun <id> --failed`, records a
|
|
202
206
|
`main-checks.rerun` event, saves the rerun in the state file and waits
|
|
203
|
-
again once the runs restart.
|
|
207
|
+
again once the runs restart. A rerun that GitHub refuses because the run
|
|
208
|
+
is already running counts as started. When at least one run restarted
|
|
209
|
+
and a later rerun or read fails, the event carries the error and the
|
|
210
|
+
harness still waits for the checks again, counting each restarted run as
|
|
211
|
+
running until a later attempt of it completes, so the fixer never runs
|
|
212
|
+
while a rerun is queued or in progress. When the rerun cannot start (no
|
|
213
|
+
run restarted, a `main-checks.rerun-failed` event), or the checks
|
|
204
214
|
fail again, the fixer gets their logs from the check budget (for a check
|
|
205
215
|
from another CI service, only its name and link), and its fix
|
|
206
216
|
lands the same way. When the fixer cannot fix them, its fix cannot land,
|
|
@@ -288,7 +298,9 @@ and comments the reason on the issue, when:
|
|
|
288
298
|
awaited;
|
|
289
299
|
- a step of the run fails with an error. A `gh` call that is safe to repeat,
|
|
290
300
|
such as a read or a label edit, is tried up to three times first when the
|
|
291
|
-
network fails.
|
|
301
|
+
network fails. So is a `gh run rerun`: when GitHub took the first try, it
|
|
302
|
+
refuses the next as already running, which counts as a started rerun. A
|
|
303
|
+
`gh issue comment` is
|
|
292
304
|
tried once, so a lost reply never makes a duplicate. On a resume whose
|
|
293
305
|
state holds a landed commit, or a push or revert that may have reached the
|
|
294
306
|
base, an error before the harness checks the base (for example a failed
|
|
@@ -302,6 +314,23 @@ broken base branch: it ends `stopped` with the reason `run halted` and keeps
|
|
|
302
314
|
its state, branch and labels. The next run resumes it and lands it with no new
|
|
303
315
|
review.
|
|
304
316
|
|
|
317
|
+
A halt that leaves a commit on the base, or a push or revert that may be on
|
|
318
|
+
it, with checks nobody awaited (`checks error`, `push unknown`,
|
|
319
|
+
`main checks timeout`, `main checks cancelled`, or an error or a failed setup
|
|
320
|
+
on such a resume before the base is checked) is saved in the state file of
|
|
321
|
+
its issue. The issue waits for a person, so later runs skip it, but no
|
|
322
|
+
later run lands another change meanwhile: an issue that reaches the
|
|
323
|
+
landing ends `stopped` with the reason `base unchecked`, keeps its state,
|
|
324
|
+
branch and labels, and halts that run too; the log holds a
|
|
325
|
+
`land.blocked` event with the waiting issues. Once a person answers or
|
|
326
|
+
takes the label off, the issue resumes, checks the base and waits for the
|
|
327
|
+
checks of its commit; when those are known (the issue is done, or its
|
|
328
|
+
commits are reverted or found not on the base), the next run lands the
|
|
329
|
+
held issues again. Such a resume is not held back
|
|
330
|
+
by another halted issue while it only checks its commit already on the
|
|
331
|
+
base; a fix it has to land waits like any other change. The hand-over
|
|
332
|
+
comment says so.
|
|
333
|
+
|
|
305
334
|
The fixer sees the findings of all earlier rounds, not only the last one, with
|
|
306
335
|
its own disputes next to them. From round two, the reviewer judges only the
|
|
307
336
|
earlier findings and any regression.
|
package/dist/base-checks.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
2
2
|
import { pollChecks } from './check-poll.mjs';
|
|
3
3
|
import { secondsToMs } from './durations.mjs';
|
|
4
|
+
import { errorMatches } from './errors.mjs';
|
|
4
5
|
import { gh, ghApi } from './gh.mjs';
|
|
5
6
|
import { runLogs } from './run-logs.mjs';
|
|
6
7
|
const RESTART_TRIES = 10;
|
|
8
|
+
const ALREADY_RUNNING = /already running/i;
|
|
7
9
|
const ACTIONS_APP = 'github-actions';
|
|
8
10
|
const FAILED_STATES = new Set(['failure', 'error']);
|
|
9
11
|
const AWAITS_APPROVAL = 'action_required';
|
|
@@ -39,12 +41,14 @@ async function externalChecks(repo, sha) {
|
|
|
39
41
|
}));
|
|
40
42
|
return [...checkRuns, ...commitStatuses];
|
|
41
43
|
}
|
|
42
|
-
async function baseChecks(repo, sha, branch) {
|
|
44
|
+
async function baseChecks(repo, sha, branch, restarted) {
|
|
43
45
|
const [runs, external] = await Promise.all([
|
|
44
46
|
baseRuns(repo, sha, branch),
|
|
45
47
|
externalChecks(repo, sha),
|
|
46
48
|
]);
|
|
47
|
-
|
|
49
|
+
// A rerun run counts as running until a later attempt of it completes, so its old failure never ends the wait.
|
|
50
|
+
const rerunning = restarted.some((entry) => !runs.some((run) => run.databaseId === entry.id && run.attempt > entry.attempt && run.status === 'completed'));
|
|
51
|
+
return { checks: [...runs.map((entry) => ({ ...entry, url: '' })), ...external], rerunning };
|
|
48
52
|
}
|
|
49
53
|
function failedRun(entry) {
|
|
50
54
|
return entry.status === 'completed' && FAILED_CONCLUSIONS.has(entry.conclusion);
|
|
@@ -58,27 +62,38 @@ function baseState(runs) {
|
|
|
58
62
|
}
|
|
59
63
|
return runs.some((entry) => entry.conclusion === 'cancelled') ? 'cancelled' : 'pass';
|
|
60
64
|
}
|
|
61
|
-
export function waitForBaseChecks(repo, sha, branch, options) {
|
|
62
|
-
let
|
|
65
|
+
export function waitForBaseChecks(repo, sha, branch, options, restarted = []) {
|
|
66
|
+
let read = { checks: [], rerunning: false };
|
|
63
67
|
return pollChecks({
|
|
64
68
|
head: async () => sha,
|
|
65
69
|
lags: async () => true,
|
|
66
70
|
list: async () => {
|
|
67
|
-
|
|
68
|
-
return checks.length === 0 ? 'none' : 'some';
|
|
71
|
+
read = await baseChecks(repo, sha, branch, restarted);
|
|
72
|
+
return read.checks.length === 0 && !read.rerunning ? 'none' : 'some';
|
|
69
73
|
},
|
|
70
|
-
watch: async () => baseState(checks),
|
|
74
|
+
watch: async () => (read.rerunning ? 'pending' : baseState(read.checks)),
|
|
71
75
|
}, options);
|
|
72
76
|
}
|
|
73
77
|
export async function rerunFailedBase(repo, sha, branch, started = () => { }) {
|
|
74
78
|
const failed = (await baseRuns(repo, sha, branch)).filter((entry) => failedRun(entry) && entry.conclusion !== AWAITS_APPROVAL);
|
|
75
79
|
for (const entry of failed) {
|
|
76
|
-
await
|
|
80
|
+
await rerun(repo, entry.databaseId);
|
|
81
|
+
started({ id: entry.databaseId, attempt: entry.attempt });
|
|
77
82
|
}
|
|
78
|
-
started();
|
|
79
83
|
await waitForRestart(repo, sha, branch, failed);
|
|
80
84
|
return failed.map((entry) => String(entry.databaseId));
|
|
81
85
|
}
|
|
86
|
+
async function rerun(repo, id) {
|
|
87
|
+
try {
|
|
88
|
+
await gh(repo, ['run', 'rerun', String(id), '--failed']);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
// A rerun repeated after a lost reply finds the run running again, so that answer means the rerun started.
|
|
92
|
+
if (!errorMatches(error, ALREADY_RUNNING)) {
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
82
97
|
async function waitForRestart(repo, sha, branch, failed) {
|
|
83
98
|
for (let attempt = 1; attempt <= RESTART_TRIES; attempt += 1) {
|
|
84
99
|
const runs = await baseRuns(repo, sha, branch);
|
package/dist/gate.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { escalateAndFinish } from './handover.mjs';
|
|
|
7
7
|
import { GATE_FIXED, GATE_PASSED } from './job.mjs';
|
|
8
8
|
import { revertOrReport, sentence } from './revert.mjs';
|
|
9
9
|
import { writeState } from './state.mjs';
|
|
10
|
+
import { HALT_NOTE } from './unsettled.mjs';
|
|
10
11
|
export async function checkGate(job, sha) {
|
|
11
12
|
const { base } = job.context;
|
|
12
13
|
let checks;
|
|
@@ -23,18 +24,22 @@ export async function checkGate(job, sha) {
|
|
|
23
24
|
return GATE_PASSED;
|
|
24
25
|
}
|
|
25
26
|
job.mainBroken = true;
|
|
27
|
+
if (checks !== 'fail') {
|
|
28
|
+
// Checks that never finished leave the base unknown, so later runs land nothing until a person resumes this issue.
|
|
29
|
+
job.state.halted = true;
|
|
30
|
+
}
|
|
26
31
|
if (checks === 'cancelled') {
|
|
27
|
-
return escalateAndFinish(job, `The checks on ${base} were cancelled before they finished
|
|
32
|
+
return escalateAndFinish(job, `The checks on ${base} were cancelled before they finished. ${HALT_NOTE}`, 'main checks cancelled');
|
|
28
33
|
}
|
|
29
34
|
if (checks !== 'fail') {
|
|
30
|
-
return escalateAndFinish(job, `The checks on ${base} did not finish in time
|
|
35
|
+
return escalateAndFinish(job, `The checks on ${base} did not finish in time. ${HALT_NOTE}`, 'main checks timeout');
|
|
31
36
|
}
|
|
32
37
|
return failedChecksFix(job, sha);
|
|
33
38
|
}
|
|
34
|
-
async function waitForChecks(job, sha, fields = {}) {
|
|
39
|
+
async function waitForChecks(job, sha, fields = {}, restarted = []) {
|
|
35
40
|
const { context, log } = job;
|
|
36
41
|
const { repo, config, ports } = context;
|
|
37
|
-
const checks = await log.step('main-checks', { sha, ...fields }, () => ports.waitForBaseChecks(repo, sha, context.base, checkWaiting(config, true)));
|
|
42
|
+
const checks = await log.step('main-checks', { sha, ...fields }, () => ports.waitForBaseChecks(repo, sha, context.base, checkWaiting(config, true), restarted));
|
|
38
43
|
log.event('main-checks.state', { state: checks, ...fields });
|
|
39
44
|
return checks;
|
|
40
45
|
}
|
|
@@ -46,26 +51,34 @@ async function rerunOnce(job, sha, checks) {
|
|
|
46
51
|
const before = state.rerun;
|
|
47
52
|
state.rerun = sha;
|
|
48
53
|
await writeState(context.repo, state);
|
|
49
|
-
|
|
54
|
+
const restarted = [];
|
|
50
55
|
try {
|
|
51
|
-
const runs = await context.ports.rerunFailedBase(context.repo, sha, context.base, () => {
|
|
52
|
-
|
|
56
|
+
const runs = await context.ports.rerunFailedBase(context.repo, sha, context.base, (run) => {
|
|
57
|
+
restarted.push(run);
|
|
53
58
|
});
|
|
54
59
|
log.event('main-checks.rerun', { sha, runs });
|
|
55
60
|
}
|
|
56
61
|
catch (error) {
|
|
57
62
|
if (runStopped()) {
|
|
58
|
-
if (
|
|
63
|
+
if (restarted.length > 0) {
|
|
59
64
|
throw error;
|
|
60
65
|
}
|
|
61
66
|
state.rerun = before;
|
|
62
67
|
await writeState(context.repo, state);
|
|
63
68
|
throw error;
|
|
64
69
|
}
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
if (restarted.length === 0) {
|
|
71
|
+
log.event('main-checks.rerun-failed', { sha, error: asError(error).message });
|
|
72
|
+
return checks;
|
|
73
|
+
}
|
|
74
|
+
// Some runs restarted, so the fixer waits for them rather than getting a failure with no log.
|
|
75
|
+
log.event('main-checks.rerun', {
|
|
76
|
+
sha,
|
|
77
|
+
runs: restarted.map((run) => String(run.id)),
|
|
78
|
+
error: asError(error).message,
|
|
79
|
+
});
|
|
67
80
|
}
|
|
68
|
-
return waitForChecks(job, sha, { rerun: true }).catch((error) => {
|
|
81
|
+
return waitForChecks(job, sha, { rerun: true }, restarted).catch((error) => {
|
|
69
82
|
job.mainBroken = true;
|
|
70
83
|
throw error;
|
|
71
84
|
});
|
|
@@ -116,7 +129,8 @@ async function unreadChecks(job, error) {
|
|
|
116
129
|
}
|
|
117
130
|
const { base } = job.context;
|
|
118
131
|
job.mainBroken = true;
|
|
119
|
-
|
|
132
|
+
job.state.halted = true;
|
|
133
|
+
return escalateAndFinish(job, `The read of the checks on ${base} failed: ${sentence(message(error))} The landed commit is on \`${base}\`, and its checks were not awaited. ${HALT_NOTE}`, 'checks error');
|
|
120
134
|
}
|
|
121
135
|
export async function escalateError(job, error, note, reason) {
|
|
122
136
|
if (runStopped()) {
|
package/dist/handover.mjs
CHANGED
|
@@ -182,6 +182,10 @@ function handOverComment(reason) {
|
|
|
182
182
|
}
|
|
183
183
|
export async function claimedError(context, log, issue, state, error, started) {
|
|
184
184
|
const reason = message(error);
|
|
185
|
+
if (error instanceof UnsettledBase) {
|
|
186
|
+
// Saved with the hand-over, so later runs land nothing before the base is checked.
|
|
187
|
+
state.halted = true;
|
|
188
|
+
}
|
|
185
189
|
try {
|
|
186
190
|
const earlier = error instanceof HandOverFailed ? error.pending : undefined;
|
|
187
191
|
await handOver(context, log, issue.number, state, handOverReason(error, reason), earlier);
|
package/dist/land.mjs
CHANGED
|
@@ -5,24 +5,27 @@ import { PUSH_TRIES } from './git-land.mjs';
|
|
|
5
5
|
import { escalateAndFinish, finishDone, stop } from './handover.mjs';
|
|
6
6
|
import { oneAtATime } from './lock.mjs';
|
|
7
7
|
import { revertFailedFix } from './revert.mjs';
|
|
8
|
-
import { writeState } from './state.mjs';
|
|
9
|
-
import { beforeBaseSettled } from './unsettled.mjs';
|
|
8
|
+
import { readState, savedIssues, writeState } from './state.mjs';
|
|
9
|
+
import { beforeBaseSettled, blocksLanding, HALT_NOTE } from './unsettled.mjs';
|
|
10
10
|
export function landApproved(job) {
|
|
11
11
|
return landing(job, () => landLoop(job));
|
|
12
12
|
}
|
|
13
13
|
export function resumeLanding(job, sha) {
|
|
14
|
-
return
|
|
14
|
+
return inLandingLock(job, async () => {
|
|
15
15
|
const { state, context } = job;
|
|
16
16
|
if (await beforeBaseSettled(state, context.base, () => holdsUnlandedFix(job, sha))) {
|
|
17
|
-
job
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return unblocked(job, () => {
|
|
18
|
+
job.mainBroken = true;
|
|
19
|
+
job.repairing = true;
|
|
20
|
+
return landLoop(job);
|
|
21
|
+
});
|
|
20
22
|
}
|
|
23
|
+
// Checking a commit that is already on the base lands nothing, so other halted issues do not hold it back.
|
|
21
24
|
const gate = await checkGate(job, sha);
|
|
22
25
|
if (gate.done) {
|
|
23
26
|
return gate;
|
|
24
27
|
}
|
|
25
|
-
return gate.fixed ? landLoop(job) : finishDone(job);
|
|
28
|
+
return gate.fixed ? unblocked(job, () => landLoop(job)) : finishDone(job);
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
async function holdsUnlandedFix(job, sha) {
|
|
@@ -34,15 +37,50 @@ async function holdsUnlandedFix(job, sha) {
|
|
|
34
37
|
return !(await ports.isLanded(worktree, base, config.remote));
|
|
35
38
|
}
|
|
36
39
|
function landing(job, work) {
|
|
40
|
+
return inLandingLock(job, () => unblocked(job, work));
|
|
41
|
+
}
|
|
42
|
+
function inLandingLock(job, work) {
|
|
37
43
|
return oneAtATime(`${job.context.repo.root}#land`, async () => {
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
44
|
+
if (job.context.halted) {
|
|
45
|
+
return holdBack(job, 'run halted');
|
|
40
46
|
}
|
|
41
|
-
|
|
42
|
-
await writeState(job.context.repo, job.state);
|
|
43
|
-
return { done: true, report: stop(job, 'run halted') };
|
|
47
|
+
return work();
|
|
44
48
|
});
|
|
45
49
|
}
|
|
50
|
+
/** Runs a step that lands a change, unless an earlier run halted with a commit on the base whose checks nobody read. */
|
|
51
|
+
async function unblocked(job, work) {
|
|
52
|
+
const { context, log } = job;
|
|
53
|
+
const unchecked = await uncheckedIssues(job);
|
|
54
|
+
if (unchecked.length === 0) {
|
|
55
|
+
return work();
|
|
56
|
+
}
|
|
57
|
+
// Landing now would build on a commit whose checks nobody read.
|
|
58
|
+
log.event('land.blocked', { issues: unchecked }, 'quiet');
|
|
59
|
+
context.halted = true;
|
|
60
|
+
const held = await holdBack(job, 'base unchecked');
|
|
61
|
+
return { ...held, report: { ...held.report, halt: true } };
|
|
62
|
+
}
|
|
63
|
+
async function holdBack(job, reason) {
|
|
64
|
+
job.state.phase = 'approved';
|
|
65
|
+
await writeState(job.context.repo, job.state);
|
|
66
|
+
return { done: true, report: stop(job, reason) };
|
|
67
|
+
}
|
|
68
|
+
/** The other saved issues whose halt left a commit on the base with checks nobody awaited. */
|
|
69
|
+
async function uncheckedIssues(job) {
|
|
70
|
+
const { repo, base } = job.context;
|
|
71
|
+
const unchecked = [];
|
|
72
|
+
for (const issue of await savedIssues(repo)) {
|
|
73
|
+
if (issue === job.issue.number) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
// An unreadable state file fails its own issue; it does not hold back every landing.
|
|
77
|
+
const state = await readState(repo, issue).catch(() => undefined);
|
|
78
|
+
if (state !== undefined && blocksLanding(state, base)) {
|
|
79
|
+
unchecked.push(issue);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return unchecked.sort((a, b) => a - b);
|
|
83
|
+
}
|
|
46
84
|
async function landLoop(job) {
|
|
47
85
|
for (;;) {
|
|
48
86
|
const pushed = await pushChange(job).catch(async (error) => {
|
|
@@ -85,7 +123,8 @@ async function pushChange(job) {
|
|
|
85
123
|
}));
|
|
86
124
|
if (pushed === undefined) {
|
|
87
125
|
job.mainBroken = true;
|
|
88
|
-
|
|
126
|
+
state.halted = true;
|
|
127
|
+
return escalateAndFinish(job, `The push to ${base} failed and the fetch of ${base} failed too, so the harness cannot tell whether the commit landed. ${HALT_NOTE}`, 'push unknown');
|
|
89
128
|
}
|
|
90
129
|
state.pushing = undefined;
|
|
91
130
|
if (pushed) {
|
package/dist/state.mjs
CHANGED
|
@@ -73,7 +73,8 @@ function isState(value) {
|
|
|
73
73
|
value.reviewLog.every(isReviewRound) &&
|
|
74
74
|
isOptional(value.handedOver, 'boolean') &&
|
|
75
75
|
(value.pendingHandOver === undefined || isPending(value.pendingHandOver)) &&
|
|
76
|
-
isOptional(value.closing, 'boolean')
|
|
76
|
+
isOptional(value.closing, 'boolean') &&
|
|
77
|
+
isOptional(value.halted, 'boolean'));
|
|
77
78
|
}
|
|
78
79
|
export async function savedIssues(repo) {
|
|
79
80
|
const names = (await unlessMissing(() => readdir(stateDir(repo.root)))) ?? [];
|
package/dist/unsettled.mjs
CHANGED
|
@@ -12,8 +12,14 @@ export function heldOnBase(state, base) {
|
|
|
12
12
|
.filter((part) => part !== '')
|
|
13
13
|
.join(', ');
|
|
14
14
|
}
|
|
15
|
+
/** What a halt with an unchecked commit on the base means for the next runs. */
|
|
16
|
+
export const HALT_NOTE = 'The run halts, and no run lands another change until this issue resumes (after an answer or once the label is off) and checks the base.';
|
|
17
|
+
/** Whether this state keeps every run from landing: it halted with a commit on the base whose checks are still unknown. */
|
|
18
|
+
export function blocksLanding(state, base) {
|
|
19
|
+
return state.halted === true && state.closing !== true && heldOnBase(state, base) !== '';
|
|
20
|
+
}
|
|
15
21
|
export function unsettledNote(held, step) {
|
|
16
|
-
return ` ${step} before it checked the base: ${held}, and its checks were not awaited.
|
|
22
|
+
return ` ${step} before it checked the base: ${held}, and its checks were not awaited. ${HALT_NOTE}`;
|
|
17
23
|
}
|
|
18
24
|
/** An error thrown on a resume before it settled the base, while a commit is or may be on it. */
|
|
19
25
|
export class UnsettledBase extends Error {
|
package/dist/worktree-setup.mjs
CHANGED
|
@@ -25,6 +25,7 @@ async function setupFailed(job, setup) {
|
|
|
25
25
|
const unsettled = unsettledBase(job);
|
|
26
26
|
if (unsettled !== '') {
|
|
27
27
|
job.mainBroken = true;
|
|
28
|
+
job.state.halted = true;
|
|
28
29
|
}
|
|
29
30
|
const note = late
|
|
30
31
|
? `The setup command did not finish in ${job.context.config.setupTimeoutMinutes} minutes.`
|