next-issue 7.8.21 → 7.8.23

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
@@ -360,7 +360,9 @@ and comments the reason on the issue, when:
360
360
  in a file that the change added or changed is never unrelated: when the
361
361
  failed logs name such a file (by its path, or by a tail of its path that
362
362
  keeps a folder), the harness refuses the claim and gives the fixer another
363
- round from `maxCiFixes`, with a note that names the file;
363
+ round from `maxCiFixes`, with a note that names the file. A later hand-over
364
+ comment of the same run, such as for a fix that fails its checks too or
365
+ fails to land, still names the dispute branch of each refused round;
364
366
  - a fixer disputes or settles the findings and leaves a change behind, either
365
367
  in the worktree or in a commit of its own. A dispute carries a reason, not a
366
368
  diff, and a retry of the issue cleans the worktree before the next review,
@@ -938,7 +940,8 @@ affect another. The worker:
938
940
  ends, and when a client sends `{ "type": "questions", "root": "<path>" }`.
939
941
  An issue that no longer has the label leaves the list, and so does an issue
940
942
  whose hand-over has an answer from a writer, the same answer that lets a run
941
- claim it. An issue with the
943
+ claim it. An issue that a person holds with the label stays in the list,
944
+ even when an earlier hand-over has an answer. An issue with the
942
945
  label but no hand-over comment is in the list with an empty reason and url.
943
946
  The issues are read one at a time. A client never gets an older list after
944
947
  a newer one. When the client adds an `"id"` to its message, the list that
package/dist/fix.mjs CHANGED
@@ -9,16 +9,11 @@ import { fallbackTitle, runRole } from './job.mjs';
9
9
  import { fixPrompt, hookPrompt } from './prompts.mjs';
10
10
  import { writeState } from './state.mjs';
11
11
  import { keepTail } from './text.mjs';
