next-issue 12.5.1 → 12.5.2
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 +2 -2
- package/dist/serve.mjs +2 -1
- package/dist/worker-run.mjs +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -366,8 +366,8 @@ In a run of the `serve` worker, a client can switch hunting and watching on or o
|
|
|
366
366
|
- sends every client a `questions` message for each repository: the open issues with the `needsHuman` label, each with its number, title, the reason of the hand-over, the url of the comment that holds it, the `owner/name` repository, and the `needsHuman`, `skip` and `ready` labels. It reads them from GitHub, so the list is the same after a restart. It sends them when a client connects, for its repository, after each issue of a run ends, and when a client sends `{ "type": "questions", "root": "<path>" }`. An issue that no longer has the label leaves the list, and so does an issue whose hand-over has an answer from a writer, the same answer that lets a run claim it. An issue that a person holds with the label stays in the list, even when an earlier hand-over has an answer. An issue with the label but no hand-over comment is in the list with an empty reason and url. The issues are read one at a time. A client never gets an older list after a newer one. When the client adds an `"id"` to its message, the list that answers it carries the same `id` and is read after the message arrived. When the list cannot be read, the client gets `{ "type": "questions-error", "root": "<path>", "message": "<text>" }`;
|
|
367
367
|
- answers `{ "type": "upcoming", "root": "<path>" }` with `{ "type": "upcoming", "root": "<path>", "claimable": [...], "blocked": [...] }`: the open issues with the `ready` label that a run would claim, oldest first, each with its `issue` number and `title`, without issues that have saved state or a label that stops a claim. An issue blocked by open issues is in `blocked` with their references in `blockers`. When the list cannot be read, the client gets `{ "type": "upcoming-error", "root": "<path>", "message": "<text>" }`;
|
|
368
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;
|
|
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;
|
|
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
|
+
- 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`. On for a run that a person asked to stop gets an `error` (`the run is stopping`, with the `id` of the request) and changes nothing; on for a run that stops for an upgrade keeps the upgrade, so the run is still resumed. 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;
|
|
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. On for a run that a person asked to stop gets the same `error` as watch 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;
|
|
371
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;
|
|
372
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;
|
|
373
373
|
- waits up to 5 seconds for the lock when a worker that is closing still holds it;
|
package/dist/serve.mjs
CHANGED
|
@@ -145,6 +145,7 @@ export async function startWorker(options) {
|
|
|
145
145
|
}
|
|
146
146
|
const run = runs.get(root);
|
|
147
147
|
if (run !== undefined && active(run)) {
|
|
148
|
+
run.stoppedByPerson = true;
|
|
148
149
|
send(socket, stoppingMessage(root, run, id));
|
|
149
150
|
}
|
|
150
151
|
const dropped = dropUpgrade(run);
|
|
@@ -154,7 +155,7 @@ export async function startWorker(options) {
|
|
|
154
155
|
};
|
|
155
156
|
const toggle = (refuse, root, on, set) => {
|
|
156
157
|
const run = runs.get(root);
|
|
157
|
-
const refusal = switchRefusal(run);
|
|
158
|
+
const refusal = switchRefusal(run, on);
|
|
158
159
|
if (refusal !== undefined) {
|
|
159
160
|
refuse(refusal);
|
|
160
161
|
return;
|
package/dist/worker-run.mjs
CHANGED
|
@@ -69,9 +69,13 @@ export function stoppingMessage(root, run, id) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
export function requestUpgrade(run, upgrade) {
|
|
72
|
-
if (!run
|
|
72
|
+
if (!active(run) ||
|
|
73
|
+
!run.watching.on() ||
|
|
74
|
+
run.stoppedByPerson === true ||
|
|
75
|
+
run.progress.upgrade !== undefined) {
|
|
73
76
|
return false;
|
|
74
77
|
}
|
|
78
|
+
requestStop(run, 'issue');
|
|
75
79
|
run.progress = { ...run.progress, upgrade };
|
|
76
80
|
return true;
|
|
77
81
|
}
|
|
@@ -82,8 +86,11 @@ export function dropUpgrade(run) {
|
|
|
82
86
|
run.progress = { ...run.progress, upgrade: undefined };
|
|
83
87
|
return true;
|
|
84
88
|
}
|
|
85
|
-
export function switchRefusal(run) {
|
|
86
|
-
|
|
89
|
+
export function switchRefusal(run, on) {
|
|
90
|
+
if (!active(run)) {
|
|
91
|
+
return 'no run is going in this repository';
|
|
92
|
+
}
|
|
93
|
+
return on && run.stoppedByPerson === true ? 'the run is stopping' : undefined;
|
|
87
94
|
}
|
|
88
95
|
// Only a running watch run refreshes: it wakes the wait between passes, or reads the open issues again during a pass.
|
|
89
96
|
export function requestRefresh(run) {
|