next-issue 14.4.20 → 14.4.22

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.
@@ -28,8 +28,9 @@ export async function baseMoved(cwd, base, remote) {
28
28
  }
29
29
  export async function revertOnBase(cwd, revert) {
30
30
  try {
31
- if (await pushRevert(cwd, revert)) {
32
- return true;
31
+ const reverted = await pushRevert(cwd, revert);
32
+ if (reverted !== 'failed') {
33
+ return reverted;
33
34
  }
34
35
  }
35
36
  catch (error) {
@@ -37,11 +38,12 @@ export async function revertOnBase(cwd, revert) {
37
38
  throw error;
38
39
  }
39
40
  await putBranchBack(cwd, revert.branch);
40
- return false;
41
+ return 'failed';
41
42
  }
42
43
  function putBranchBack(cwd, branch) {
43
44
  return evenWhenStopped(async () => {
44
45
  await succeeds(cwd, ['revert', '--abort']);
46
+ await succeeds(cwd, ['cherry-pick', '--abort']);
45
47
  await git(cwd, ['checkout', '--force', branch]);
46
48
  });
47
49
  }
@@ -67,7 +69,14 @@ async function pushRevert(cwd, revert) {
67
69
  await git(cwd, ['checkout', '--force', '--detach', target]);
68
70
  await git(cwd, ['clean', '-fd']);
69
71
  if (!(await succeeds(cwd, ['revert', '--no-commit', ...shas.toReversed()]))) {
70
- return false;
72
+ return 'failed';
73
+ }
74
+ if (await succeeds(cwd, ['diff', '--cached', '--quiet', 'HEAD'])) {
75
+ await git(cwd, ['revert', '--abort']);
76
+ await git(cwd, ['cherry-pick', '--no-commit', ...shas]);
77
+ await git(cwd, ['commit', '--no-verify', '-m', reapply]);
78
+ await git(cwd, ['checkout', '-B', branch]);
79
+ return 'already reverted';
71
80
  }
72
81
  await git(cwd, ['commit', '--no-verify', '-m', message]);
73
82
  const reverted = await revision(cwd);
@@ -75,8 +84,8 @@ async function pushRevert(cwd, revert) {
75
84
  if ((await pushToBase(cwd, remote, base)).pushed ||
76
85
  (await isOnBase(cwd, base, remote, reverted))) {
77
86
  await commitReapply(cwd, reverted, reapply, branch);
78
- return true;
87
+ return 'pushed';
79
88
  }
80
89
  }
81
- return false;
90
+ return 'failed';
82
91
  }
@@ -61,7 +61,7 @@ export async function revert(job) {
61
61
  const { context, issue, log, state, branch, worktree } = job;
62
62
  const { repo, config, ports, base } = context;
63
63
  const shas = state.landed ?? [];
64
- const pushed = await log.step('revert', { base, shas }, () => ports.revertOnBase(worktree, {
64
+ const reverted = await log.step('revert', { base, shas }, () => ports.revertOnBase(worktree, {
65
65
  base,
66
66
  remote: config.remote,
67
67
  branch,
@@ -74,13 +74,16 @@ export async function revert(job) {
74
74
  },
75
75
  }));
76
76
  state.reverting = undefined;
77
- if (!pushed) {
77
+ if (reverted === 'failed') {
78
78
  await writeState(repo, state);
79
79
  return ` The revert of the change on ${base} failed, so the landed commits stay on ${base}.`;
80
80
  }
81
81
  restoreChange(state);
82
82
  releaseSettled(state);
83
83
  await writeState(repo, state);
84
+ if (reverted === 'already reverted') {
85
+ return ` The change is already reverted on ${base}, so the harness pushed no revert.`;
86
+ }
84
87
  await updateLocalBase(job);
85
88
  return ` The harness reverted the change on ${base}.`;
86
89
  }
@@ -17,13 +17,10 @@ export function active(run) {
17
17
  return run?.progress.status === 'running' || run?.progress.status === 'stopping';
18
18
  }
19
19
  export function endStatus(run) {
20
- if (run.progress.upgrade !== undefined && run.progress.error !== undefined) {
20
+ if (run.progress.error !== undefined) {
21
21
  return 'failed';
22
22
  }
23
- if (run.stop !== undefined) {
24
- return 'stopped';
25
- }
26
- return run.progress.error === undefined ? 'finished' : 'failed';
23
+ return run.stop === undefined ? 'finished' : 'stopped';
27
24
  }
28
25
  export function startRefusal(run, restart) {
29
26
  if (restart) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "14.4.20",
3
+ "version": "14.4.22",
4
4
  "description": "Autonomous issue harness driven by the Claude Agent SDK",
5
5
  "keywords": [
6
6
  "github",