next-issue 10.7.2 → 10.7.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 CHANGED
@@ -34,7 +34,7 @@ flowchart TD
34
34
 
35
35
  Before each issue, fetch the open issues again and take the oldest one not yet seen in this run. An issue seen once in a run is not tried again in that run while its labels stay as the first fetch after its attempt found them. When its labels change, for example once a person answers a hand-over or makes a skipped issue ready, the next fetch claims it again in the usual order. An issue that is done, or that failed with an error and was not handed over, is not tried again in that run. The run ends when no unseen issue is left. When the fetch fails, the run claims no new issue, ends once the running issues end, writes the summary of the issues it handled and exits with code 1.
36
36
 
37
- `next-issue start` runs the work in the worker of the repository, see [Worker](#worker). It connects to the worker, or starts one in the background (`next-issue serve` of the same version, with its output in `.next-issue/worker.log`) when none answers, and then starts the run there with its flags. It prints the output of the run on standard error and the summary on standard output, and exits with the exit code of the run. When the terminal closes or the command ends some other way, the run keeps going in the worker, and pi and `next-issue logs` still show it. pi shows the run in `/next-issue` and the dashboard, and its Stop, Watch, Hunt and Refresh work on it. When the worker is older than `start` and no run is going, it closes and `start` starts a new one. When a run is going in the worker already, `start` exits with code 1 and the error `a run is going in this repository already`, and leaves that run alone: it does not tell an older worker its version, so the worker does not stop a watching run for an upgrade. `start` ignores `--force`, as before.
37
+ `next-issue start` runs the work in the worker of the repository, see [Worker](#worker). It connects to the worker, or starts one in the background (`next-issue serve` of the same version, with its output in `.next-issue/worker.log`) when none answers, and then starts the run there with its flags. It prints the output of the run on standard error and the summary on standard output, and exits with the exit code of the run. When the terminal closes or the command ends some other way, the run keeps going in the worker, and pi and `next-issue logs` still show it. pi shows the run in `/next-issue` and the dashboard, and its Stop, Watch, Hunt and Refresh work on it. When the worker is older than `start` and no run is going, it closes and `start` starts a new one. When a newer client, such as a newer pi, connects while a run of `start` goes, the worker does not stop that run for an upgrade, even when it watches: the run keeps its flags (`--max`, `--verbose`, `--quiet`), `start` follows it to its end, and the worker upgrades once it ends. When a run is going in the worker already, `start` exits with code 1 and the error `a run is going in this repository already`, and leaves that run alone: it does not tell an older worker its version, so the worker does not stop a watching run for an upgrade. `start` ignores `--force`, as before.
38
38
 
39
39
  Only one worker goes at a time in a repository. It holds the lock `.next-issue/worker.lock`, with the process id and the start time of that process, for its whole life. A run that the worker starts takes no lock of its own, since the worker runs at most one run at a time. When a process that does not take connections on the worker socket holds the lock for more than 2 seconds, `start` starts a worker anyway, which exits with `another worker is running`, so `start` claims no issue and exits with code 1 and the error `the next-issue worker exited before it listened: exit code 1 (see .next-issue/worker.log)`. A lock whose process is gone, or started at another time, is stale and taken over.
40
40
 
@@ -369,7 +369,7 @@ In a run of the `serve` worker, a client can switch hunting and watching on or o
369
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. A refresh while a pass runs, for a run that is stopping or does not watch, or with no run going, changes nothing and gets no answer;
370
370
  - 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
371
  - waits up to 5 seconds for the lock when a worker that is closing still holds it;
372
- - closes once no run is going when a client with a newer version connects, so that the client can start the newer worker. 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>" }`. A stop by a person, or turning watching off, drops that field, so no client starts the run again. A run that does not watch is left alone. 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;
372
+ - closes once no run is going when a client with a newer version connects, so that the client can start the newer worker. 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>" }`. A stop by a person, or turning watching off, drops that field, so no client starts the run again. A run that does not watch, or that `next-issue start` started, is left alone. 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;
373
373
  - stops every agent and command and exits on `SIGTERM`, `SIGHUP` or `SIGINT`, and removes its socket and lock files;
374
374
  - keeps `.next-issue/worker.log`, where the extension writes the output of the worker, within 10 MiB: when it starts and once a minute while it runs, it cuts a log of more than 10 MiB to its newest 5 MiB, from the start of a line. It skips the cut while a command that writes to the log runs. The run logs under `.next-issue/runs/` hold the same events.
375
375
 
package/dist/run.mjs CHANGED
@@ -51,7 +51,7 @@ async function handle(args, config, repo, recorder, controls) {
51
51
  const { reports, stoppedAt, error, crash } = args.watch || controls.watching !== undefined
52
52
  ? await watchRun(args, loop, context, controls, print)
53
53
  : await runIssues(args, loop);
54
- recordLoopEnd(recorder, stoppedAt, error);
54
+ recordLoopEnd(recorder, stoppedAt, interrupts.afterIssue(), error);
55
55
  const summary = await endRun(recorder, reports);
56
56
  if (crash !== undefined) {
57
57
  throw crash.failure;
@@ -81,10 +81,13 @@ export function watchRun(args, loop, context, controls, print) {
81
81
  refreshed: controls.refreshed,
82
82
  });
83
83
  }
84
- function recordLoopEnd(recorder, stoppedAt, error) {
84
+ function recordLoopEnd(recorder, stoppedAt, stopped, error) {
85
85
  if (stoppedAt !== undefined) {
86
86
  recorder.event('run.stop', { issue: stoppedAt }, 'quiet');
87
87
  }
88
+ else if (stopped) {
89
+ recorder.event('run.stop', {}, 'quiet');
90
+ }
88
91
  if (error !== undefined) {
89
92
  recorder.event('issues.fail', { error: message(error) }, 'quiet');
90
93
  }
package/dist/serve.mjs CHANGED
@@ -56,7 +56,7 @@ export async function startWorker(options) {
56
56
  broadcast(sockets, runs);
57
57
  }
58
58
  };
59
- const start = (refuse, root, argv, resume) => {
59
+ const start = (refuse, root, argv, resume, command) => {
60
60
  const refusal = startRefusal(runs.get(root), restart !== undefined);
61
61
  if (refusal !== undefined) {
62
62
  if (!resume) {
@@ -72,7 +72,7 @@ export async function startWorker(options) {
72
72
  refuse(message(error));
73
73
  return;
74
74
  }
75
- const run = newRun({ ...startProgress(args.hunt), watching: args.watch });
75
+ const run = newRun({ ...startProgress(args.hunt), watching: args.watch }, command);
76
76
  runs.set(root, run);
77
77
  const update = (next) => {
78
78
  run.progress = next;
@@ -148,7 +148,7 @@ export async function startWorker(options) {
148
148
  refuse(`the worker serves ${options.root} only`);
149
149
  }
150
150
  else if (value.type === 'start') {
151
- start(refuse, value.root, value.args ?? [], value.resume === true);
151
+ start(refuse, value.root, value.args ?? [], value.resume === true, value.command === true);
152
152
  }
153
153
  else if (value.type === 'stop') {
154
154
  stop(socket, refuse, value.root, value.after, value.id);
package/dist/start.mjs CHANGED
@@ -90,6 +90,6 @@ function follow(connection, root, args, argv, out) {
90
90
  }
91
91
  });
92
92
  void connection.closed.then(() => fail(CLOSED));
93
- connection.send({ type: 'start', root, args: argv, id });
93
+ connection.send({ type: 'start', root, args: argv, command: true, id });
94
94
  });
95
95
  }
@@ -4,9 +4,10 @@ import { onOff } from './switch.mjs';
4
4
  import { applyEvent } from './progress.mjs';
5
5
  import { STOP_POINTS, } from './protocol.mjs';
6
6
  import { refresher } from './refresh.mjs';
7
- export function newRun(progress) {
7
+ export function newRun(progress, command = false) {
8
8
  return {
9
9
  progress,
10
+ command,
10
11
  children: runChildren(),
11
12
  watching: onOff(progress.watching === true),
12
13
  hunting: onOff(progress.hunting),
@@ -69,7 +70,7 @@ export function stoppingMessage(root, run, id) {
69
70
  };
70
71
  }
71
72
  export function requestUpgrade(run, upgrade) {
72
- if (!run.watching.on() || run.stop !== undefined || !requestStop(run, 'issue')) {
73
+ if (run.command || !run.watching.on() || run.stop !== undefined || !requestStop(run, 'issue')) {
73
74
  return false;
74
75
  }
75
76
  run.progress = { ...run.progress, upgrade };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "10.7.2",
3
+ "version": "10.7.4",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",