next-issue 14.4.14 → 14.4.16

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.
@@ -40,6 +40,10 @@ export async function refreshInWorker(root) {
40
40
  connection.close();
41
41
  throw new Error('the worker of the going run is older than next-issue, so it cannot refresh. Stop the run, then start it again');
42
42
  }
43
+ if (progress.status === 'stopping' && progress.upgrade !== undefined) {
44
+ connection.close();
45
+ return 'next-issue: the run is stopping for an upgrade, so nothing was asked; it starts again on the newer worker and picks up new issues then\n';
46
+ }
43
47
  if (progress.status === 'stopping') {
44
48
  connection.close();
45
49
  return 'next-issue: the run is stopping, so nothing was asked\n';
@@ -3,6 +3,7 @@ const groups = new Set();
3
3
  const stoppers = new Set();
4
4
  const undos = new Set();
5
5
  const current = new AsyncLocalStorage();
6
+ const STOP_GRACE_MS = 10_000;
6
7
  export function runChildren() {
7
8
  return { groups: new Set(), stoppers: new Set(), stopped: false };
8
9
  }
@@ -24,7 +25,25 @@ function stopAll(children, signal) {
24
25
  }
25
26
  export function stopRunChildren(children) {
26
27
  children.stopped = true;
28
+ const running = [...children.groups];
27
29
  stopAll(children, 'SIGINT');
30
+ escalate(running, ['SIGTERM', 'SIGKILL']);
31
+ }
32
+ function escalate(running, signals) {
33
+ const [signal, ...later] = signals;
34
+ if (signal === undefined || running.length === 0) {
35
+ return;
36
+ }
37
+ setTimeout(() => {
38
+ const left = running.filter((pid) => groups.has(pid));
39
+ for (const pid of left) {
40
+ try {
41
+ process.kill(-pid, signal);
42
+ }
43
+ catch { }
44
+ }
45
+ escalate(left, later);
46
+ }, STOP_GRACE_MS).unref();
28
47
  }
29
48
  export function runStopped() {
30
49
  return current.getStore()?.stopped === true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "14.4.14",
3
+ "version": "14.4.16",
4
4
  "description": "Autonomous issue harness driven by the Claude Agent SDK",
5
5
  "keywords": [
6
6
  "github",
@@ -100,7 +100,7 @@ Help the user understand why the worker handed an issue over, then answer the ha
100
100
 
101
101
  When it prints `no run is going in this repository`, ask only whether to start a run. On yes, run `next-issue start` in the background, such as with the `run_in_background` option of the Bash tool, since it goes on until the run ends, and tell the user that the run started. The run watches for new issues. On no, do nothing.
102
102
 
103
- When it prints `the run is stopping`, tell the user that the stopping run will not claim the issue. Ask no question.
103
+ When it prints `the run is stopping, so nothing was asked`, tell the user that the stopping run will not claim the issue. When it prints `the run is stopping for an upgrade`, tell the user that the run starts again on the newer worker and claims the issue then. Ask no question.
104
104
 
105
105
  When it prints `the run does not watch for new issues`, ask only whether to turn watching on. On yes, run `next-issue watch on`, then `next-issue refresh`, and tell the user what they print. On no, do nothing.
106
106
 
@@ -47,7 +47,7 @@ Turn the problem of the user into one GitHub issue, or a split of linked issues
47
47
 
48
48
  When it prints `no run is going in this repository`, give the user the url or urls and ask only whether to start a run. On yes, run `next-issue start` in the background, such as with the `run_in_background` option of the Bash tool, since it goes on until the run ends, and tell the user that the run started. The run watches for new issues. On no, do nothing.
49
49
 
50
- When it prints `the run is stopping`, give the user the url or urls and say that the stopping run will not claim the issue. Ask no question.
50
+ When it prints `the run is stopping, so nothing was asked`, give the user the url or urls and say that the stopping run will not claim the issue. When it prints `the run is stopping for an upgrade`, give the user the url or urls and say that the run starts again on the newer worker and claims the issue then. Ask no question.
51
51
 
52
52
  When it prints `the run does not watch for new issues`, give the user the url or urls and ask only whether to turn watching on. On yes, run `next-issue watch on`, then `next-issue refresh`, and tell the user what they print. On no, do nothing.
53
53