next-issue 17.0.4 → 17.0.5

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.
@@ -66,11 +66,13 @@ export async function finishClosing(context, issue, log, state, started) {
66
66
  };
67
67
  return (await finishDone(job)).report;
68
68
  }
69
- export async function dropClosed(context, log, issue, branch) {
69
+ export async function dropClosed(context, log, issue, saved) {
70
70
  log.event('issue.drop', { title: issue.title, reason: 'closed' });
71
71
  try {
72
- await cleanUp(context, log, branch);
73
- await deleteBranches(context, log, branch);
72
+ if (openedOwnWorktree(saved)) {
73
+ await cleanUp(context, log, saved.branch);
74
+ await deleteBranches(context, log, saved.branch);
75
+ }
74
76
  await dropState(context.repo, issue.number);
75
77
  }
76
78
  catch (error) {
@@ -134,6 +136,9 @@ async function removeOrKeep(context, log, kind, fields, remove) {
134
136
  log.event(kind, fields);
135
137
  }
136
138
  }
139
+ function openedOwnWorktree(state) {
140
+ return state !== undefined && state.fresh !== true;
141
+ }
137
142
  async function cleanUp(context, log, branch) {
138
143
  const { repo, ports } = context;
139
144
  try {
@@ -207,7 +212,7 @@ export async function claimedError(context, log, issue, state, error, started) {
207
212
  log.event('hand-over.error', { error: message(failure) });
208
213
  }
209
214
  logIssueError(log, error, started);
210
- if (state.fresh !== true) {
215
+ if (openedOwnWorktree(state)) {
211
216
  await cleanUp(context, log, state.branch);
212
217
  }
213
218
  const report = {
@@ -1,7 +1,6 @@
1
1
  import { runStopped } from './children.mjs';
2
2
  import { elapsedMs } from './durations.mjs';
3
3
  import { message } from './errors.mjs';
4
- import { branchName } from './git.mjs';
5
4
  import { handOverReply } from './hand-over-comments.mjs';
6
5
  import { dropClosed, stopNow } from './handover.mjs';
7
6
  import { hasLabel } from './labels.mjs';
@@ -88,9 +87,7 @@ export async function closedReport(context, log, issue, saved, started) {
88
87
  catch (error) {
89
88
  return readError(log, issue, saved, error, started);
90
89
  }
91
- return open
92
- ? undefined
93
- : dropClosed(context, log, issue, saved?.branch ?? branchName(issue.number));
90
+ return open ? undefined : dropClosed(context, log, issue, saved);
94
91
  }
95
92
  /**
96
93
  * A person gave up on a halted issue: it never resumes to check the base while it has the skip label, so its halt
@@ -26,7 +26,7 @@ export async function processIssue(context, issue, slot) {
26
26
  // A hand-over takes a closing issue back: its resume may revert or add to the change.
27
27
  const closing = saved?.closing === true && !handedOver;
28
28
  if (issue.closed === true && !closing) {
29
- return dropClosed(context, log, issue, saved?.branch ?? branchName(issue.number));
29
+ return dropClosed(context, log, issue, saved);
30
30
  }
31
31
  const skip = closing
32
32
  ? undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "17.0.4",
3
+ "version": "17.0.5",
4
4
  "description": "Autonomous issue harness driven by the Claude Agent SDK",
5
5
  "keywords": [
6
6
  "github",