next-issue 12.4.2 → 12.4.4
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 -4
- package/dist/editors.mjs +8 -1
- package/dist/loop.mjs +3 -0
- package/dist/pipeline.mjs +1 -1
- package/dist/watch.mjs +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ Only one worker goes at a time in a repository. It holds the lock `.next-issue/w
|
|
|
40
40
|
|
|
41
41
|
Every command uses the main worktree of the repository as its root, the first one that `git worktree list` shows, even when it runs in a linked worktree. So `.next-issue/`, with the config, the locks, the worker socket, the saved state and the notes, and `.worktrees/` are always in the main worktree, and a run or worker started from a linked worktree gets the same refusal as one started from the main worktree.
|
|
42
42
|
|
|
43
|
-
A run works on up to `concurrency` issues with an agent at the same time, 1 by default. Each claimed issue takes a slot. An approved issue frees its slot while it waits to land, while it lands and while it waits for the checks on the base, so the next issue's agents never wait for CI. When such an issue needs an agent again, for example the fixer for a conflict or for failed checks, it waits for a free slot, takes it before any new issue is claimed and frees it once the agent ends. So no more than `concurrency` agents run at once. When a slot frees up, the run claims the oldest unseen issue for it, and fetches the open issues again only when the last fetch left an unseen issue unclaimed or an issue has ended since. When an issue ends while every slot is taken, the run still reads the open issues again, so the open-issue count stays current, but claims nothing until a slot frees up. The run ends only once every issue has ended, including those waiting to land. Each issue has its own worktree and branch. Step 3 below and the removal of a worktree or branch run for one issue at a time, so two issues never change the git refs or worktrees of the repository at once. An issue skipped as blocked is tried again in that run once another issue is done, so an issue blocked by one that waits to land is claimed once its blocker closes. For each issue:
|
|
43
|
+
A run works on up to `concurrency` issues with an agent at the same time, 1 by default. Each claimed issue takes a slot. An approved issue frees its slot while it waits to land, while it lands and while it waits for the checks on the base, so the next issue's agents never wait for CI. When such an issue needs an agent again, for example the fixer for a conflict or for failed checks, it waits for a free slot, takes it before any new issue is claimed and frees it once the agent ends. So no more than `concurrency` agents run at once. When a slot frees up, the run claims the oldest unseen issue for it, and fetches the open issues again only when the last fetch left an unseen issue unclaimed or an issue has ended since. When an issue ends while every slot is taken, the run still reads the open issues again, so the open-issue count stays current, but claims nothing until a slot frees up. When an issue ends `done` after the run has stopped claiming, because of a stop or a halt, the run reads the open issues again too, so the count shows the closed issue. The run ends only once every issue has ended, including those waiting to land. Each issue has its own worktree and branch. Step 3 below and the removal of a worktree or branch run for one issue at a time, so two issues never change the git refs or worktrees of the repository at once. An issue skipped as blocked is tried again in that run once another issue is done, so an issue blocked by one that waits to land is claimed once its blocker closes. For each issue:
|
|
44
44
|
|
|
45
45
|
1. Claim the issue only when it holds the `status:todo` label and holds no `status:in-progress` or `status:in-review` label. A `status:done`, `status:needs-human` or `status:blocked` label always stops the claim, a resume too, except a `status:needs-human` issue with an answer to its hand-over that the run made, and except an issue whose finish a stop cut short and that was not handed over (see step 7 below). An issue that GitHub lists as blocked by an open issue waits, because its blocker closes only when the change of the blocker lands. An issue with saved state under `.next-issue/` resumes instead, whatever its other labels and blockers.
|
|
46
46
|
2. Add `status:in-progress` to the issue.
|
|
@@ -88,14 +88,14 @@ The harness hands the issue to a person, with the `status:needs-human` label, an
|
|
|
88
88
|
- the push to the base branch fails while the base did not move, or fails three times;
|
|
89
89
|
- the checks on the base branch fail and the fixer cannot fix them, an error stops the fix, or they do not finish in time. The base branch is then broken, so the run claims no new issue and ends once the running issues end. It halts this way even when the hand-over fails; the issue then ends in error with both the reason and the hand-over error;
|
|
90
90
|
- the implementer asks questions about the issue (reason `questions`);
|
|
91
|
-
- a person without write access last changed the title or body of the issue (reason `untrusted editor`, see [Safety](#safety));
|
|
91
|
+
- a person without write access last changed the title or body of the issue (reason `untrusted editor`, see [Safety](#safety)). On a resume whose state holds a landed commit, or a push or revert that may have reached the base, this check runs before the harness checks the base, so it then also halts the run, as a failed setup does;
|
|
92
92
|
- an agent does not finish in `agentTimeoutMinutes`;
|
|
93
93
|
- the setup command fails, or does not finish in `setupTimeoutMinutes`. On a resume whose state holds a landed commit, or a push or revert that may have reached the base, the setup runs before the harness checks the base, so it then also halts the run, with the commits and state kept for the next run. The comment says what may be on the base and that its checks were not awaited;
|
|
94
94
|
- a step of the run fails with an error. A `gh` call that is safe to repeat, such as a read or a label edit, is tried up to three times first when the network fails. So is a `gh run rerun`: when GitHub took the first try, it refuses the next as already running, which counts as a started rerun. A `gh issue comment` is tried once, so a lost reply never makes a duplicate. On a resume whose state holds a landed commit, or a push or revert that may have reached the base, an error before the harness checks the base (for example a failed fetch of the base, or a worktree that cannot be made) also halts the run, as `push unknown` does. The issue ends in error, the comment says what may be on the base and that its checks were not awaited, and the state keeps the commits for the next run.
|
|
95
95
|
|
|
96
96
|
After a halt, a running issue that reaches the landing does not land on the broken base branch: it ends `stopped` with the reason `run halted` and keeps its state, branch and labels. The next run resumes it and lands it with no new review.
|
|
97
97
|
|
|
98
|
-
A halt that leaves a commit on the base, or a push or revert that may be on it, with checks nobody awaited (`checks error`, `push unknown`, `main checks timeout`, `main checks cancelled`, `main checks cut short`, an error
|
|
98
|
+
A halt that leaves a commit on the base, or a push or revert that may be on it, with checks nobody awaited (`checks error`, `push unknown`, `main checks timeout`, `main checks cancelled`, `main checks cut short`, an error, a failed setup or an `untrusted editor` hand-over on such a resume before the base is checked, or a stop or kill while the run pushes a change to the base, waits for the checks of a commit it landed, or fixes the failed checks of that commit before the fix lands or the revert of that commit ends) is saved in the state file of its issue. A stopped issue resumes in the next run; any other waits for a person, so later runs skip it. Either way, no later run lands another change meanwhile: an issue that reaches the landing ends `stopped` with the reason `base unchecked`, keeps its state, branch and labels, and the run claims no more issues; the log holds a `land.blocked` event with the waiting issues. Runs take such a halted issue before the others, and a running one still resumes, so an older issue that reaches the landing first does not keep it from checking the base. Once a person answers or takes the label off, the issue resumes, checks the base and waits for the checks of its commit; when those are known (the issue is done, or its commits are reverted or found not on the base), the issue drops the halt from its state and the next run lands the held issues again. A later landing of that issue blocks other runs only if it halts again. A person who gives such an issue up instead (the `skip` label, which **Give up** in pi adds) releases the block: the next run skips the issue, drops its halt from the state and logs a `land.released` event, so other issues land again on a base whose last checks nobody read. The state keeps the commits, so taking the `skip` label off later resumes the issue and checks them. Such a resume is not held back by another halted issue while it only checks its commit already on the base; a fix it has to land waits like any other change. The hand-over comment says so. A halted issue that was deleted or moved to another repository can no longer be answered or given up, so the next run that gets a not-found error when it reads the issue releases it the same way: it drops the halt from the state, keeps the commits and logs a `land.released` event with the reason `issue not found`. Any other read error (for example a network error) keeps the block for that run.
|
|
99
99
|
|
|
100
100
|
The fixer sees the findings of all earlier rounds, not only the last one, with its own disputes next to them. From round two, the reviewer judges only the earlier findings and any regression.
|
|
101
101
|
|
|
@@ -337,7 +337,7 @@ The watch stops:
|
|
|
337
337
|
|
|
338
338
|
## Hunt for bugs
|
|
339
339
|
|
|
340
|
-
With `next-issue start --hunt on`, which needs watching on, the harness runs a hunter agent at the same time as the issues. Before each hunt it reads the open issues with the `labels.ready` label and counts those that are ready to claim and are not running. An issue that failed earlier in the run does not count, since the watch does not try it again. It counts a blocked issue only when each of its open blockers is in the same repository and is running or ready to claim, since those blockers can land and close; a blocker that cannot move, such as one with `labels.needsHuman`, `labels.skip` or `labels.done`, one without `labels.ready`, or one in another repository, leaves it out. It looks only at the direct blockers, and reads them one issue at a time, so it runs one `gh` call at a time. It hunts only while that count is less than `huntCap`, 1 by default. Otherwise it waits and checks again, with the same back-off as the watch: 1, 2, 3, 5, 10, then 10 minutes. After a hunt that files an issue,
|
|
340
|
+
With `next-issue start --hunt on`, which needs watching on, the harness runs a hunter agent at the same time as the issues. Before each hunt it reads the open issues with the `labels.ready` label and counts those that are ready to claim and are not running. An issue that failed earlier in the run does not count, since the watch does not try it again. It counts a blocked issue only when each of its open blockers is in the same repository and is running or ready to claim, since those blockers can land and close; a blocker that cannot move, such as one with `labels.needsHuman`, `labels.skip` or `labels.done`, one without `labels.ready`, or one in another repository, leaves it out. It looks only at the direct blockers, and reads them one issue at a time, so it runs one `gh` call at a time. It hunts only while that count is less than `huntCap`, 1 by default. Otherwise it waits and checks again, with the same back-off as the watch: 1, 2, 3, 5, 10, then 10 minutes. After a hunt that files an issue, the harness reads the open issues again, so the open-issue count is current, and the hunter waits 1 minute before it checks the count again, even when the count is still less than `huntCap`. Each wait writes a `hunt.wait` event with the `minutes` to the run log. A hunt that files nothing backs off like a failed one. When the harness claims an issue, the hunter wakes: it ends its wait at once, or skips the wait after a hunt that is going, and checks the count again. A wake keeps the back-off where it was. The hunter:
|
|
341
341
|
|
|
342
342
|
- works in its own worktree at `.worktrees/hunt`, on a detached `HEAD` at the remote base branch, which the harness fetches and checks out before each hunt. A branch that the hunter checks out keeps its commits, and an issue that resumes never uses the hunt worktree as its own;
|
|
343
343
|
- follows `next-issue.hunt.md` in the repository root, or a short built-in prompt when the file is missing;
|
package/dist/editors.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { escalateAndFinish } from './handover.mjs';
|
|
2
|
+
import { heldOnBase, unsettledNote } from './unsettled.mjs';
|
|
2
3
|
/** Hands the issue over when a person without write access last changed its title or body; otherwise gives the job the title and body checked. */
|
|
3
4
|
export async function untrustedEditors(job) {
|
|
4
5
|
const { context, issue, log } = job;
|
|
@@ -21,5 +22,11 @@ export async function untrustedEditors(job) {
|
|
|
21
22
|
.map(({ part, login }) => `the ${part} was last changed by @${login}, who has no write access to the repository`)
|
|
22
23
|
.join('; ');
|
|
23
24
|
const parts = untrusted.map(({ part }) => `the ${part}`).join(' and ');
|
|
24
|
-
|
|
25
|
+
const held = heldOnBase(job.state, context.base);
|
|
26
|
+
if (held !== '') {
|
|
27
|
+
job.mainBroken = true;
|
|
28
|
+
job.state.halted = true;
|
|
29
|
+
}
|
|
30
|
+
const unsettled = held === '' ? '' : unsettledNote(held, 'This resume stopped');
|
|
31
|
+
return escalateAndFinish(job, `The worker did not send the issue to an agent: ${changed}. A person with write access can check the issue, then change ${parts} to go on.${unsettled}`, 'untrusted editor');
|
|
25
32
|
}
|
package/dist/loop.mjs
CHANGED
package/dist/pipeline.mjs
CHANGED
|
@@ -82,7 +82,7 @@ async function work(context, issue, log, state, start, handedOver, pending, slot
|
|
|
82
82
|
if (setup.done) {
|
|
83
83
|
return setup.report;
|
|
84
84
|
}
|
|
85
|
-
const untrusted = await untrustedEditors(job);
|
|
85
|
+
const untrusted = await beforeBaseSettled(state, context.base, () => untrustedEditors(job));
|
|
86
86
|
if (untrusted !== undefined) {
|
|
87
87
|
return untrusted.report;
|
|
88
88
|
}
|
package/dist/watch.mjs
CHANGED
|
@@ -8,7 +8,7 @@ export async function watchIssues(watch) {
|
|
|
8
8
|
const claims = claimAlarm();
|
|
9
9
|
const hunting = watch.hunter === undefined
|
|
10
10
|
? undefined
|
|
11
|
-
: huntIssues(watch.hunter, watch.hunting ?? onOff(true), running, failed, claims, watch.refreshed, () => ended.signal.aborted || watch.stop(), ended.signal);
|
|
11
|
+
: huntIssues(watch.hunter, watch.hunting ?? onOff(true), running, failed, claims, watch.issues, watch.refreshed, () => ended.signal.aborted || watch.stop(), ended.signal);
|
|
12
12
|
try {
|
|
13
13
|
return await watchPasses(failed, {
|
|
14
14
|
...watch,
|
|
@@ -57,7 +57,7 @@ function aborted(signal) {
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
async function huntIssues(hunter, hunting, running, failed, claims, refreshes, stopped, signal) {
|
|
60
|
+
async function huntIssues(hunter, hunting, running, failed, claims, issues, refreshes, stopped, signal) {
|
|
61
61
|
let step = 0;
|
|
62
62
|
while (!stopped()) {
|
|
63
63
|
if (!hunting.on()) {
|
|
@@ -74,6 +74,7 @@ async function huntIssues(hunter, hunting, running, failed, claims, refreshes, s
|
|
|
74
74
|
if (waiting !== undefined && waiting < hunter.cap && hunting.on()) {
|
|
75
75
|
if (await hunter.hunt(hunter.cap - waiting)) {
|
|
76
76
|
step = 0;
|
|
77
|
+
await issues().catch(() => undefined);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
if (claims.take() || stopped() || !hunting.on()) {
|