next-issue 6.6.90 → 6.6.92

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
@@ -323,7 +323,9 @@ Press `Ctrl-C` to stop the run step by step:
323
323
  starts, so the reviewer sees only the commits of the branch. Files that
324
324
  git ignores, such as build output, stay. When it
325
325
  resumes before the first commit, the implementer runs again and the
326
- commit holds them.
326
+ commit holds them. A review round or a check fix whose reviewer or
327
+ fixer this press kills does not count, so the next run runs that step
328
+ again with the same budget.
327
329
 
328
330
  When the reviewer approved the change and the run stopped before its
329
331
  commit reached the base branch, the next run drops those edits and any
@@ -593,7 +595,10 @@ that still has the label is not claimed, unless it has an answer to the
593
595
  hand-over: then the run claims it and takes the label off. When the label of a
594
596
  hand-over reaches GitHub but its comment does not, an answer to an earlier
595
597
  hand-over does not count: the issue waits, and the worker lists it, until a
596
- person takes the label off or a writer comments after that hand-over.
598
+ person takes the label off or a writer comments after that hand-over. Either
599
+ way, the next run that claims it counts it as a hand-over: it puts the budgets
600
+ and the findings back to zero and passes on the comments posted after it. When
601
+ the label edit itself fails, the next run keeps the budgets and the findings.
597
602
 
598
603
  To give guidance, answer the hand-over with a comment on the issue. When the run
599
604
  resumes the issue, it reads the comments posted after its last
package/dist/budget.mjs CHANGED
@@ -15,3 +15,8 @@ export async function spendBudget(job, budget, note, reason, beforeHandOver) {
15
15
  await writeState(context.repo, state);
16
16
  return undefined;
17
17
  }
18
+ export async function refundBudget(job, budget) {
19
+ const { context, state } = job;
20
+ state[budget] = Math.max(0, state[budget] - 1);
21
+ await writeState(context.repo, state);
22
+ }
package/dist/gate.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { budgetUse } from './budget.mjs';
1
+ import { budgetUse, refundBudget } from './budget.mjs';
2
2
  import { checkWaiting } from './check-poll.mjs';
3
3
  import { runStopped } from './children.mjs';
4
4
  import { asError, message } from './errors.mjs';
@@ -85,6 +85,7 @@ async function failedChecksFix(job, sha) {
85
85
  logs = await ports.failedBaseLogs(repo, sha, base, config.logMaxChars);
86
86
  }
87
87
  catch (error) {
88
+ await refundStopped(job);
88
89
  return escalateError(job, error, `The read of the failed checks on ${base} failed`, 'logs error');
89
90
  }
90
91
  log.event('main-checks.logs', { chars: logs.length });
@@ -93,6 +94,7 @@ async function failedChecksFix(job, sha) {
93
94
  fix = await fixRound(job, `The checks on ${base} failed after the change landed there.`, logs, [], 'checks');
94
95
  }
95
96
  catch (error) {
97
+ await refundStopped(job);
96
98
  return escalateError(job, error, `The fixer for the failed checks on ${base} failed`, 'fixer error');
97
99
  }
98
100
  if (!fix.committed) {
@@ -102,6 +104,11 @@ async function failedChecksFix(job, sha) {
102
104
  job.repairing = true;
103
105
  return GATE_FIXED;
104
106
  }
107
+ async function refundStopped(job) {
108
+ if (runStopped()) {
109
+ await refundBudget(job, 'ciFixes');
110
+ }
111
+ }
105
112
  export async function escalateError(job, error, note, reason) {
106
113
  if (runStopped()) {
107
114
  throw error;
package/dist/handover.mjs CHANGED
@@ -145,11 +145,10 @@ async function handOver(context, log, issue, state, reason) {
145
145
  const { pendingHandOver: _pending, ...rest } = state;
146
146
  try {
147
147
  const since = await threadEnd(context, issue);
148
- await writeState(repo, {
149
- ...rest,
150
- pendingHandOver: { reason, ...(since === undefined ? {} : { since }) },
151
- });
148
+ const pending = { reason, ...(since === undefined ? {} : { since }) };
149
+ await writeState(repo, { ...rest, pendingHandOver: pending });
152
150
  await setStatus(context, issue, config.labels.needsHuman);
151
+ await writeState(repo, { ...rest, pendingHandOver: { ...pending, labelled: true } });
153
152
  await ports.commentOnIssue(repo, issue, handOverComment(reason));
154
153
  }
155
154
  catch (error) {
package/dist/pipeline.mjs CHANGED
@@ -47,12 +47,17 @@ export async function processIssue(context, issue, claimed = () => undefined) {
47
47
  log.event('issue.end', { outcome: report.outcome, reason: report.reason, ms: report.ms }, 'quiet');
48
48
  return report;
49
49
  }
50
- /** A hand-over whose comment failed counts once the issue is claimed with its label still on, that is with an answer. */
50
+ /**
51
+ * A hand-over whose comment failed counts once its label reached GitHub (a person who takes it off retries),
52
+ * or once the issue is claimed with its label still on, that is with an answer.
53
+ */
51
54
  function wasHandedOver(context, issue, saved) {
52
55
  if (saved?.handedOver === true) {
53
56
  return true;
54
57
  }
55
- return (saved?.pendingHandOver !== undefined && hasLabel(issue.labels, context.config.labels.needsHuman));
58
+ const pending = saved?.pendingHandOver;
59
+ return (pending !== undefined &&
60
+ (pending.labelled === true || hasLabel(issue.labels, context.config.labels.needsHuman)));
56
61
  }
57
62
  function startState(context, issue, saved, handedOver) {
58
63
  if (saved === undefined) {
package/dist/review.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { REVIEWING } from './agents.mjs';
2
2
  import { runStopped } from './children.mjs';
3
- import { budgetUse, spendBudget } from './budget.mjs';
3
+ import { budgetUse, refundBudget, spendBudget } from './budget.mjs';
4
4
  import { message } from './errors.mjs';
5
5
  import { fixRound } from './fix.mjs';
6
6
  import { escalateAndFinish } from './handover.mjs';
@@ -18,9 +18,19 @@ export async function reviewRound(job) {
18
18
  if (exhausted) {
19
19
  return exhausted;
20
20
  }
21
- await setStatus(context, issue.number, config.labels.inReview);
22
21
  const earlier = history(state.reviewLog);
23
- const verdict = parseVerdict(await runReviewer(job, earlier));
22
+ let text;
23
+ try {
24
+ await setStatus(context, issue.number, config.labels.inReview);
25
+ text = await runReviewer(job, earlier);
26
+ }
27
+ catch (error) {
28
+ if (runStopped()) {
29
+ await refundBudget(job, 'reviewRounds');
30
+ }
31
+ throw error;
32
+ }
33
+ const verdict = parseVerdict(text);
24
34
  if (verdict === undefined) {
25
35
  return escalateAndFinish(job, 'The reviewer gave no verdict.', 'no verdict');
26
36
  }
package/dist/state.mjs CHANGED
@@ -46,7 +46,10 @@ function isReviewRound(value) {
46
46
  isOptional(value.settled, 'string'));
47
47
  }
48
48
  function isPending(value) {
49
- return isRecord(value) && typeof value.reason === 'string' && isOptional(value.since, 'string');
49
+ return (isRecord(value) &&
50
+ typeof value.reason === 'string' &&
51
+ isOptional(value.since, 'string') &&
52
+ isOptional(value.labelled, 'boolean'));
50
53
  }
51
54
  function isState(value) {
52
55
  return (isRecord(value) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.90",
3
+ "version": "6.6.92",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",