next-issue 6.6.69 → 6.6.71

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/conflict.mjs CHANGED
@@ -3,6 +3,7 @@ import { spendBudget } from './budget.mjs';
3
3
  import { commitWork, runFixer } from './fix.mjs';
4
4
  import { escalateAndFinish } from './handover.mjs';
5
5
  import { fallbackTitle } from './job.mjs';
6
+ import { writeState } from './state.mjs';
6
7
  export async function rebase(job) {
7
8
  const { context, issue, log, state, worktree } = job;
8
9
  const { config, ports, base } = context;
@@ -22,12 +23,23 @@ export async function rebase(job) {
22
23
  state.title = title;
23
24
  }
24
25
  const merged = await ports.revision(worktree);
25
- const squashed = await commitWork(job, merged, title, 'fixer', (cwd, message) => ports.squashOnto(cwd, target, message));
26
+ const squashed = await commitWork(job, merged, title, 'fixer', (cwd, message) => squash(job, cwd, target, message));
26
27
  if (!squashed) {
27
28
  return escalateAndFinish(job, `The change holds nothing that ${config.remote}/${base} does not already hold.`, 'empty change');
28
29
  }
29
30
  return undefined;
30
31
  }
32
+ async function squash(job, cwd, target, message) {
33
+ const { context, state } = job;
34
+ state.squashing = await context.ports.revision(cwd);
35
+ await writeState(context.repo, state);
36
+ try {
37
+ return await context.ports.squashOnto(cwd, target, message);
38
+ }
39
+ finally {
40
+ state.squashing = undefined;
41
+ }
42
+ }
31
43
  async function mergeBase(job, merge) {
32
44
  const { before, files } = merge;
33
45
  const { context, worktree } = job;
@@ -11,6 +11,7 @@ export async function enterReview(job) {
11
11
  const { base } = context;
12
12
  return escalateAndFinish(job, `The run stopped during the revert of the change on ${base}. The harness reverted the change on ${base}.`, 'revert stopped');
13
13
  }
14
+ await settleSquash(job);
14
15
  const landed = state.landed?.at(-1);
15
16
  if (landed !== undefined) {
16
17
  return resumeLanding(job, landed);
@@ -37,6 +38,16 @@ async function settlePush(job) {
37
38
  state.pushing = undefined;
38
39
  await writeState(repo, state);
39
40
  }
41
+ async function settleSquash(job) {
42
+ const { context, state, worktree, branch } = job;
43
+ const sha = state.squashing;
44
+ if (sha === undefined) {
45
+ return;
46
+ }
47
+ await context.ports.discardChanges(worktree, sha, branch);
48
+ state.squashing = undefined;
49
+ await writeState(context.repo, state);
50
+ }
40
51
  async function settleRevert(job) {
41
52
  const { context, state, worktree, branch } = job;
42
53
  const { repo, config, ports, base } = context;
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
@@ -59,6 +59,7 @@ function isState(value) {
59
59
  (value.landed === undefined || isLanded(value.landed)) &&
60
60
  isOptional(value.pushing, 'string') &&
61
61
  isOptional(value.reverting, 'string') &&
62
+ isOptional(value.squashing, 'string') &&
62
63
  isOptional(value.rerun, 'string') &&
63
64
  isOptional(value.reviewing, 'string') &&
64
65
  typeof value.reviewRounds === 'number' &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.69",
3
+ "version": "6.6.71",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",