next-issue 6.6.124 → 6.6.125

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
@@ -190,7 +190,9 @@ the run handles one issue. For each issue:
190
190
  file as closing, sets `status:done` and closes the issue. When a run
191
191
  stops or dies before the close, the next run sees the mark, sets
192
192
  `status:done` and closes the issue, with no new push, revert or
193
- hand-over. When a run stops or dies after the close, before the state
193
+ hand-over. A hand-over clears the mark, so an issue taken back after
194
+ a failed label edit or close is resumed, not closed, by later runs.
195
+ When a run stops or dies after the close, before the state
194
196
  file goes away, the next run finds the closed issue through its state
195
197
  file and removes the worktree, the local branches and the state file,
196
198
  with no new push, revert, label, close or hand-over. A label or close
package/dist/handover.mjs CHANGED
@@ -144,6 +144,8 @@ async function handOver(context, log, issue, state, reason, earlier) {
144
144
  const { repo, ports, config } = context;
145
145
  log.event('hand-over', { reason }, 'quiet');
146
146
  const { pendingHandOver: _pending, ...rest } = state;
147
+ // Once the label is on, the issue is taken back from a close (`finishDone`) it may have reached.
148
+ const { closing: _closing, ...taken } = rest;
147
149
  let pending = earlier;
148
150
  try {
149
151
  // A retry keeps the thread time and the labelled mark of its earlier try.
@@ -152,13 +154,13 @@ async function handOver(context, log, issue, state, reason, earlier) {
152
154
  await writeState(repo, { ...rest, pendingHandOver: pending });
153
155
  await setStatus(context, issue, config.labels.needsHuman);
154
156
  pending = { ...pending, labelled: true };
155
- await writeState(repo, { ...rest, pendingHandOver: pending });
157
+ await writeState(repo, { ...taken, pendingHandOver: pending });
156
158
  await ports.commentOnIssue(repo, issue, handOverComment(reason));
157
159
  }
158
160
  catch (error) {
159
161
  throw new HandOverFailed(reason, error, pending);
160
162
  }
161
- await writeState(repo, { ...rest, handedOver: true });
163
+ await writeState(repo, { ...taken, handedOver: true });
162
164
  }
163
165
  class HandOverFailed extends Error {
164
166
  reason;
package/dist/pipeline.mjs CHANGED
@@ -21,7 +21,9 @@ export async function processIssue(context, issue, claimed = () => undefined) {
21
21
  catch (error) {
22
22
  return unclaimedError(log, issue, error, started);
23
23
  }
24
- const closing = saved?.closing === true && saved.handedOver !== true;
24
+ const handedOver = wasHandedOver(context, issue, saved);
25
+ // A hand-over takes a closing issue back: its resume may revert or add to the change.
26
+ const closing = saved?.closing === true && !handedOver;
25
27
  if (issue.closed === true && !closing) {
26
28
  return dropClosed(context, log, issue, saved?.branch ?? branchName(issue.number));
27
29
  }
@@ -31,7 +33,6 @@ export async function processIssue(context, issue, claimed = () => undefined) {
31
33
  }
32
34
  claimed();
33
35
  log.event('issue.start', { title: issue.title, createdAt: issue.createdAt }, 'quiet');
34
- const handedOver = wasHandedOver(context, issue, saved);
35
36
  const state = startState(context, issue, saved, handedOver);
36
37
  let report;
37
38
  try {
package/dist/state.mjs CHANGED
@@ -85,11 +85,15 @@ export async function savedIssues(repo) {
85
85
  export function newState(issue, branch) {
86
86
  return { issue, phase: 'claimed', branch, ciFixes: 0, reviewRounds: 0, reviewLog: [] };
87
87
  }
88
- /** Drops the budgets and findings; a hand-over (`handedOver`) also cancels an approval. */
88
+ /**
89
+ * Drops the budgets and findings; a hand-over (`handedOver`) also cancels an approval and the closing mark,
90
+ * so a resume that stops before it finishes is resumed again rather than closed as done.
91
+ */
89
92
  export function resetState(state, handedOver = false) {
90
- const { handedOver: _handedOver, pendingHandOver: _pending, ...rest } = state;
93
+ const { handedOver: _handedOver, pendingHandOver: _pending, closing, ...rest } = state;
91
94
  const phase = handedOver && rest.phase === 'approved' ? 'review' : rest.phase;
92
- return { ...rest, phase, ciFixes: 0, commitFixes: 0, reviewRounds: 0, reviewLog: [] };
95
+ const kept = !handedOver && closing !== undefined ? { closing } : {};
96
+ return { ...rest, ...kept, phase, ciFixes: 0, commitFixes: 0, reviewRounds: 0, reviewLog: [] };
93
97
  }
94
98
  export async function writeState(repo, state) {
95
99
  await mkdir(stateDir(repo.root), { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.124",
3
+ "version": "6.6.125",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",