next-issue 6.6.114 → 6.6.116

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
@@ -285,14 +285,13 @@ and comments the reason on the issue, when:
285
285
  `<n>` branch when the issue is done;
286
286
  - a fixer disputes or settles the findings and leaves a change behind, either
287
287
  in the worktree or in a commit of its own. A dispute carries a reason, not a
288
- diff, so the harness throws none of it away: an unclean worktree stays on
289
- the disk, and a commit of the fixer moves to a new local
290
- `<n>-dispute-<commit>` branch, so the `<n>` branch keeps only what will
291
- land. The worktree drops the change of that commit, unless the fixer edited
292
- the worktree after the commit: then the worktree keeps both and stays on the
293
- disk. Neither lands. The issue holds the reason of the dispute, and the
294
- change is on the machine that ran the harness. The `<n>-dispute-<commit>`
295
- branches go away with the `<n>` branch when the issue is done;
288
+ diff, and a retry of the issue cleans the worktree before the next review,
289
+ so the change does not stay there: its edits are committed with no hooks on
290
+ top of any commit of its own, that commit moves to a new local
291
+ `<n>-dispute-<commit>` branch, and the hand-over comment names that branch.
292
+ The `<n>` branch keeps only what will land, and the reviewer of a retry sees
293
+ none of the change. Neither lands. The `<n>-dispute-<commit>` branches go
294
+ away with the `<n>` branch when the issue is done;
296
295
  - the reviewer gives no verdict, or the checks do not finish in time;
297
296
  - the push to the base branch fails three times;
298
297
  - the checks on the base branch fail and the fixer cannot fix them, an error
@@ -391,12 +390,13 @@ Press `Ctrl-C` to stop the run step by step:
391
390
  branch that this press kills before any job restarted runs again in the
392
391
  next run, before any fixer.
393
392
 
394
- `SIGTERM` to a command-line run while a command or an agent runs, and
395
- `SIGTERM` or `SIGINT` to the worker (as `next-issue stop` sends), act like
393
+ `SIGTERM` or `SIGHUP` (its terminal or ssh session closes) to a
394
+ command-line run while a command or an agent runs, and `SIGTERM`, `SIGHUP`
395
+ or `SIGINT` to the worker (`next-issue stop` sends `SIGTERM`), act like
396
396
  the third press: they stop the running harness commands and agents, with
397
397
  the commands the agents started, and give back the review round, the check
398
- fix and the rerun in the same way. When nothing runs, `SIGTERM` ends a
399
- command-line run at once.
398
+ fix and the rerun in the same way. When nothing runs, `SIGTERM` or `SIGHUP`
399
+ ends a command-line run at once.
400
400
 
401
401
  When the reviewer approved the change and the run stopped before its
402
402
  commit reached the base branch, the next run drops those edits and any
@@ -831,7 +831,7 @@ affect another. The worker:
831
831
  holds it;
832
832
  - closes once no run is going when a client with a newer version connects, so
833
833
  that the client can start the newer worker;
834
- - stops every agent and command and exits on `SIGTERM` or `SIGINT`, and
834
+ - stops every agent and command and exits on `SIGTERM`, `SIGHUP` or `SIGINT`, and
835
835
  removes its socket and lock files;
836
836
  - keeps `.next-issue/worker.log`, where the extension writes the output of
837
837
  the worker, within 10 MiB: when it starts and once a minute while it runs,
package/dist/children.mjs CHANGED
@@ -65,18 +65,25 @@ export function stopChildren(signal) {
65
65
  }
66
66
  undos.clear();
67
67
  process.off('SIGTERM', onTerminate);
68
+ process.off('SIGHUP', onHangUp);
68
69
  process.kill(process.pid, signal);
69
70
  }
70
71
  const onTerminate = () => stopChildren('SIGTERM');
71
- /** Handles `SIGTERM` while a command or an agent runs, so its process group is stopped too. */
72
+ const onHangUp = () => stopChildren('SIGHUP');
73
+ /**
74
+ * Handles `SIGTERM` and `SIGHUP` (a closed terminal) while a command or an agent runs,
75
+ * so its process group is stopped too.
76
+ */
72
77
  function guard() {
73
78
  if (groups.size === 0 && stoppers.size === 0) {
74
79
  process.on('SIGTERM', onTerminate);
80
+ process.on('SIGHUP', onHangUp);
75
81
  }
76
82
  }
77
83
  function unguard() {
78
84
  if (groups.size === 0 && stoppers.size === 0) {
79
85
  process.off('SIGTERM', onTerminate);
86
+ process.off('SIGHUP', onHangUp);
80
87
  }
81
88
  }
