next-issue 6.6.10 → 6.6.12

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
@@ -135,7 +135,9 @@ the run handles one issue. For each issue:
135
135
  commit of the change on the base branch, pushes the revert and hands the
136
136
  issue to a person. A revert
137
137
  push that the remote refuses, for example because the base moved, makes
138
- the revert again on the new base, three times at most. A resume
138
+ the revert again on the new base, three times at most. A failed revert
139
+ push that the base holds after a fetch counts as landed, and a fetch that
140
+ fails leaves the revert reported as failed. A resume
139
141
  that stopped while the checks of a landed commit ran waits for them
140
142
  again, even when more commits landed on the base since, and a fix that
141
143
  was committed but not landed lands first. A problem that the reviewer
@@ -391,12 +393,12 @@ because no pull request is opened.
391
393
  | `maxCiFixes` | `5` | The budget for check fixes per issue |
392
394
  | `maxCommitFixes` | `10` | The budget for fixes of a commit that a git hook stopped, per issue |
393
395
  | `maxReviewRounds` | `5` | The budget for review rounds per issue |
394
- | `checkIntervalSeconds` | `15` | The time between two check states |
396
+ | `checkIntervalSeconds` | `15` | The time between two check states, at most `2147483` |
395
397
  | `checkGraceSeconds` | `60` | The time to wait for the first check to show |
396
- | `checkTimeoutMinutes` | `60` | The limit for one check wait |
397
- | `agentTimeoutMinutes` | `30` | The limit for one agent call |
398
- | `setupTimeoutMinutes` | `15` | The limit for the setup command |
399
- | `commandTimeoutMinutes` | `10` | The limit for one `git` or `gh` command |
398
+ | `checkTimeoutMinutes` | `60` | The limit for one check wait, at most `35791` |
399
+ | `agentTimeoutMinutes` | `30` | The limit for one agent call, at most `35791` |
400
+ | `setupTimeoutMinutes` | `15` | The limit for the setup command, at most `35791` |
401
+ | `commandTimeoutMinutes` | `10` | The limit for one `git` or `gh` command, at most `35791` |
400
402
  | `logMaxChars` | `20000` | The maximum length of the failed job logs, shared between the failed jobs |
401
403
  | `diffMaxChars` | `60000` | The maximum length of the diff that the reviewer reads |
402
404
  | `keepRunDays` | `7` | The number of days to keep the run files; `0` keeps them all |
@@ -13,12 +13,18 @@ export function rejectUnknown(value, known, what) {
13
13
  }
14
14
  }
15
15
  }
