next-issue 6.6.68 → 6.6.70

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
@@ -309,6 +309,12 @@ Press `Ctrl-C` to stop the run step by step:
309
309
  resumes before the first commit, the implementer runs again and the
310
310
  commit holds them.
311
311
 
312
+ When the reviewer approved the change and the run stopped before its
313
+ commit reached the base branch, the next run drops those edits and any
314
+ unfinished merge of the base branch, then lands the change with no new
315
+ review round. A hand-over of the issue cancels that approval, so the
316
+ issue resumes in review.
317
+
312
318
  Signals that arrive within 100 ms of the last counted one count as one press,
313
319
  because `npx` and `npm exec` pass on a press as a second signal.
314
320
 
@@ -15,10 +15,14 @@ export async function enterReview(job) {
15
15
  if (landed !== undefined) {
16
16
  return resumeLanding(job, landed);
17
17
  }
18
- const approved = state.phase === 'approved';
18
+ if (state.phase === 'approved') {
19
+ const { ports } = context;
20
+ await ports.discardChanges(job.worktree, await ports.revision(job.worktree), job.branch);
21
+ return landApproved(job);
22
+ }
19
23
  state.phase = 'review';
20
24
  await writeState(context.repo, state);
21
- return approved ? landApproved(job) : ROUND_CONTINUE;
25
+ return ROUND_CONTINUE;
22
26
  }
23
27
  async function settlePush(job) {
24
28
  const { context, state, worktree } = job;
package/dist/git.mjs CHANGED
@@ -61,7 +61,10 @@ export async function diff(cwd, base, remote) {
61
61
  }
62
62
  export async function discardChanges(cwd, target, branch) {
63
63
  const moved = branch !== undefined && (await currentBranch(cwd)) !== branch;
64
- if (!moved && !(await isDirty(cwd)) && (await revision(cwd)) === target) {
64
+ if (!moved &&
65
+ !(await isDirty(cwd)) &&
66
+ !(await succeeds(cwd, ['rev-parse', '--quiet', '--verify', 'MERGE_HEAD'])) &&
67
+ (await revision(cwd)) === target) {
65
68
  return false;
66
69
  }
67
70
  if (moved) {
package/dist/review.mjs CHANGED
@@ -29,6 +29,8 @@ export async function reviewRound(job) {
29
29
  recordVerdict(job, verdict, open);
30
30
  await ports.commentOnIssue(repo, issue.number, fitComment(formatVerdict(verdict, open), CUT));
31
31
  if (open.length === 0) {
32
+ state.phase = 'approved';
33
+ await writeState(repo, state);
32
34
  return landApproved(job);
33
35
  }
34
36
  return changesRequestedRound(job, open, earlier);
package/dist/serve.mjs CHANGED
@@ -108,6 +108,7 @@ export async function startWorker(options) {
108
108
  send(socket, runsMessage(runs));
109
109
  void sendQuestions(options.root, () => [socket]);
110
110
  socket.on('close', closeWhenIdle);
111
+ socket.on('error', () => socket.terminate());
111
112
  socket.on('message', (data) => {
112
113
  const value = parseMessage(String(data));
113
114
  if (value === undefined) {
package/dist/state.mjs CHANGED
@@ -78,7 +78,8 @@ export function newState(issue, branch) {
78
78
  }
79
79
  export function resetState(state) {
80
80
  const { handedOver: _handedOver, ...rest } = state;
81
- return { ...rest, ciFixes: 0, commitFixes: 0, reviewRounds: 0, reviewLog: [] };
81
+ const phase = rest.phase === 'approved' ? 'review' : rest.phase;
82
+ return { ...rest, phase, ciFixes: 0, commitFixes: 0, reviewRounds: 0, reviewLog: [] };
82
83
  }
83
84
  export async function writeState(repo, state) {
84
85
  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.68",
3
+ "version": "6.6.70",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",