next-issue 12.4.4 → 12.5.1
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 +8 -6
- package/dist/config.mjs +1 -1
- package/dist/hunt.mjs +1 -0
- package/dist/job.mjs +1 -1
- package/dist/loop.mjs +4 -1
- package/dist/watch.mjs +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -162,7 +162,7 @@ The console shows the run and issue milestones, verdicts, hand-overs, errors, ea
|
|
|
162
162
|
- git 2.40 or later (every commit runs `git hook run`, every conflict with the base runs `git check-attr --source`). A run or `serve` run on an older git stops before it claims an issue, with an error that names both versions.
|
|
163
163
|
- `gh`, authenticated with write access to the repository
|
|
164
164
|
- a `remote` on GitHub: `github.com`, or a GitHub Enterprise host. Every `gh` call names the host of the remote url (`--repo <host>/<owner>/<name>`, `gh api --hostname <host>`) when it is not `github.com`, so `gh` must be logged in to that host. For an ssh url the harness reads the real host of an ssh alias with `ssh -G`. The host `ssh.github.com` (GitHub's ssh over port 443) means `github.com`. Other hosts, such as GitLab, are not supported.
|
|
165
|
-
- pi, logged in to a model provider. The agents use the model, the thinking level, the extensions and the skills from your pi settings, except the extension and the skills of the `pi-next-issue` package. A repository under a folder named `pi-next-issue` keeps its project extensions and skills. The implementer and the fixer get the default tools of your pi settings, the `grep`, `find` and `ls` tools and the tools of your extensions. The reviewer gets all of them except `edit` and `write`. The agents run with `GIT_OPTIONAL_LOCKS=0`, so a `git status` from an agent or an extension does not hold the index lock while the harness commits. While an agent runs, `process.argv[1]` is the pi CLI, so an extension that starts a child pi with `process.execPath` and `process.argv[1]` (such as a `subagent` tool) runs pi, not next-issue.
|
|
165
|
+
- pi, logged in to a model provider. The agents use the model (unless `models` sets one), the thinking level, the extensions and the skills from your pi settings, except the extension and the skills of the `pi-next-issue` package. A repository under a folder named `pi-next-issue` keeps its project extensions and skills. The implementer and the fixer get the default tools of your pi settings, the `grep`, `find` and `ls` tools and the tools of your extensions. The reviewer gets all of them except `edit` and `write`. The agents run with `GIT_OPTIONAL_LOCKS=0`, so a `git status` from an agent or an extension does not hold the index lock while the harness commits. While an agent runs, `process.argv[1]` is the pi CLI, so an extension that starts a child pi with `process.execPath` and `process.argv[1]` (such as a `subagent` tool) runs pi, not next-issue.
|
|
166
166
|
|
|
167
167
|
## Configuration
|
|
168
168
|
|
|
@@ -209,7 +209,9 @@ With no file, every field keeps its default. A field that is not in the file kee
|
|
|
209
209
|
"maxCommitFixes": 10,
|
|
210
210
|
"maxReviewRounds": 5,
|
|
211
211
|
"models": {
|
|
212
|
+
"default": null,
|
|
212
213
|
"fixer": null,
|
|
214
|
+
"hunter": null,
|
|
213
215
|
"implementer": null,
|
|
214
216
|
"reviewer": null
|
|
215
217
|
},
|
|
@@ -238,7 +240,7 @@ With no file, every field keeps its default. A field that is not in the file kee
|
|
|
238
240
|
| `maxCiFixes` | `5` | The budget for check fixes per issue |
|
|
239
241
|
| `maxCommitFixes` | `10` | The budget for fixes of a commit that a git hook stopped, per issue |
|
|
240
242
|
| `maxReviewRounds` | `5` | The budget for review rounds per issue |
|
|
241
|
-
| `models` | `null` per role | The pi model per agent role, as `provider/model`: `implementer`, `reviewer`, `fixer`
|
|
243
|
+
| `models` | `null` per role | The pi model per agent role, as `provider/model`: `default`, `implementer`, `reviewer`, `fixer`, `hunter` |
|
|
242
244
|
| `remote` | `origin` | The git remote for the repository and the branches |
|
|
243
245
|
| `setupCommand` | from the lock file | A shell command to run in a new worktree, before the implementer, and after each merge of the base before the `checks` |
|
|
244
246
|
| `setupTimeoutMinutes` | `15` | The limit for the setup command, at most `35791` |
|
|
@@ -253,7 +255,7 @@ The harness compares the labels on an issue with the configured names without ca
|
|
|
253
255
|
|
|
254
256
|
The log gives the reason for a skipped issue as `stop-label`, `not-ready`, `in-flight` or `blocked`, the last one with the open blockers.
|
|
255
257
|
|
|
256
|
-
A role set to `null`, or with no entry in `models`, uses the default model of your pi settings.
|
|
258
|
+
A role set to `null`, or with no entry in `models`, uses `models.default`. When `models.default` is `null` or missing too, it uses the default model of your pi settings.
|
|
257
259
|
|
|
258
260
|
Without a `setupCommand`, the harness looks for a lock file in the new worktree, and in the worktree after each merge of the base before the `checks`, and runs the install command that goes with it:
|
|
259
261
|
|
|
@@ -283,7 +285,7 @@ When the implementer makes no change, the hand-over comment holds its full reply
|
|
|
283
285
|
|
|
284
286
|
A hand-over marks the state file as handed over once its label and comment reach GitHub. When either fails, or the run stops during it, the state keeps its budgets and findings, and a later hand-over of the issue keeps the first reason. A handed-over issue carries the `status:needs-human` and `status:todo` labels, and the hand-over takes `status:in-progress` and `status:in-review` off. With an empty `labels.ready`, it carries only `status:needs-human`. The ready label lets a run find the issue again even when its state file is lost. To give the issue another try, take the `status:needs-human` label off, or answer the hand-over. The next run that claims the issue puts the budgets and the findings back to zero, clears the mark and keeps the branch and the step that the last run reached, so the work carries on where it stopped. After a revert, the branch holds the change again on top of the revert, so the change goes back to the review. An issue that still has the label is not claimed, unless it has an answer to the hand-over: then the run claims it and takes the label off. A label that a person adds to a stopped issue that is not handed over holds the issue, even when an earlier hand-over has an answer. When the label of a hand-over reaches GitHub but its comment does not, an answer to an earlier hand-over does not count: the issue waits, and the worker lists it, until a person takes the label off or a writer comments after that hand-over. Either way, the next run that claims it counts it as a hand-over: it puts the budgets and the findings back to zero and passes on the comments posted after it. When the label edit itself fails, the next run keeps the budgets and the findings.
|
|
285
287
|
|
|
286
|
-
To give guidance, answer the hand-over with a comment on the issue. When the run resumes the issue, it reads the comments posted after its last `### next-issue · Hand-over: needs help` comment there, or its last `next-issue needs help:` comment, the one-line heading of older versions. Only comments from users with write access to the repository count, for the hand-over comment too. A comment that starts with one of the headings of the harness never counts as an answer. The implementer and every fixer of that run get them in their prompt, under the heading `Answer of a person to the hand-over`. When the questions of the implementer did not reach the issue body, the implementer also gets them under that heading, before the answer, or alone when no comment answers them. A short reply such as "ready, take it" is enough. With no such comment, the run resumes with no guidance.
|
|
288
|
+
To give guidance, answer the hand-over with a comment on the issue. When the run resumes the issue, it reads the comments posted after its last `### next-issue · Hand-over: needs help` comment there, or its last `next-issue needs help:` comment, the one-line heading of older versions. Only comments from users with write access to the repository count, for the hand-over comment too. A comment that starts with one of the headings of the harness never counts as an answer. The implementer and every fixer of that run get them in their prompt, under the heading `Answer of a person to the hand-over`. When the questions of the implementer did not reach the issue body, the implementer also gets them under that heading, before the answer, or alone when no comment answers them. A short reply such as "ready, take it" is enough. With no such comment, the run resumes with no guidance. A watching run picks up a comment-only answer at its next pass, not in the pass that is going. A label change, such as Retry in pi or the `answer-hand-over` skill, gets the issue picked up sooner, at the next read of the open issues.
|
|
287
289
|
|
|
288
290
|
To drop an issue instead, close it. The next run that finds a saved state for an issue that a person closed removes that state file, the `<n>` branch, the `<n>-dispute-*` branches and the worktree of the issue. This holds for an issue that waits for a person and for one that a stop left behind. The run starts no agent and makes no push, revert, label change, close or comment, so a change that already landed stays on the base branch. A worktree or branch that cannot be removed stays, and the run log says so. The issue shows as `skipped` (`closed`) in the summary. A watching run does not claim an issue again once it ended in `error` in that run, so it leaves such an issue for the next run to clean up.
|
|
289
291
|
|
|
@@ -322,7 +324,7 @@ Version 11.0.0 dropped `--max <n>`, `--reset`, `--json`, `--verbose` and `--quie
|
|
|
322
324
|
|
|
323
325
|
## Watch for new issues
|
|
324
326
|
|
|
325
|
-
A run with `--watch off` ends when no unseen issue is left. With `next-issue start`, or `next-issue start --watch on`, the harness then waits, reads the open issues again and runs another pass, so it picks up an issue that someone opens during the run, or one whose blocker closes. Each pass tries every open issue again, also one that an earlier pass skipped. An issue that failed with an error before the claim is not tried again until the next run. An issue that failed after the claim and was handed over with the needs-human label is tried again once a person answers the hand-over or takes the label off. Within a pass,
|
|
327
|
+
A run with `--watch off` ends when no unseen issue is left. With `next-issue start`, or `next-issue start --watch on`, the harness then waits, reads the open issues again and runs another pass, so it picks up an issue that someone opens during the run, or one whose blocker closes. Each pass tries every open issue again, also one that an earlier pass skipped. An issue that failed with an error before the claim is not tried again until the next run. An issue that failed after the claim and was handed over with the needs-human label is tried again once a person answers the hand-over or takes the label off. Within a pass, only a change of labels gets a tried issue claimed again: the harness claims it at the next read when its labels differ from those it had after its attempt, so a hand-over answered with a label change or an unblocked skipped issue does not wait for the next pass. A hand-over answered by a comment alone keeps its labels, so it waits for the next pass. An issue that is done, or that failed with an error and was not handed over, does not come back in the same pass. The hunter counts the same issues as ready.
|
|
326
328
|
|
|
327
329
|
The waits follow a fixed back-off in minutes: 1, 2, 3, 5, 10, then 10 from then on. A pass that handles an issue, with any outcome other than `skipped`, resets the back-off to 1 minute. A pass where every issue is skipped does not reset it. Each wait prints a line on standard error with the minutes until the next pass.
|
|
328
330
|
|
|
@@ -366,7 +368,7 @@ In a run of the `serve` worker, a client can switch hunting and watching on or o
|
|
|
366
368
|
- stops a run when a client sends `{ "type": "stop", "root": "<path>", "after": "issue" | "round" | "now" }`. With no `after`, it stops after `issue`. `issue` works like a first `Ctrl-C`: no new claim or hunt, and the held issues and a going hunt finish. `round` works like a second `Ctrl-C`: each running issue stops after its current round, with the state kept, and a going hunt ends first. `now` stops every agent, command and hunt of the run at once, and each running issue ends as `stopped` with its state and labels kept; the worker keeps running. A later point than one already asked for changes nothing, and an earlier one replaces it. An unknown `after` gets an `error` message. While a run is going, the client that sent the stop gets `{ "type": "stopping", "root": "<path>", "waiting": <bool>, "hunting": <bool> }`, with the `id` of the stop when it has one: `waiting` is `true` when the run waited between passes, and `hunting` is `true` when a hunt was going then. `next-issue start` picks its note from it;
|
|
367
369
|
- switches watching of a run on or off when a client sends `{ "type": "watch", "root": "<path>", "on": true | false }`. The run keeps its issues, worktrees and progress, and nothing restarts. A run starts with watching on, unless it was started with `--watch off`. On keeps the run going after the current pass, as with `--watch on`. Off ends the run after the current pass, or at once when it waits between passes, and also turns hunting off. With no run going, the message gets an `error` and starts nothing;
|
|
368
370
|
- switches hunting of a run on or off when a client sends `{ "type": "hunt", "root": "<path>", "on": true | false }`. The run keeps its issues, worktrees and progress, and nothing restarts. Every run of the worker has a hunter: a run started with `--hunt on` starts with hunting on, and any other run with it off. Off lets a hunt that is going finish, so the issues it files stay, and starts no new hunt. On wakes the hunter at once, with no back-off wait, and also turns watching on. With no run going, the message gets an `error` and starts nothing. The settings last for the run only: a new run takes them from its own flags. The progress of each run carries `hunting`, `true` while hunting is on, and `watching`, `true` when the run watches for issues;
|
|
369
|
-
- asks a watching run to check for new issues now when a client sends `{ "type": "refresh", "root": "<path>" }`. A run that waits between passes starts a new pass at once, and its next wait starts again at 1 minute; a waiting hunter checks the ready count again. While a pass runs, the run reads the open issues again, so its open-issue count is current, and claims a new issue only when a slot is free. A refresh for a run that is stopping or does not watch, or with no run going, changes nothing and gets no answer;
|
|
371
|
+
- asks a watching run to check for new issues now when a client sends `{ "type": "refresh", "root": "<path>" }`. A run that waits between passes starts a new pass at once, and its next wait starts again at 1 minute; a refresh during the last read of the open issues of a pass, or while the pass ends, also starts a new pass at once; a waiting hunter checks the ready count again. While a pass runs, the run reads the open issues again, so its open-issue count is current, and claims a new issue only when a slot is free. A refresh for a run that is stopping or does not watch, or with no run going, changes nothing and gets no answer;
|
|
370
372
|
- exits, and removes its socket and lock files, when no run is going and no client is connected, or when no client connects in the 30 seconds after it starts;
|
|
371
373
|
- waits up to 5 seconds for the lock when a worker that is closing still holds it;
|
|
372
374
|
- closes once no run is going when a client with a newer version connects, so that the client can start the newer worker. The `hello` of a client can say how to start the worker of its version, as `"launch": { "command": "<command>", "args": ["<arg>", ...] }`: pi sends `npx -y next-issue@<version> serve`, and `next-issue start` its own `node <script> serve`. A run that watches is stopped between issues for that, as `stop` with `issue` does: it claims nothing new, and its running issues and its current hunt finish. Its progress then holds `"upgrade": { "from": "<worker version>", "to": "<client version>" }`, with `"resumes": true` when the first newer client gave a `launch`. A stop by a person, or turning watching off, drops that field, so the run does not start again. With `resumes`, once the run ends, the worker stops listening, runs that command in the repository with its output in `.next-issue/worker.log` (or uses a worker that already listens there), and asks the newer worker to start the run again with `--watch on` and the same `--hunt` setting, before it closes. This works with no client connected. When the newer worker does not start or does not start the run, the worker writes the reason to `.next-issue/worker.log`, and its clients see the run `failed` with an `error` that starts with `the worker could not start next-issue <version>`. Without `resumes`, a client starts the newer worker and the run again. A run that does not watch is left alone; a run that `next-issue start` started is not, and `start` follows it to the newer worker. Meanwhile the worker refuses every start with `the worker is restarting, try again soon`. A `start` with `"resume": true` gets no error when the worker refuses it;
|
package/dist/config.mjs
CHANGED
|
@@ -65,7 +65,7 @@ const WHOLE_FIELDS = [
|
|
|
65
65
|
['keepRunDays', 0],
|
|
66
66
|
['checksTimeoutMinutes', 1, MAX_MINUTES],
|
|
67
67
|
];
|
|
68
|
-
const MODEL_ROLES = ['implementer', 'reviewer', 'fixer'];
|
|
68
|
+
const MODEL_ROLES = ['default', 'implementer', 'reviewer', 'fixer', 'hunter'];
|
|
69
69
|
const LABEL_NAMES = [
|
|
70
70
|
'ready',
|
|
71
71
|
'inProgress',
|
package/dist/hunt.mjs
CHANGED
|
@@ -60,6 +60,7 @@ export async function hunt(context, count) {
|
|
|
60
60
|
cwd,
|
|
61
61
|
prompt: await withNotes(repo.root, huntPrompt(instructions, config.labels.ready, config.labels.hunt, count, repoArg(repo)), false),
|
|
62
62
|
profile: REVIEWING,
|
|
63
|
+
model: config.models.hunter ?? config.models.default,
|
|
63
64
|
timeoutMs: minutesToMs(config.agentTimeoutMinutes),
|
|
64
65
|
});
|
|
65
66
|
const urls = await issuesOf(context, [...result.text.matchAll(FILED)].map((match) => match[1]));
|
package/dist/job.mjs
CHANGED
|
@@ -26,7 +26,7 @@ export async function runRole(job, role, prompt, profile) {
|
|
|
26
26
|
cwd: job.worktree,
|
|
27
27
|
prompt: await withNotes(repo.root, prompt, writable),
|
|
28
28
|
profile,
|
|
29
|
-
model: config.models[role],
|
|
29
|
+
model: config.models[role] ?? config.models.default,
|
|
30
30
|
timeoutMs: minutesToMs(config.agentTimeoutMinutes),
|
|
31
31
|
};
|
|
32
32
|
const took = (await job.slot?.take()) === true;
|
package/dist/loop.mjs
CHANGED
|
@@ -69,7 +69,10 @@ export async function runIssues(loop, seen = new Set()) {
|
|
|
69
69
|
finally {
|
|
70
70
|
ended.abort();
|
|
71
71
|
}
|
|
72
|
-
return loopResult(reports, stoppedAt, error, crash);
|
|
72
|
+
return { ...loopResult(reports, stoppedAt, error, crash), ...refreshedOf(refresh) };
|
|
73
|
+
}
|
|
74
|
+
function refreshedOf(refresh) {
|
|
75
|
+
return refresh.signal === undefined ? {} : { refreshed: refresh.signal };
|
|
73
76
|
}
|
|
74
77
|
function refreshes(loop, ended, previous) {
|
|
75
78
|
const signal = loop.refreshed?.();
|
package/dist/watch.mjs
CHANGED
|
@@ -98,8 +98,9 @@ async function watchPasses(failed, watch) {
|
|
|
98
98
|
for (;;) {
|
|
99
99
|
const pass = await runIssues(watch, new Set(failed));
|
|
100
100
|
addReports(reports, pass.reports);
|
|
101
|
+
const { refreshed, ...result } = pass;
|
|
101
102
|
if (pass.crash !== undefined) {
|
|
102
|
-
return { ...
|
|
103
|
+
return { ...result, reports };
|
|
103
104
|
}
|
|
104
105
|
recordFailures(failed, pass.reports);
|
|
105
106
|
if (handled(pass.reports) > 0) {
|
|
@@ -107,14 +108,14 @@ async function watchPasses(failed, watch) {
|
|
|
107
108
|
step = 0;
|
|
108
109
|
}
|
|
109
110
|
if (pass.error !== undefined || pass.stoppedAt !== undefined) {
|
|
110
|
-
return { ...
|
|
111
|
+
return { ...result, reports };
|
|
111
112
|
}
|
|
112
113
|
if (watch.stop() || !watching()) {
|
|
113
114
|
return { reports };
|
|
114
115
|
}
|
|
115
116
|
const minutes = backOffMinutes(step);
|
|
116
117
|
step += 1;
|
|
117
|
-
const signals = [watch.refreshed?.(), watch.watching?.changed()].filter((signal) => signal !== undefined);
|
|
118
|
+
const signals = [refreshed ?? watch.refreshed?.(), watch.watching?.changed()].filter((signal) => signal !== undefined);
|
|
118
119
|
const woken = signals.length === 0 ? undefined : AbortSignal.any(signals);
|
|
119
120
|
if (!(await watch.wait(minutes, woken))) {
|
|
120
121
|
if (woken?.aborted !== true || watch.stop() || !watching()) {
|