next-issue 7.8.13 → 7.8.15

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
@@ -160,8 +160,13 @@ the run handles one issue. For each issue:
160
160
  harness undoes the merge and hands the issue to a person with the reason
161
161
  `merge conflict`. When `checks` lists commands, the harness then runs
162
162
  the setup command again in the worktree, so the checks use the
163
- dependencies of the merged base. A setup that fails or does not finish
164
- in `setupTimeoutMinutes` stops the landing before the push and hands the
163
+ dependencies of the merged base. It runs the setup after it makes the
164
+ change one commit, and adds what the setup writes, unless git ignores
165
+ it, to that commit without hooks. Every check runs on that commit, and
166
+ the base gets the same files that the checks passed on. A change that
167
+ the base already holds is an `empty change` before the setup runs. A
168
+ setup that fails or does not finish in `setupTimeoutMinutes` keeps the
169
+ merged commit, stops the landing before the push and hands the
165
170
  issue to a person with the reason `setup failed` or `setup timeout`. The
166
171
  harness then runs each command in `checks` in the worktree, in order,
167
172
  with `bash -c` and stderr merged into stdout, each for at most
@@ -256,8 +261,11 @@ the run handles one issue. For each issue:
256
261
  was rerun, a run that waits for approval, a check from another CI
257
262
  service) waits until every check has finished, so a workflow run that
258
263
  fails later, even after the first rerun started, still gets its own
259
- rerun before any fixer. A rerun that GitHub refuses because the run
260
- is already running counts as started. When at least one run restarted
264
+ rerun before any fixer. A workflow run whose kept job failed while a
265
+ job in `ignoredChecks` still runs gets its rerun only once the whole
266
+ run has finished on GitHub, as GitHub refuses to rerun a running run.
267
+ A rerun that GitHub refuses because the run is already running counts
268
+ as started. When at least one run restarted
261
269
  and a later rerun or read fails, the event carries the error and the
262
270
  harness still waits for the checks again, counting each restarted run as
263
271
  running until a later attempt of it completes, so the fixer never runs
@@ -25,7 +25,7 @@ async function baseRuns(repo, sha, branch, ignored) {
25
25
  const judged = await Promise.all(pushed.map((entry) => withoutIgnored(repo, entry, ignored)));
26
26
  return judged.filter((entry) => entry !== undefined);
27
27
  }
28
- /** Judges a workflow run by its jobs outside the ignored checks; a run with no job yet, or a running one whose listed jobs all finished, keeps its own state, as a job not listed yet may follow. */
28
+ /** Judges a workflow run by its jobs outside the ignored checks; a run with no job yet, or a running one whose listed jobs all finished, keeps its own state, as a job not listed yet may follow. A running one whose kept jobs failed waits until it finishes, as GitHub refuses to rerun a running run. */
29
29
  async function withoutIgnored(repo, run, ignored) {
30
30
  const jobs = jsonLines(await ghApi(repo, `actions/runs/${run.databaseId}/jobs?filter=latest&per_page=100`, '.jobs[] | {databaseId: .id, name, status, conclusion: (.conclusion // "")} | @json', { paginate: true }));
31
31
  if (jobs.length === 0 || (run.status !== 'completed' && jobs.every(completedJob))) {
@@ -38,7 +38,11 @@ async function withoutIgnored(repo, run, ignored) {
38
38
  if (!kept.every(completedJob)) {
39
39
  return { ...run, status: 'in_progress', conclusion: '', jobs: kept };
40
40
  }
41
- return { ...run, status: 'completed', conclusion: jobsConclusion(kept), jobs: kept };
41
+ const judged = { ...run, status: 'completed', conclusion: jobsConclusion(kept), jobs: kept };
42
+ if (run.status !== 'completed' && rerunnable(judged)) {
43
+ return { ...run, status: 'in_progress', conclusion: '', jobs: kept };
44
+ }
45
+ return judged;
42
46
  }
43
47
  function completedJob(job) {
44
48
  return job.status === 'completed';
package/dist/git.mjs CHANGED
@@ -107,6 +107,14 @@ export async function saveEdits(cwd, commitMessage) {
107
107
  await git(cwd, ['commit', '--no-verify', '-m', commitMessage]);
108
108
  return true;
109
109
  }
110
+ /** Adds every edit in the worktree to the last commit, with no hooks. */
111
+ export async function amendEdits(cwd) {
112
+ if (!(await isDirty(cwd))) {
113
+ return;
114
+ }
115
+ await git(cwd, ['add', '-A']);
116
+ await git(cwd, ['commit', '--amend', '--no-edit', '--no-verify']);
117
+ }
110
118
  export async function setAside(cwd, target, branch) {
111
119
  await git(cwd, ['branch', branch]);
112
120
  if (await isDirty(cwd)) {
@@ -23,6 +23,7 @@ export async function localChecks(job) {
23
23
  if (setup !== undefined) {
24
24
  return setup;
25
25
  }
26
+ await ports.amendEdits(worktree);
26
27
  const head = await ports.revision(worktree);
27
28
  for (const command of config.checks) {
28
29
  const result = await log.step('check', { cmd: command }, () => ports.runCheck(command, worktree, minutesToMs(config.checksTimeoutMinutes), config.logMaxChars));
package/dist/ports.mjs CHANGED
@@ -4,7 +4,7 @@ import { run } from './exec.mjs';
4
4
  import { commitAll } from './git-commit.mjs';
5
5
  import { pushToBase, reapplyRevert, revertOnBase, squashOnto } from './git-land.mjs';
6
6
  import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
7
- import { changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, saveEdits, setAside, } from './git.mjs';
7
+ import { amendEdits, changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, saveEdits, setAside, } from './git.mjs';
8
8
  import { canWrite, closeIssue, commentOnIssue, editIssueBody, issueComments, openBlockers, openIssues, reopenIssue, repositorySlug, threadComments, viewIssue, } from './github.mjs';
9
9
  import { huntWorktree } from './hunt.mjs';
10
10
  import { ensureLabel, setLabel } from './labels.mjs';
@@ -20,6 +20,7 @@ async function runCheck(command, cwd, timeoutMs, tailChars) {
20
20
  }
21
21
  export const PORTS = {
22
22
  abortMerge,
23
+ amendEdits,
23
24
  addWorktree,
24
25
  canWrite,
25
26
  changedFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "7.8.13",
3
+ "version": "7.8.15",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",