next-issue 7.8.27 → 7.8.29

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/dist/budget.mjs CHANGED
@@ -22,9 +22,10 @@ export async function refundBudget(job, budget) {
22
22
  await writeState(context.repo, state);
23
23
  }
24
24
  /** Gives the spent budget back if the process is killed (third Ctrl-C) while `body` runs. */
25
- export async function refundOnKill(job, budget, body) {
25
+ export async function refundOnKill(job, budget, body, undo) {
26
26
  const { context, state } = job;
27
27
  const forget = onKill(() => {
28
+ undo?.();
28
29
  state[budget] = Math.max(0, state[budget] - 1);
29
30
  writeStateNow(context.repo, state);
30
31
  });
package/dist/open-job.mjs CHANGED
@@ -7,8 +7,11 @@ export async function openJob(context, issue, log, state, start, handedOver, pen
7
7
  const { repo, config } = context;
8
8
  const branch = state.branch;
9
9
  await log.step('claim', { label: config.labels.inProgress }, async () => {
10
- await writeState(repo, state);
10
+ await writeState(repo, handedOver ? { ...state, ...handOverMark(pending) } : state);
11
11
  await setStatus(context, issue.number, config.labels.inProgress);
12
+ if (handedOver) {
13
+ await writeState(repo, state);
14
+ }
12
15
  });
13
16
  const comments = await log.step('comments', {}, () => writerComments(context, log, issue.number));
14
17
  const reply = handedOver
@@ -30,6 +33,9 @@ export async function openJob(context, issue, log, state, start, handedOver, pen
30
33
  asides: [],
31
34
  };
32
35
  }
36
+ function handOverMark(pending) {
37
+ return pending === undefined ? { handedOver: true } : { pendingHandOver: pending };
38
+ }
33
39
  async function openWorktree(context, issue, log, branch, start) {
34
40
  const { repo, config, ports } = context;
35
41
  const added = await log.step('worktree', { branch }, () => oneAtATime(repo.root, () => ports.addWorktree(repo, issue.number, branch, context.base, config.remote, start)));
package/dist/review.mjs CHANGED
@@ -52,7 +52,20 @@ async function changesRequestedRound(job, open, earlier) {
52
52
  const findings = formatFindings(open);
53
53
  state.reviewLog.push({ round: state.reviewRounds, findings });
54
54
  await writeState(job.context.repo, state);
55
- const fix = await fixRound(job, 'The reviewer requested changes.', findings, earlier, 'review');
55
+ const forget = () => {
56
+ state.reviewLog.pop();
57
+ };
58
+ let fix;
59
+ try {
60
+ fix = await refundOnKill(job, 'reviewRounds', () => fixRound(job, 'The reviewer requested changes.', findings, earlier, 'review'), forget);
61
+ }
62
+ catch (error) {
63
+ if (runStopped()) {
64
+ forget();
65
+ await refundBudget(job, 'reviewRounds');
66
+ }
67
+ throw error;
68
+ }
56
69
  if (!fix.committed) {
57
70
  return unfixedRound(job, fix);
58
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "7.8.27",
3
+ "version": "7.8.29",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",