next-issue 2.5.5 → 2.5.7

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
@@ -476,8 +476,12 @@ The workflow then gives `next-issue` and `@ravshansbox/pi-next-issue` the same
476
476
  new version and publishes both packages to npm with a
477
477
  [trusted publish](https://docs.npmjs.com/trusted-publishers), so no token is
478
478
  stored. Only after the publish does it push the tag and make the GitHub release,
479
- so a failed publish leaves no half-release behind. A manual run of the workflow
480
- checks out the last tag and publishes that commit under the tag version, and
479
+ so a failed publish leaves no half-release behind. npm makes a new version
480
+ live a few minutes after the publish, and not always in the order it got them,
481
+ so before it publishes, the job waits until npm serves both packages at the
482
+ version of the last tag, for up to 10 minutes. Thus a new version never goes
483
+ live before the one that came before it. A manual run of the workflow checks
484
+ out the last tag and publishes that commit under the tag version, and
481
485
  changes nothing else. This repairs a release that reached GitHub but not npm.
482
486
  The release job stays on a GitHub runner, because npm takes provenance only
483
487
  from a GitHub runner.
package/dist/exec.mjs CHANGED
@@ -1,6 +1,8 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
1
2
  import { spawn } from 'node:child_process';
2
3
  let observer;
3
- let defaultTimeoutMs = 10 * 60_000;
4
+ const DEFAULT_TIMEOUT_MS = 10 * 60_000;
5
+ const defaultTimeout = new AsyncLocalStorage();
4
6
  const STDERR_TAIL = 200_000;
5
7
  const groups = new Set();
6
8
  const stoppers = new Set();
@@ -50,12 +52,12 @@ export function track(child) {
50
52
  export function setCommandObserver(next) {
51
53
  observer = next;
52
54
  }
53
- export function setDefaultTimeout(ms) {
54
- defaultTimeoutMs = ms;
55
+ export function withDefaultTimeout(ms, body) {
56
+ return defaultTimeout.run(ms, body);
55
57
  }
56
58
  export function run(command, args, options = {}) {
57
59
  const started = Date.now();
58
- const limit = options.timeoutMs ?? defaultTimeoutMs;
60
+ const limit = options.timeoutMs ?? defaultTimeout.getStore() ?? DEFAULT_TIMEOUT_MS;
59
61
  return new Promise((resolve, reject) => {
60
62
  const child = spawn(command, args, {
61
63
  cwd: options.cwd,
package/dist/run.mjs CHANGED
@@ -2,7 +2,7 @@ import { AsyncLocalStorage } from 'node:async_hooks';
2
2
  import { writeFile } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
4
  import { loadConfig } from './config.mjs';
5
- import { setCommandObserver, setDefaultTimeout } from './exec.mjs';
5
+ import { setCommandObserver, withDefaultTimeout } from './exec.mjs';
6
6
  import { detectRepo } from './git.mjs';
7
7
  import { defaultBranch } from './github.mjs';
8
8
  import { exitCode, runIssues, watchIssues } from './loop.mjs';
@@ -25,7 +25,9 @@ export function recordCommands(recorder, work) {
25
25
  }
26
26
  export async function runRepo(root, args, controls) {
27
27
  const config = await loadConfig(root);
28
- setDefaultTimeout(config.commandTimeoutMinutes * 60_000);
28
+ return withDefaultTimeout(config.commandTimeoutMinutes * 60_000, () => runWithConfig(root, args, controls, config));
29
+ }
30
+ async function runWithConfig(root, args, controls, config) {
29
31
  const repo = await detectRepo(root, config.remote);
30
32
  const recorder = await Recorder.create(repo.root, args.level, controls.onEvent);
31
33
  const pruned = await pruneRuns(repo.root, config.keepRunDays);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "2.5.5",
3
+ "version": "2.5.7",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",