next-issue 2.5.6 → 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/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.6",
3
+ "version": "2.5.7",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",