12
- export function escalateCheckFix(job, unrelated, checks, after = '', aside) {
12
+ export function escalateCheckFix(job, unrelated, checks, after = '') {
13
13
  if (unrelated === undefined) {
14
14
  return escalateAndFinish(job, `The fixer added no commit for the failed ${checks}.${after}`, 'no fix commit');
15
15
  }
16
- return escalateAndFinish(job, `The ${checks} fail for a reason this change did not cause: ${unrelated}${savedIn(aside)}${after}`, 'unrelated failure');
17
- }
18
- export function savedIn(aside) {
19
- return aside === undefined
20
- ? ''
21
- : ` The fixer left a change behind; it is saved in the branch \`${aside}\`.`;
16
+ return escalateAndFinish(job, `The ${checks} fail for a reason this change did not cause: ${unrelated}${after}`, 'unrelated failure');
22
17
  }
23
18
  export async function fixRound(job, reason, detail, earlier, kind) {
24
19
  const { context, issue, log, worktree } = job;
@@ -71,6 +66,7 @@ async function disputedFix(job, before, reason, note, kind) {
71
66
  }
72
67
  const aside = `${branch}-dispute-${disputed.slice(0, 7)}`;
73
68
  await ports.setAside(worktree, before, aside);
69
+ job.asides.push(aside);
74
70
  log.event('fix.aside', { branch: aside, saved }, 'quiet');
75
71
  return disputedNote(job, reason, note, { stray: true, aside });
76
72
  }
package/dist/gate.mjs CHANGED
@@ -136,7 +136,7 @@ async function failedChecksFix(job, sha, refused) {
136
136
  }
137
137
  if (!fix.committed) {
138
138
  const reverted = await revertFailedChecks(job);
139
- return escalateCheckFix(job, fix.unrelated, `checks on ${base}`, reverted, fix.aside);
139
+ return escalateCheckFix(job, fix.unrelated, `checks on ${base}`, reverted);
140
140
  }
141
141
  job.repairing = true;
142
142
  return GATE_FIXED;
@@ -1,5 +1,5 @@
1
1
  import { repoArg } from './gh.mjs';
2
- import { readState } from './state.mjs';
2
+ import { heldByPerson, readState } from './state.mjs';
3
3
  export const HAND_OVER = 'next-issue needs help:';
4
4
  const HARNESS_HEADINGS = [HAND_OVER, '### Review:', '### Fixer:'];
5
5
  function fromHarness(comment) {
@@ -67,9 +67,9 @@ function answerCandidates(comments, last, pending) {
67
67
  async function replyAfter(comments, last, writer, pending) {
68
68
  return writerQuotes(answerCandidates(comments, last, pending).filter((comment) => !fromHarness(comment)), writer);
69
69
  }
70
- async function pendingHandOver(repo, issue) {
70
+ async function savedState(repo, issue) {
71
71
  try {
72
- return (await readState(repo, issue))?.pendingHandOver;
72
+ return await readState(repo, issue);
73
73
  }
74
74
  catch {
75
75
  return undefined;
@@ -77,8 +77,9 @@ async function pendingHandOver(repo, issue) {
77
77
  }
78
78
  async function waitingQuestion(repo, config, ports, writer, issue) {
79
79
  const { comments, last } = await handOverThread(repo, ports, writer, issue.number);
80
- const pending = await pendingHandOver(repo, issue.number);
81
- if ((await replyAfter(comments, last, writer, pending)).length > 0) {
80
+ const saved = await savedState(repo, issue.number);
81
+ const pending = saved?.pendingHandOver;
82
+ if (!heldByPerson(saved) && (await replyAfter(comments, last, writer, pending)).length > 0) {
82
83
  return undefined;
83
84
  }
84
85
  const latest = comments[last];
package/dist/handover.mjs CHANGED
@@ -12,7 +12,7 @@ import { UnsettledBase } from './unsettled.mjs';
12
12
  export async function escalateAndFinish(job, note, reason) {
13
13
  const reverted = await revertFailedFix(job);
14
14
  try {
15
- await handOver(job.context, job.log, job.issue.number, job.state, `${note}${reverted}`);
15
+ await handOver(job.context, job.log, job.issue.number, job.state, `${note}${savedIn(job.asides)}${reverted}`);
16
16
  }
17
17
  catch (error) {
18
18
  if (!job.mainBroken || runStopped()) {
@@ -27,6 +27,15 @@ export async function escalateAndFinish(job, note, reason) {
27
27
  }
28
28
  return { done: true, report: await finish(job, 'needs-human', reason) };
29
29
  }
30
+ function savedIn(asides) {
31
+ const branches = asides.map((aside) => `\`${aside}\``);
32
+ if (branches.length < 2) {
33
+ return branches.length === 0
34
+ ? ''
35
+ : ` The fixer left a change behind; it is saved in the branch ${branches[0]}.`;
36
+ }
37
+ return ` The fixer left changes behind; they are saved in the branches ${branches.slice(0, -1).join(', ')} and ${branches.at(-1)}.`;
38
+ }
30
39
  export async function finishDone(job) {
31
40
  const { context, issue } = job;
32
41
  if (issue.closed !== true) {
@@ -51,6 +60,7 @@ export async function finishClosing(context, issue, log, state, started) {
51
60
  started,
52
61
  mainBroken: false,
53
62
  repairing: false,
63
+ asides: [],
54
64
  };
55
65
  return (await finishDone(job)).report;
56
66
  }
@@ -114,7 +124,10 @@ export async function finish(job, outcome, reason) {
114
124
  if (halt) {
115
125
  context.halted = true;
116
126
  }
117
- return { ...jobReport(job, outcome, reason), ...(halt ? { halt: true } : {}) };
127
+ return {
128
+ ...jobReport(job, outcome, reason),
129
+ ...(halt ? { halt: true } : {}),
130
+ };
118
131
  }
119
132
  async function deleteBranches(context, log, branch) {
120
133
  const { repo, ports } = context;
@@ -73,7 +73,7 @@ async function failedCheck(job, command, result) {
73
73
  throw error;
74
74
  }
75
75
  if (!fix.committed) {
76
- return escalateCheckFix(job, fix.unrelated, `local checks (\`${command}\`)`, '', fix.aside);
76
+ return escalateCheckFix(job, fix.unrelated, `local checks (\`${command}\`)`);
77
77
  }
78
78
  return false;
79
79
  }
package/dist/open-job.mjs CHANGED
@@ -27,6 +27,7 @@ export async function openJob(context, issue, log, state, start, handedOver, pen
27
27
  started,
28
28
  mainBroken: false,
29
29
  repairing: false,
30
+ asides: [],
30
31
  };
31
32
  }
32
33
  async function openWorktree(context, issue, log, branch, start) {
package/dist/review.mjs CHANGED
@@ -2,7 +2,7 @@ import { REVIEWING } from './agents.mjs';
2
2
  import { runStopped } from './children.mjs';
3
3
  import { budgetUse, refundBudget, refundOnKill, spendBudget } from './budget.mjs';
4
4
  import { message } from './errors.mjs';
5
- import { fixRound, savedIn } from './fix.mjs';
5
+ import { fixRound } from './fix.mjs';
6
6
  import { escalateAndFinish } from './handover.mjs';
7
7
  import { ROUND_CONTINUE, runRole, setStatus } from './job.mjs';
8
8
  import { landApproved } from './land.mjs';
@@ -122,7 +122,7 @@ async function unfixedRound(job, fix) {
122
122
  return escalateAndFinish(job, 'The fixer added no commit for the review findings.', 'no fix commit');
123
123
  }
124
124
  if (fix.stray === true) {
125
- return escalateAndFinish(job, `The fixer ${fix.unrelated === undefined ? 'settled' : 'disputed'} the findings: ${note}${savedIn(fix.aside)}`, 'dispute with changes');
125
+ return escalateAndFinish(job, `The fixer ${fix.unrelated === undefined ? 'settled' : 'disputed'} the findings: ${note}`, 'dispute with changes');
126
126
  }
127
127
  const round = state.reviewLog.at(-1);
128
128
  if (fix.unrelated === undefined) {
package/dist/skip.mjs CHANGED
@@ -4,7 +4,7 @@ import { message } from './errors.mjs';
4
4
  import { handOverReply } from './hand-over-comments.mjs';
5
5
  import { stopNow } from './handover.mjs';
6
6
  import { hasLabel } from './labels.mjs';
7
- import { writeState } from './state.mjs';
7
+ import { heldByPerson, writeState } from './state.mjs';
8
8
  import { heldOnBase } from './unsettled.mjs';
9
9
  export function skipReason(issue, config, resuming, answered = false) {
10
10
  const has = (name) => hasLabel(issue.labels, name);
@@ -74,7 +74,7 @@ async function hasAnswer(context, issue, saved) {
74
74
  if (!hasLabel(issue.labels, context.config.labels.needsHuman)) {
75
75
  return false;
76
76
  }
77
- if (saved !== undefined && saved.handedOver !== true && saved.pendingHandOver === undefined) {
77
+ if (heldByPerson(saved)) {
78
78
  return false;
79
79
  }
80
80
  return (await handOverReply(context, issue.number, saved?.pendingHandOver)).length > 0;
package/dist/state.mjs CHANGED
@@ -83,6 +83,9 @@ export async function savedIssues(repo) {
83
83
  return match === null ? [] : [Number(match[1])];
84
84
  });
85
85
  }
86
+ export function heldByPerson(saved) {
87
+ return saved !== undefined && saved.handedOver !== true && saved.pendingHandOver === undefined;
88
+ }
86
89
  export function newState(issue, branch) {
87
90
  return { issue, phase: 'claimed', branch, ciFixes: 0, reviewRounds: 0, reviewLog: [] };
88
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "7.8.21",
3
+ "version": "7.8.23",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",