next-issue 6.6.35 → 6.6.36

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
@@ -166,7 +166,9 @@ the run handles one issue. For each issue:
166
166
  push that the base holds after a fetch counts as landed, and a fetch that
167
167
  fails leaves the revert reported as failed. The state file holds the
168
168
  revert commit during the push, so a run stopped meanwhile checks the base
169
- on resume. When the base holds the revert, the harness drops the landed
169
+ on resume. When the base holds the revert, the harness puts the change
170
+ back on the branch on top of the revert, as after a revert that
171
+ completes (an unlanded fix commit is dropped), drops the landed
170
172
  commits from the state, waits for no checks, does not revert again, hands
171
173
  the issue to a person with the reason `revert stopped` and halts. A resume
172
174
  that stopped while the checks of a landed commit ran waits for them
@@ -1,6 +1,7 @@
1
1
  import { escalateAndFinish } from './handover.mjs';
2
2
  import { ROUND_CONTINUE } from './job.mjs';
3
3
  import { resumeLanding } from './land.mjs';
4
+ import { reapplyMessage } from './revert.mjs';
4
5
  import { writeState } from './state.mjs';
5
6
  export async function enterReview(job) {
6
7
  const { context, state } = job;
@@ -32,7 +33,7 @@ async function settlePush(job) {
32
33
  await writeState(repo, state);
33
34
  }
34
35
  async function settleRevert(job) {
35
- const { context, state, worktree } = job;
36
+ const { context, state, worktree, branch } = job;
36
37
  const { repo, config, ports, base } = context;
37
38
  const sha = state.reverting;
38
39
  if (sha === undefined) {
@@ -40,6 +41,13 @@ async function settleRevert(job) {
40
41
  }
41
42
  const reverted = await ports.isOnBase(worktree, base, config.remote, sha);
42
43
  if (reverted) {
44
+ await ports.reapplyRevert(worktree, {
45
+ base,
46
+ remote: config.remote,
47
+ branch,
48
+ reverted: sha,
49
+ reapply: reapplyMessage(job),
50
+ });
43
51
  state.landed = undefined;
44
52
  }
45
53
  state.reverting = undefined;
package/dist/git-land.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { evenWhenStopped } from './children.mjs';
2
- import { fetchBase, git, isOnBase, oneFetchAtATime, revision, succeeds } from './git.mjs';
2
+ import { fetchBase, git, isAncestor, isLanded, isOnBase, oneFetchAtATime, revision, succeeds, } from './git.mjs';
3
3
  import { commitEverything } from './git-commit.mjs';
4
4
  export const PUSH_TRIES = 3;
5
5
  export async function squashOnto(cwd, target, message) {
@@ -34,6 +34,21 @@ export async function revertOnBase(cwd, revert) {
34
34
  }
35
35
  }
36
36
  }
37
+ export async function reapplyRevert(cwd, reapply) {
38
+ const { base, remote, branch, reverted } = reapply;
39
+ if ((await isAncestor(cwd, reverted, 'HEAD')) && !(await isLanded(cwd, base, remote))) {
40
+ return false;
41
+ }
42
+ await git(cwd, ['checkout', '--force', '--detach', reverted]);
43
+ await git(cwd, ['clean', '-fd']);
44
+ await commitReapply(cwd, reverted, reapply.reapply, branch);
45
+ return true;
46
+ }
47
+ async function commitReapply(cwd, reverted, message, branch) {
48
+ await git(cwd, ['revert', '--no-commit', reverted]);
49
+ await git(cwd, ['commit', '--no-verify', '-m', message]);
50
+ await git(cwd, ['checkout', '-B', branch]);
51
+ }
37
52
  async function pushRevert(cwd, revert) {
38
53
  const { base, remote, branch, shas, message, reapply, pushing } = revert;
39
54
  for (let attempt = 1; attempt <= PUSH_TRIES; attempt += 1) {
@@ -47,9 +62,7 @@ async function pushRevert(cwd, revert) {
47
62
  const reverted = await revision(cwd);
48
63
  await pushing(reverted);
49
64
  if ((await pushToBase(cwd, remote, base)) || (await isOnBase(cwd, base, remote, reverted))) {
50
- await git(cwd, ['revert', '--no-commit', reverted]);
51
- await git(cwd, ['commit', '--no-verify', '-m', reapply]);
52
- await git(cwd, ['checkout', '-B', branch]);
65
+ await commitReapply(cwd, reverted, reapply, branch);
53
66
  return true;
54
67
  }
55
68
  }
package/dist/ports.mjs CHANGED
@@ -2,7 +2,7 @@ import { runAgent } from './agents.mjs';
2
2
  import { failedBaseLogs, rerunFailedBase, waitForBaseChecks } from './base-checks.mjs';
3
3
  import { run } from './exec.mjs';
4
4
  import { commitAll } from './git-commit.mjs';
5
- import { pushToBase, revertOnBase, squashOnto } from './git-land.mjs';
5
+ import { pushToBase, reapplyRevert, revertOnBase, squashOnto } from './git-land.mjs';
6
6
  import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
7
7
  import { deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, setAside, } from './git.mjs';
8
8
  import { canWrite, closeIssue, commentOnIssue, issueComments, openBlockers, openIssues, reopenIssue, threadComments, viewIssue, } from './github.mjs';
@@ -40,6 +40,7 @@ export const PORTS = {
40
40
  openIssues,
41
41
  push,
42
42
  pushToBase,
43
+ reapplyRevert,
43
44
  removeWorktree,
44
45
  reopenIssue,
45
46
  rerunFailedBase,
package/dist/revert.mjs CHANGED
@@ -23,6 +23,10 @@ export async function revertOrReport(job) {
23
23
  export function sentence(text) {
24
24
  return text.endsWith('.') ? text : `${text}.`;
25
25
  }
26
+ export function reapplyMessage(job) {
27
+ const { number } = job.issue;
28
+ return `${job.state.title ?? `fix: resolve issue #${number}`}\n\nRefs #${number}`;
29
+ }
26
30
  export async function revert(job) {
27
31
  const { context, issue, log, state, branch, worktree } = job;
28
32
  const { repo, config, ports, base } = context;
@@ -33,7 +37,7 @@ export async function revert(job) {
33
37
  branch,
34
38
  shas,
35
39
  message: `revert: issue #${issue.number}\n\nRefs #${issue.number}`,
36
- reapply: `${state.title ?? `fix: resolve issue #${issue.number}`}\n\nRefs #${issue.number}`,
40
+ reapply: reapplyMessage(job),
37
41
  pushing: async (sha) => {
38
42
  state.reverting = sha;
39
43
  await writeState(repo, state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.35",
3
+ "version": "6.6.36",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",