next-issue 6.6.78 → 6.6.80

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
@@ -53,7 +53,9 @@ the run handles one issue. For each issue:
53
53
  `status:in-progress` or `status:in-review` label. A `status:done`,
54
54
  `status:needs-human` or `status:blocked` label always stops the claim, a
55
55
  resume too, except a `status:needs-human` issue with an answer to its
56
- hand-over. An issue that GitHub lists as blocked by an open issue waits,
56
+ hand-over, and except an issue whose finish a stop cut short and that
57
+ was not handed over (see step 7 below). An issue that GitHub lists as
58
+ blocked by an open issue waits,
57
59
  because its blocker closes only when the change of the blocker lands.
58
60
  An issue with saved state under `.next-issue/` resumes instead, whatever its
59
61
  other labels and blockers.
@@ -171,10 +173,15 @@ the run handles one issue. For each issue:
171
173
  seconds after the others; a check that shows up in that time counts, and
172
174
  one that shows up later does not. A pending state
173
175
  waits again, up to `checkTimeoutMinutes`. A read that fails is tried three
174
- times. When the checks pass, the harness closes the issue and sets
175
- `status:done`, fetches the remote and fast-forwards the local base branch
176
- to the landed commit when that is safe, and the worktree, the local branch
177
- and the state file go away. A fetch that fails or a fast-forward that is
176
+ times. When the checks pass, the harness marks the state file as closing,
177
+ sets `status:done` and closes the issue. When a run stops or dies before
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
180
+ for another reason hands the issue over, and it then waits for a person
181
+ like any other hand-over. Then the harness fetches the remote and
182
+ fast-forwards the local base branch to the landed commit when that is
183
+ safe, and the worktree, the local branch and the state file go away. A
184
+ fetch that fails or a fast-forward that is
178
185
  not safe leaves the local base branch as it is and writes a `base.behind`
179
186
  event, and the issue is still done. When the checks fail, the harness
180
187
  reruns the failed GitHub Actions jobs once with
@@ -688,7 +695,8 @@ affect another. The worker:
688
695
  unknown argument with an `error` message;
689
696
  - sends every client the progress of every run when it connects and on every
690
697
  change: for each running issue the issue, the step, the tool count and the
691
- last tool, and the handled issues;
698
+ last tool, and the handled issues (an issue handled in more than one pass
699
+ appears once for each);
692
700
  - sends every client a `questions` message for each repository: the open
693
701
  issues with the `needsHuman` label, each with its number, title, the reason
694
702
  of the hand-over, the url of the comment that holds it, the `owner/name`
package/dist/handover.mjs CHANGED
@@ -28,11 +28,29 @@ 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);
31
33
  await setStatus(context, issue.number, context.config.labels.done);
32
34
  await context.ports.closeIssue(context.repo, issue.number);
33
35
  await updateLocalBase(job);
34
36
  return { done: true, report: await finish(job, 'done') };
35
37
  }
38
+ export async function finishClosing(context, issue, log, state, started) {
39
+ const job = {
40
+ context,
41
+ issue,
42
+ log,
43
+ state,
44
+ branch: state.branch,
45
+ worktree: '',
46
+ comments: [],
47
+ reply: [],
48
+ started,
49
+ mainBroken: false,
50
+ repairing: false,
51
+ };
52
+ return (await finishDone(job)).report;
53
+ }
36
54
  async function updateLocalBase(job) {
37
55
  const { context, log } = job;
38
56
  const { repo, ports, config, base } = context;
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, stop, stopNow } from './handover.mjs';
4
+ import { claimedError, 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';
@@ -19,7 +19,8 @@ export async function processIssue(context, issue, claimed = () => undefined) {
19
19
  catch (error) {
20
20
  return unclaimedError(log, issue, error, started);
21
21
  }
22
- const skip = await skipReport(context, log, issue, saved, started);
22
+ const closing = saved?.closing === true && saved.handedOver !== true;
23
+ const skip = closing ? undefined : await skipReport(context, log, issue, saved, started);
23
24
  if (skip !== undefined) {
24
25
  return skip;
25
26
  }
@@ -28,7 +29,9 @@ export async function processIssue(context, issue, claimed = () => undefined) {
28
29
  const state = startState(context, issue, saved);
29
30
  let report;
30
31
  try {
31
- report = await work(context, issue, log, state, saved === undefined, saved?.handedOver === true);
32
+ report = closing
33
+ ? await finishClosing(context, issue, log, state, started)
34
+ : await work(context, issue, log, state, saved === undefined, saved?.handedOver === true);
32
35
  }
33
36
  catch (error) {
34
37
  if (!runStopped()) {
package/dist/progress.mjs CHANGED
@@ -39,8 +39,7 @@ function change(progress, issue, update) {
39
39
  };
40
40
  }
41
41
  function addHandled(handled, issue, outcome) {
42
- const repeated = handled.some((item) => item.issue === issue && item.outcome === outcome);
43
- return !repeated && (outcome === 'done' || outcome === 'needs-human' || outcome === 'error')
42
+ return outcome === 'done' || outcome === 'needs-human' || outcome === 'error'
44
43
  ? [...handled, { issue, outcome }]
45
44
  : handled;
46
45
  }
package/dist/state.mjs CHANGED
@@ -65,7 +65,8 @@ function isState(value) {
65
65
  typeof value.reviewRounds === 'number' &&
66
66
  Array.isArray(value.reviewLog) &&
67
67
  value.reviewLog.every(isReviewRound) &&
68
- isOptional(value.handedOver, 'boolean'));
68
+ isOptional(value.handedOver, 'boolean') &&
69
+ isOptional(value.closing, 'boolean'));
69
70
  }
70
71
  export async function savedIssues(repo) {
71
72
  const names = (await unlessMissing(() => readdir(stateDir(repo.root)))) ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.78",
3
+ "version": "6.6.80",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",