82
89
  export function watch(pid) {
package/dist/fix.mjs CHANGED
@@ -15,7 +15,7 @@ export function escalateCheckFix(job, unrelated, checks, after = '', aside) {
15
15
  }
16
16
  return escalateAndFinish(job, `The ${checks} fail for a reason this change did not cause: ${unrelated}${savedIn(aside)}${after}`, 'unrelated failure');
17
17
  }
18
- function savedIn(aside) {
18
+ export function savedIn(aside) {
19
19
  return aside === undefined
20
20
  ? ''
21
21
  : ` The fixer left a change behind; it is saved in the branch \`${aside}\`.`;
@@ -62,20 +62,16 @@ function fixBudget(job, kind) {
62
62
  async function disputedFix(job, before, reason, note, kind) {
63
63
  const { context, issue, log, worktree, branch } = job;
64
64
  const { ports } = context;
65
- // The revert after a failed check reuses this worktree, so edits left there would be lost.
66
- const saved = kind === 'checks' &&
67
- (await ports.saveEdits(worktree, `fix: edits left by the check fixer\n\nRefs #${issue.number}`));
65
+ // A retry or the revert after a failed check cleans this worktree, so edits left there would be lost.
66
+ const saved = await ports.saveEdits(worktree, `fix: edits left by the ${kind === 'checks' ? 'check' : 'review'} fixer\n\nRefs #${issue.number}`);
68
67
  const disputed = await ports.revision(worktree);
69
- const moved = disputed !== before;
70
- if (moved) {
71
- const aside = `${branch}-dispute-${disputed.slice(0, 7)}`;
72
- await ports.setAside(worktree, before, aside);
73
- log.event('fix.aside', { branch: aside, saved }, 'quiet');
74
- if (kind === 'checks') {
75
- return disputedNote(job, reason, note, { stray: true, aside });
76
- }
68
+ if (disputed === before) {
69
+ return disputedNote(job, reason, note, { stray: false });
77
70
  }
78
- return disputedNote(job, reason, note, { stray: moved || (await ports.isDirty(worktree)) });
71
+ const aside = `${branch}-dispute-${disputed.slice(0, 7)}`;
72
+ await ports.setAside(worktree, before, aside);
73
+ log.event('fix.aside', { branch: aside, saved }, 'quiet');
74
+ return disputedNote(job, reason, note, { stray: true, aside });
79
75
  }
80
76
  function disputedNote(job, reason, note, left) {
81
77
  const event = 'unrelated' in note ? 'fix.unrelated' : 'fix.resolved';
package/dist/review.mjs CHANGED
@@ -2,7 +2,7 @@ import { REVIEWING } from './agents.mjs';
2
2
  import { runStopped } from './children.mjs';
3
3
  import { budgetUse, refundBudget, refundOnKill, spendBudget } from './budget.mjs';
4
4
  import { message } from './errors.mjs';
5
- import { fixRound } from './fix.mjs';
5
+ import { fixRound, savedIn } from './fix.mjs';
6
6
  import { escalateAndFinish } from './handover.mjs';
7
7
  import { ROUND_CONTINUE, runRole, setStatus } from './job.mjs';
8
8
  import { landApproved } from './land.mjs';
@@ -119,7 +119,7 @@ async function unfixedRound(job, fix) {
119
119
  return escalateAndFinish(job, 'The fixer added no commit for the review findings.', 'no fix commit');
120
120
  }
121
121
  if (fix.stray === true) {
122
- return escalateAndFinish(job, `The fixer ${fix.unrelated === undefined ? 'settled' : 'disputed'} the findings and left a change behind: ${note}`, 'dispute with changes');
122
+ return escalateAndFinish(job, `The fixer ${fix.unrelated === undefined ? 'settled' : 'disputed'} the findings: ${note}${savedIn(fix.aside)}`, 'dispute with changes');
123
123
  }
124
124
  const round = state.reviewLog.at(-1);
125
125
  if (fix.unrelated === undefined) {
package/dist/serve.mjs CHANGED
@@ -157,13 +157,16 @@ export async function serve(root, logCheckMs = LOG_CHECK_MS) {
157
157
  const end = (signal) => {
158
158
  process.off('SIGTERM', onTerminate);
159
159
  process.off('SIGINT', onInterrupt);
160
+ process.off('SIGHUP', onHangUp);
160
161
  worker.release();
161
162
  stopChildren(signal);
162
163
  };
163
164
  const onTerminate = () => end('SIGTERM');
164
165
  const onInterrupt = () => end('SIGINT');
166
+ const onHangUp = () => end('SIGHUP');
165
167
  process.on('SIGTERM', onTerminate);
166
168
  process.on('SIGINT', onInterrupt);
169
+ process.on('SIGHUP', onHangUp);
167
170
  process.stderr.write(`next-issue: worker listening on ${paths.socketPath}\n`);
168
171
  await worker.closed;
169
172
  stopTrimming();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.114",
3
+ "version": "6.6.116",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",