next-issue 7.8.9 → 7.8.11

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
@@ -161,7 +161,10 @@ the run handles one issue. For each issue:
161
161
  `merge conflict`. When `checks` lists commands, the harness then runs
162
162
  each one in the worktree, in order, with `bash -c` and stderr merged
163
163
  into stdout, each for at most `checksTimeoutMinutes`. Their output goes
164
- to the run log (`check.output`, and `check.fail` for a failure). A
164
+ to the run log (`check.output`, and `check.fail` for a failure). After
165
+ each command, the harness resets the worktree to the commit it checked
166
+ and removes untracked files that git does not ignore, so a file that a
167
+ command writes never lands on the base. A
165
168
  command that fails or does not finish stops the landing before the push:
166
169
  the fixer gets the command and the tail of its output (at most
167
170
  `logMaxChars`) from the check budget, `maxCiFixes`, and its fix is
@@ -385,16 +388,16 @@ A halt that leaves a commit on the base, or a push or revert that may be on
385
388
  it, with checks nobody awaited (`checks error`, `push unknown`,
386
389
  `main checks timeout`, `main checks cancelled`, an error or a failed setup
387
390
  on such a resume before the base is checked, or a stop or kill while the run
388
- waits for the checks of a commit it landed) is saved in the state file of
389
- its issue. A stopped issue resumes in the next run; any other waits for a
390
- person, so later runs skip it. Either way, no later run lands another change
391
- meanwhile: an issue that reaches the landing ends `stopped` with the reason
392
- `base unchecked`, keeps its state, branch and labels, and the run claims no
393
- more issues; the log holds a `land.blocked` event with the waiting issues.
394
- Runs take such a halted issue before the others, and a running one still
395
- resumes, so an older issue that reaches the landing first does not keep it
396
- from checking the base. Once a person answers or
397
- takes the label off, the issue resumes, checks the base and waits for the
391
+ pushes a change to the base or waits for the checks of a commit it landed) is
392
+ saved in the state file of its issue. A stopped issue resumes in the next
393
+ run; any other waits for a person, so later runs skip it. Either way, no
394
+ later run lands another change meanwhile: an issue that reaches the landing
395
+ ends `stopped` with the reason `base unchecked`, keeps its state, branch and
396
+ labels, and the run claims no more issues; the log holds a `land.blocked`
397
+ event with the waiting issues. Runs take such a halted issue before the
398
+ others, and a running one still resumes, so an older issue that reaches the
399
+ landing first does not keep it from checking the base. Once a person answers
400
+ or takes the label off, the issue resumes, checks the base and waits for the
398
401
  checks of its commit; when those are known (the issue is done, or its
399
402
  commits are reverted or found not on the base), the issue drops the halt
400
403
  from its state and the next run lands the held issues again. A later
@@ -42,6 +42,7 @@ async function settlePush(job) {
42
42
  }
43
43
  if (await ports.isOnBase(worktree, base, config.remote, sha)) {
44
44
  state.landed = [...(state.landed ?? []), sha];
45
+ state.halted = true;
45
46
  }
46
47
  state.pushing = undefined;
47
48
  releaseSettled(state);
package/dist/land.mjs CHANGED
@@ -123,7 +123,9 @@ async function pushChange(job) {
123
123
  const sha = await ports.revision(worktree);
124
124
  // A halt saved before nothing of this issue was left on the base must not block once this push lands.
125
125
  releaseSettled(state);
126
+ const halted = state.halted;
126
127
  state.pushing = sha;
128
+ state.halted = true;
127
129
  await writeState(repo, state);
128
130
  const pushed = await log.step('land', { base, sha }, async () => (await ports.pushToBase(worktree, config.remote, base)) ||
129
131
  ports.isOnBase(worktree, base, config.remote, sha).catch((error) => {
@@ -134,13 +136,14 @@ async function pushChange(job) {
134
136
  }));
135
137
  if (pushed === undefined) {
136
138
  job.mainBroken = true;
137
- state.halted = true;
138
139
  return escalateAndFinish(job, `The push to ${base} failed and the fetch of ${base} failed too, so the harness cannot tell whether the commit landed. ${HALT_NOTE}`, 'push unknown');
139
140
  }
140
141
  state.pushing = undefined;
141
142
  if (pushed) {
142
143
  state.landed = [...(state.landed ?? []), sha];
143
- state.halted = true;
144
+ }
145
+ else if (halted !== true) {
146
+ delete state.halted;
144
147
  }
145
148
  await writeState(repo, state);
146
149
  if (pushed) {
@@ -1,5 +1,5 @@
1
1
  import { budgetUse, refundBudget, refundOnKill } from './budget.mjs';
2
- import { refuseWhenStopped, runStopped } from './children.mjs';
2
+ import { evenWhenStopped, refuseWhenStopped, runStopped } from './children.mjs';
3
3
  import { minutesToMs } from './durations.mjs';
4
4
  import { succeeded } from './exec.mjs';
5
5
  import { escalateCheckFix, fixRound } from './fix.mjs';
@@ -15,8 +15,10 @@ const COMMENT_OUTPUT_CHARS = 3000;
15
15
  export async function localChecks(job) {
16
16
  const { context, log, worktree } = job;
17
17
  const { config, ports } = context;
18
+ const head = await ports.revision(worktree);
18
19
  for (const command of config.checks) {
19
20
  const result = await log.step('check', { cmd: command }, () => ports.runCheck(command, worktree, minutesToMs(config.checksTimeoutMinutes), config.logMaxChars));
21
+ await evenWhenStopped(() => ports.discardChanges(worktree, head));
20
22
  // A stop kills the command, so its failure is no finding: the next run checks again.
21
23
  refuseWhenStopped();
22
24
  log.event('check.output', { cmd: command, code: result.code, timedOut: result.timedOut, output: result.output }, 'verbose');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "7.8.9",
3
+ "version": "7.8.11",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",