16
- export function whole(value, field, least) {
17
- if (typeof value !== 'number' || !Number.isInteger(value) || value < least) {
18
- throw new Error(`${CONFIG_FILE}: ${field} must be a whole number of ${least} or more.`);
16
+ export function whole(value, field, least, most) {
17
+ if (typeof value !== 'number' ||
18
+ !Number.isInteger(value) ||
19
+ value < least ||
20
+ (most !== undefined && value > most)) {
21
+ throw new Error(`${CONFIG_FILE}: ${field} must be a whole number ${range(least, most)}.`);
19
22
  }
20
23
  return value;
21
24
  }
25
+ function range(least, most) {
26
+ return most === undefined ? `of ${least} or more` : `from ${least} to ${most}`;
27
+ }
22
28
  export function text(value, field, allowEmpty) {
23
29
  if (typeof value !== 'string' || (!allowEmpty && value.length === 0)) {
24
30
  throw new Error(`${CONFIG_FILE}: ${field} must be ${allowEmpty ? 'text' : 'text that is not empty'}.`);
package/dist/config.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { mkdir, readFile, rename } from 'node:fs/promises';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { CONFIG_FILE, OLD_CONFIG_FILE, record, rejectUnknown, text, whole, } from './config-fields.mjs';
4
+ import { MAX_TIMER_MS } from './durations.mjs';
4
5
  import { hasCode, message, parseJson } from './errors.mjs';
5
6
  import { readTextIfPresent, unlessMissing, writeJson } from './files.mjs';
6
7
  const DEFAULTS = {
@@ -35,6 +36,8 @@ function defaults() {
35
36
  return { ...DEFAULTS, models: { ...DEFAULTS.models }, labels: { ...DEFAULTS.labels } };
36
37
  }
37
38
  const FIELDS = [...Object.keys(DEFAULTS), 'setupCommand'];
39
+ const MAX_MINUTES = Math.floor(MAX_TIMER_MS / 60_000);
40
+ const MAX_SECONDS = Math.floor(MAX_TIMER_MS / 1000);
38
41
  const WHOLE_FIELDS = [
39
42
  ['issueLimit', 1],
40
43
  ['concurrency', 1],
@@ -42,12 +45,12 @@ const WHOLE_FIELDS = [
42
45
  ['maxCiFixes', 0],
43
46
  ['maxCommitFixes', 0],
44
47
  ['maxReviewRounds', 1],
45
- ['checkIntervalSeconds', 1],
48
+ ['checkIntervalSeconds', 1, MAX_SECONDS],
46
49
  ['checkGraceSeconds', 0],
47
- ['checkTimeoutMinutes', 1],
48
- ['agentTimeoutMinutes', 1],
49
- ['setupTimeoutMinutes', 1],
50
- ['commandTimeoutMinutes', 1],
50
+ ['checkTimeoutMinutes', 1, MAX_MINUTES],
51
+ ['agentTimeoutMinutes', 1, MAX_MINUTES],
52
+ ['setupTimeoutMinutes', 1, MAX_MINUTES],
53
+ ['commandTimeoutMinutes', 1, MAX_MINUTES],
51
54
  ['logMaxChars', 1],
52
55
  ['diffMaxChars', 1],
53
56
  ['keepRunDays', 0],
@@ -127,9 +130,9 @@ function parseConfig(value) {
127
130
  if (file.remote !== undefined) {
128
131
  config.remote = text(file.remote, 'remote', false);
129
132
  }
130
- for (const [field, least] of WHOLE_FIELDS) {
133
+ for (const [field, least, most] of WHOLE_FIELDS) {
131
134
  if (file[field] !== undefined) {
132
- config[field] = whole(file[field], field, least);
135
+ config[field] = whole(file[field], field, least, most);
133
136
  }
134
137
  }
135
138
  if (file.setupCommand !== undefined) {
@@ -1,3 +1,7 @@
1
+ export const MAX_TIMER_MS = 2_147_483_647;
2
+ export function timerMs(ms) {
3
+ return Math.min(ms, MAX_TIMER_MS);
4
+ }
1
5
  export function minutesToMs(minutes) {
2
6
  return minutes * 60_000;
3
7
  }
@@ -14,7 +18,7 @@ export function deadline(ms, onExpire) {
14
18
  : setTimeout(() => {
15
19
  timedOut = true;
16
20
  onExpire();
17
- }, ms);
21
+ }, timerMs(ms));
18
22
  return { timedOut: () => timedOut, clear: () => clearTimeout(timer) };
19
23
  }
20
24
  export function elapsedMs(started) {
@@ -31,7 +35,7 @@ export function wakeableSleep(sleeper, ms, stopped) {
31
35
  sleeper.wake = undefined;
32
36
  resolve(slept);
33
37
  };
34
- const timer = setTimeout(() => settle(true), ms);
38
+ const timer = setTimeout(() => settle(true), timerMs(ms));
35
39
  sleeper.wake = () => settle(false);
36
40
  });
37
41
  }
package/dist/git-land.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { fetchBase, git, oneFetchAtATime, remoteRef, revision, succeeds } from './git.mjs';
1
+ import { fetchBase, git, isOnBase, oneFetchAtATime, remoteRef, revision, succeeds, } from './git.mjs';
2
2
  import { commitEverything } from './git-commit.mjs';
3
3
  export const PUSH_TRIES = 3;
4
4
  export async function squashOnto(cwd, base, remote, message) {
@@ -44,8 +44,9 @@ async function pushRevert(cwd, revert) {
44
44
  return false;
45
45
  }
46
46
  await git(cwd, ['commit', '--no-verify', '-m', message]);
47
- if (await pushToBase(cwd, remote, base)) {
48
- await git(cwd, ['revert', '--no-commit', await revision(cwd)]);
47
+ const reverted = await revision(cwd);
48
+ if ((await pushToBase(cwd, remote, base)) || (await isOnBase(cwd, base, remote, reverted))) {
49
+ await git(cwd, ['revert', '--no-commit', reverted]);
49
50
  await git(cwd, ['commit', '--no-verify', '-m', reapply]);
50
51
  await git(cwd, ['checkout', '-B', branch]);
51
52
  return true;
package/dist/poll.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { setTimeout as delay } from 'node:timers/promises';
2
- import { secondsToMs } from './durations.mjs';
2
+ import { secondsToMs, timerMs } from './durations.mjs';
3
3
  export const REAL_CLOCK = {
4
4
  now: () => Date.now(),
5
5
  sleep: (ms) => delay(ms),
6
6
  };
7
7
  export function pause(clock, options, rest) {
8
- return clock.sleep(Math.min(secondsToMs(options.intervalSeconds), rest));
8
+ return clock.sleep(timerMs(Math.min(secondsToMs(options.intervalSeconds), rest)));
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.10",
3
+ "version": "6.6.12",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",