next-issue 6.6.81 → 6.6.83

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
@@ -176,7 +176,11 @@ the run handles one issue. For each issue:
176
176
  times. When the checks pass, the harness marks the state file as closing,
177
177
  sets `status:done` and closes the issue. When a run stops or dies before
178
178
  the close, the next run sees the mark, sets `status:done` and closes the
179
- issue, with no new push, revert or hand-over. A label or close that fails
179
+ issue, with no new push, revert or hand-over. When a run stops or dies
180
+ after the close, before the state file goes away, the next run finds the
181
+ closed issue through its state file and removes the worktree, the local
182
+ branches and the state file, with no new push, revert, label, close or
183
+ hand-over. A label or close that fails
180
184
  for another reason hands the issue over, and it then waits for a person
181
185
  like any other hand-over. Then the harness fetches the remote and
182
186
  fast-forwards the local base branch to the landed commit when that is
@@ -598,6 +602,17 @@ The `--reset` flag does the same for any issue that the run handles, whether or
598
602
  not it was handed over. It touches only an issue that the run handles, so the
599
603
  state of an issue that a label still holds back stays as it was.
600
604
 
605
+ To drop an issue instead, close it. The next run that finds a saved state for an
606
+ issue that a person closed removes that state file, the `<n>` branch, the
607
+ `<n>-dispute-*` branches and the worktree of the issue. This holds for an issue
608
+ that waits for a person and for one that a stop left behind. The run starts no
609
+ agent and makes no push, revert, label change, close or comment, so a change
610
+ that already landed stays on the base branch. A worktree or branch that cannot be
611
+ removed stays, and the run log says so. The issue shows as `skipped` (`closed`)
612
+ in the summary and does not count for `--max` or `--once`. A `--watch` run does
613
+ not claim an issue again once it ended in `error` in that run, so it leaves such
614
+ an issue for the next run to clean up.
615
+
601
616
  ## Commands and options
602
617
 
603
618
  | Argument | Effect |
package/dist/handover.mjs CHANGED
@@ -28,10 +28,12 @@ export async function escalateAndFinish(job, note, reason) {
28
28
  }
29
29
  export async function finishDone(job) {
30
30
  const { context, issue } = job;
31
- job.state.closing = true;
32
- await writeState(context.repo, job.state);
33
- await setStatus(context, issue.number, context.config.labels.done);
34
- await context.ports.closeIssue(context.repo, issue.number);
31
+ if (issue.closed !== true) {
32
+ job.state.closing = true;
33
+ await writeState(context.repo, job.state);
34
+ await setStatus(context, issue.number, context.config.labels.done);
35
+ await context.ports.closeIssue(context.repo, issue.number);
36
+ }
35
37
  await updateLocalBase(job);
36
38
  return { done: true, report: await finish(job, 'done') };
37
39
  }
@@ -51,6 +53,25 @@ export async function finishClosing(context, issue, log, state, started) {
51
53
  };
52
54
  return (await finishDone(job)).report;
53
55
  }
56
+ export async function dropClosed(context, log, issue, branch) {
57
+ log.event('issue.drop', { title: issue.title, reason: 'closed' }, 'quiet');
58
+ try {
59
+ await cleanUp(context, log, branch);
60
+ await deleteBranches(context, log, branch);
61
+ await dropState(context.repo, issue.number);
62
+ }
63
+ catch (error) {
64
+ log.event('drop.error', { error: message(error) }, 'quiet');
65
+ }
66
+ return {
67
+ issue: issue.number,
68
+ outcome: 'skipped',
69
+ reason: 'closed',
70
+ ciFixes: 0,
71
+ reviewRounds: 0,
72
+ ms: 0,
73
+ };
74
+ }
54
75
  async function updateLocalBase(job) {
55
76
  const { context, log } = job;
56
77
  const { repo, ports, config, base } = context;
package/dist/pending.mjs CHANGED
@@ -33,7 +33,7 @@ async function savedIssue(context, number) {
33
33
  if (saved === 'broken' || open) {
34
34
  return { open, issue };
35
35
  }
36
- return { open };
36
+ return { open, issue: { ...issue, closed: true } };
37
37
  }
38
38
  catch (error) {
39
39
  context.recorder
package/dist/pipeline.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { enterReview } from './enter-review.mjs';
2
2
  import { branchName } from './git.mjs';
3
3
  import { runStopped } from './children.mjs';
4
- import { claimedError, finishClosing, stop, stopNow } from './handover.mjs';
4
+ import { claimedError, dropClosed, finishClosing, stop, stopNow } from './handover.mjs';
5
5
  import { implement } from './implement.mjs';
6
6
  import { openJob } from './open-job.mjs';
7
7
  import { reviewRound } from './review.mjs';
@@ -20,6 +20,9 @@ export async function processIssue(context, issue, claimed = () => undefined) {
20
20
  return unclaimedError(log, issue, error, started);
21
21
  }
22
22
  const closing = saved?.closing === true && saved.handedOver !== true;
23
+ if (issue.closed === true && !closing) {
24
+ return dropClosed(context, log, issue, saved?.branch ?? branchName(issue.number));
25
+ }
23
26
  const skip = closing ? undefined : await skipReport(context, log, issue, saved, started);
24
27
  if (skip !== undefined) {
25
28
  return skip;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.81",
3
+ "version": "6.6.83",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",