next-issue 6.6.112 → 6.6.113

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
@@ -385,10 +385,12 @@ Press `Ctrl-C` to stop the run step by step:
385
385
  branch that this press kills before any job restarted runs again in the
386
386
  next run, before any fixer.
387
387
 
388
- `SIGTERM` to a command-line run while a command runs, and `SIGTERM` or
389
- `SIGINT` to the worker (as `next-issue stop` sends), act like the third
390
- press: they give back the review round, the check fix and the rerun in the
391
- same way.
388
+ `SIGTERM` to a command-line run while a command or an agent runs, and
389
+ `SIGTERM` or `SIGINT` to the worker (as `next-issue stop` sends), act like
390
+ the third press: they stop the running harness commands and agents, with
391
+ the commands the agents started, and give back the review round, the check
392
+ fix and the rerun in the same way. When nothing runs, `SIGTERM` ends a
393
+ command-line run at once.
392
394
 
393
395
  When the reviewer approved the change and the run stopped before its
394
396
  commit reached the base branch, the next run drops those edits and any
package/dist/children.mjs CHANGED
@@ -39,11 +39,13 @@ export function refuseWhenStopped() {
39
39
  }
40
40
  export function onStop(stopper) {
41
41
  const children = current.getStore();
42
+ guard();
42
43
  stoppers.add(stopper);
43
44
  children?.stoppers.add(stopper);
44
45
  return () => {
45
46
  stoppers.delete(stopper);
46
47
  children?.stoppers.delete(stopper);
48
+ unguard();
47
49
  };
48
50
  }
49
51
  /** Runs `undo` (synchronously) if the process is killed, for a step the kill leaves unsettled. */
@@ -66,13 +68,22 @@ export function stopChildren(signal) {
66
68
  process.kill(process.pid, signal);
67
69
  }
68
70
  const onTerminate = () => stopChildren('SIGTERM');
71
+ /** Handles `SIGTERM` while a command or an agent runs, so its process group is stopped too. */
72
+ function guard() {
73
+ if (groups.size === 0 && stoppers.size === 0) {
74
+ process.on('SIGTERM', onTerminate);
75
+ }
76
+ }
77
+ function unguard() {
78
+ if (groups.size === 0 && stoppers.size === 0) {
79
+ process.off('SIGTERM', onTerminate);
80
+ }
81
+ }
69
82
  export function watch(pid) {
70
83
  if (pid === undefined) {
71
84
  return () => undefined;
72
85
  }
73
- if (groups.size === 0) {
74
- process.on('SIGTERM', onTerminate);
75
- }
86
+ guard();
76
87
  groups.add(pid);
77
88
  const children = current.getStore();
78
89
  children?.groups.add(pid);
@@ -83,9 +94,7 @@ export function watch(pid) {
83
94
  }
84
95
  function unwatch(pid) {
85
96
  groups.delete(pid);
86
- if (groups.size === 0) {
87
- process.off('SIGTERM', onTerminate);
88
- }
97
+ unguard();
89
98
  }
90
99
  export function killTree(child) {
91
100
  if (child.pid === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.112",
3
+ "version": "6.6.113",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",