@humwick/runner 0.130.1 → 0.130.2

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.
Files changed (69) hide show
  1. package/package.json +12 -16
  2. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/plugins/claude/hooks/gate-run-guard.provisioned.mjs +31 -1
  4. package/src/adapters/claude-effort.ts +2 -4
  5. package/src/adapters/codex-launch-config.ts +4 -5
  6. package/src/adapters/codex.ts +1 -1
  7. package/src/adapters/opencode-provider.ts +7 -22
  8. package/src/adapters/opencode.ts +4 -4
  9. package/src/agent-runner/credentials.ts +42 -12
  10. package/src/agent-runner/inbox.ts +27 -0
  11. package/src/agent-runner/lifecycle-milestones.ts +0 -2
  12. package/src/bin/claude.ts +4 -0
  13. package/src/bin/codex.ts +4 -0
  14. package/src/bin/opencode.ts +4 -0
  15. package/src/index.ts +5 -2
  16. package/src/provider-setup.ts +34 -0
  17. package/src/providers.ts +2 -1
  18. package/src/runner-core.ts +18 -23
  19. package/src/spawn-input.ts +2 -1
  20. package/src/test-run-dedup.ts +59 -56
  21. package/node_modules/@humwick/offload/LICENSE +0 -167
  22. package/node_modules/@humwick/offload/README.md +0 -57
  23. package/node_modules/@humwick/offload/dist/async-runner.d.ts +0 -18
  24. package/node_modules/@humwick/offload/dist/async-runner.d.ts.map +0 -1
  25. package/node_modules/@humwick/offload/dist/async-runner.js +0 -158
  26. package/node_modules/@humwick/offload/dist/async-runner.js.map +0 -1
  27. package/node_modules/@humwick/offload/dist/envelope.d.ts +0 -25
  28. package/node_modules/@humwick/offload/dist/envelope.d.ts.map +0 -1
  29. package/node_modules/@humwick/offload/dist/envelope.js +0 -80
  30. package/node_modules/@humwick/offload/dist/envelope.js.map +0 -1
  31. package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts +0 -10
  32. package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts.map +0 -1
  33. package/node_modules/@humwick/offload/dist/fixtures/worker-task.js +0 -59
  34. package/node_modules/@humwick/offload/dist/fixtures/worker-task.js.map +0 -1
  35. package/node_modules/@humwick/offload/dist/index.d.ts +0 -5
  36. package/node_modules/@humwick/offload/dist/index.d.ts.map +0 -1
  37. package/node_modules/@humwick/offload/dist/index.js +0 -5
  38. package/node_modules/@humwick/offload/dist/index.js.map +0 -1
  39. package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts +0 -62
  40. package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts.map +0 -1
  41. package/node_modules/@humwick/offload/dist/subprocess-runner.js +0 -295
  42. package/node_modules/@humwick/offload/dist/subprocess-runner.js.map +0 -1
  43. package/node_modules/@humwick/offload/dist/types.d.ts +0 -111
  44. package/node_modules/@humwick/offload/dist/types.d.ts.map +0 -1
  45. package/node_modules/@humwick/offload/dist/types.js +0 -176
  46. package/node_modules/@humwick/offload/dist/types.js.map +0 -1
  47. package/node_modules/@humwick/offload/dist/worker-pool.d.ts +0 -23
  48. package/node_modules/@humwick/offload/dist/worker-pool.d.ts.map +0 -1
  49. package/node_modules/@humwick/offload/dist/worker-pool.js +0 -435
  50. package/node_modules/@humwick/offload/dist/worker-pool.js.map +0 -1
  51. package/node_modules/@humwick/offload/dist/worker-runtime.d.ts +0 -2
  52. package/node_modules/@humwick/offload/dist/worker-runtime.d.ts.map +0 -1
  53. package/node_modules/@humwick/offload/dist/worker-runtime.js +0 -27
  54. package/node_modules/@humwick/offload/dist/worker-runtime.js.map +0 -1
  55. package/node_modules/@humwick/offload/dist/worker.d.ts +0 -5
  56. package/node_modules/@humwick/offload/dist/worker.d.ts.map +0 -1
  57. package/node_modules/@humwick/offload/dist/worker.js +0 -1
  58. package/node_modules/@humwick/offload/dist/worker.js.map +0 -1
  59. package/node_modules/@humwick/offload/package.json +0 -42
  60. package/node_modules/@humwick/offload/src/async-runner.ts +0 -170
  61. package/node_modules/@humwick/offload/src/envelope.ts +0 -92
  62. package/node_modules/@humwick/offload/src/fixtures/worker-task.ts +0 -49
  63. package/node_modules/@humwick/offload/src/index.ts +0 -4
  64. package/node_modules/@humwick/offload/src/subprocess-runner.ts +0 -334
  65. package/node_modules/@humwick/offload/src/types.ts +0 -235
  66. package/node_modules/@humwick/offload/src/worker-pool.ts +0 -463
  67. package/node_modules/@humwick/offload/src/worker-runtime.ts +0 -32
  68. package/node_modules/@humwick/offload/src/worker.ts +0 -5
  69. package/src/gate-run-lease-probe.ts +0 -38
@@ -1,80 +0,0 @@
1
- import { OffloadError, log, validateTimeout } from "./types.js";
2
- /**
3
- * `teardown` is the backend's own cancellation channel (runner `destroy()`); it is composed
4
- * with the caller's signal and the deadline so every backend has exactly one signal to observe.
5
- */
6
- export function beginRun(taskName, env, defaults, teardown, timeoutMsOverride) {
7
- // `timeoutMsOverride` lets the WorkerPool pass an ALREADY-RESOLVED timeout: a number (e.g. the
8
- // remaining budget of an absolute deadline on a retry-safe re-dispatch, #1822 MED-2) or `null`
9
- // meaning "no deadline, definitively." Either way it is authoritative and already validated, so
10
- // the envelope AND the mutable pool default are NOT re-read — that is what keeps a post-submission
11
- // mutation of either from adding or erasing this job's deadline (#1822 MED). `null` is used for
12
- // "no deadline" rather than `undefined` on purpose: `undefined` is indistinguishable from "no
13
- // argument passed", which is how the async/subprocess runners ask to resolve from env/default.
14
- const timeoutMs = timeoutMsOverride === undefined
15
- ? validateTimeout(env?.timeoutMs ?? defaults.defaultTimeoutMs)
16
- : (timeoutMsOverride ?? undefined);
17
- const timeout = new AbortController();
18
- const sources = [env?.signal, teardown].filter((source) => source !== undefined);
19
- const signal = sources.length === 0 ? timeout.signal : AbortSignal.any([...sources, timeout.signal]);
20
- let timedOut = false;
21
- const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
22
- timedOut = true;
23
- timeout.abort(new DOMException(`Timed out after ${timeoutMs}ms`, "TimeoutError"));
24
- }, timeoutMs);
25
- return {
26
- signal,
27
- timeoutMs,
28
- cleanup: () => { if (timer)
29
- clearTimeout(timer); },
30
- abortError: () => new OffloadError({
31
- kind: timedOut ? "timeout" : "aborted",
32
- taskName,
33
- message: timedOut ? `${taskName} timed out after ${timeoutMs}ms` : `${taskName} was aborted`,
34
- cause: signal.reason,
35
- }),
36
- };
37
- }
38
- // Labels are spread FIRST throughout: adopters pass generic context bags, and a label that
39
- // happens to be named `taskName` or `backend` must not silently replace the envelope's own
40
- // fields — that would destroy exactly the uniformity this logging contract exists to provide.
41
- export function startLog(logger, backend, taskName, labels) {
42
- const startedAt = performance.now();
43
- log(logger, "debug", "offload started", { ...labels, backend, taskName });
44
- return startedAt;
45
- }
46
- export function finishLog(logger, backend, taskName, labels, startedAt, error) {
47
- const fields = { ...labels, backend, taskName, tookMs: Math.round(performance.now() - startedAt) };
48
- if (error)
49
- log(logger, "warn", "offload failed", { ...fields, kind: error.kind, code: error.code, error: error.message });
50
- else
51
- log(logger, "debug", "offload completed", fields);
52
- }
53
- export async function recordResult(options) {
54
- if (!options.error) {
55
- options.counter.succeed(options.taskName);
56
- return;
57
- }
58
- // Caller-directed cancellation is neither a backend failure nor a timeout. It must not
59
- // page a host merely because a legitimate shutdown cancelled several queued operations.
60
- if (options.error.kind === "aborted")
61
- return;
62
- const strikes = options.counter.fail(options.taskName);
63
- if (strikes < options.counter.threshold)
64
- return;
65
- // Like the maintenance breaker, escalation is edge-triggered: one notification at
66
- // the threshold, then a latch until a successful run re-arms the task.
67
- options.counter.trip(options.taskName);
68
- if (!options.sink)
69
- return;
70
- try {
71
- await options.sink({ taskName: options.taskName, backend: options.backend, error: options.error, strikes, labels: options.labels });
72
- }
73
- catch (error) {
74
- log(options.logger, "error", "offload escalation sink failed", { taskName: options.taskName, backend: options.backend, error: String(error) });
75
- }
76
- }
77
- export function errorForExit(taskName, code) {
78
- return new OffloadError({ kind: "worker-exit", taskName, code, message: `${taskName} worker exited${code ? ` (${code})` : ""}` });
79
- }
80
- //# sourceMappingURL=envelope.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../src/envelope.ts"],"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AAO,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,iBAAiB,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AACpI,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { OffloadWorkerTask } from "../worker.js";
2
- declare const task: OffloadWorkerTask<{
3
- kind: string;
4
- ms?: number;
5
- value?: unknown;
6
- file?: string;
7
- code?: number;
8
- }, unknown>;
9
- export default task;
10
- //# sourceMappingURL=worker-task.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-task.d.ts","sourceRoot":"","sources":["../../src/fixtures/worker-task.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,CAuClH,CAAC;eAEa,IAAI"}
@@ -1,59 +0,0 @@
1
- import { appendFileSync, readFileSync } from "node:fs";
2
- // `file`-based counters let a test count executions/deaths deterministically across worker
3
- // threads (a shared in-process counter is not visible from a worker), so the #1822 F2/F3 tests
4
- // can PROVE the mechanism (exactly-once, bounded retries, real deaths) instead of hoping on
5
- // timing. Each execution/death appends one byte; the test reads the file size.
6
- const task = async (input) => {
7
- if (input.kind === "burn") {
8
- const until = Date.now() + (input.ms ?? 0);
9
- while (Date.now() < until) { /* intentionally synchronous: timeout must terminate this worker */ }
10
- return input.value ?? "burned";
11
- }
12
- if (input.kind === "delay") {
13
- await Bun.sleep(input.ms ?? 0);
14
- return input.value;
15
- }
16
- if (input.kind === "throw")
17
- throw Object.assign(new RangeError("bad worker input"), { code: "BAD_INPUT" });
18
- if (input.kind === "exit")
19
- process.exit(1);
20
- // Returns a value now, then exits AFTER the slot has gone idle: simulates an OOM/SIGKILL
21
- // that lands on a worker between jobs, which is the #1822 item 2 scenario. Records the death
22
- // to `file` (if given) so a test can assert the deaths actually happened.
23
- if (input.kind === "exit-when-idle") {
24
- setTimeout(() => { if (input.file)
25
- appendFileSync(input.file, "d"); process.exit(0); }, input.ms ?? 20);
26
- return input.value ?? "ok";
27
- }
28
- // Optionally runs for `ms` (so a deadline can bite mid-execution), records one execution to
29
- // `file`, then exits the worker every time. Exits with `code` (default 1 = abnormal); pass
30
- // code 0 to model a CLEAN worker exit while a job is in flight. Used to prove at-most-once
31
- // (default → one record) vs bounded retry (retrySafe → MAX+1 records), the absolute deadline,
32
- // and exit-manner attribution (abnormal charges, clean does not — #1822 MED-4).
33
- if (input.kind === "crash-record") {
34
- if (input.ms)
35
- await Bun.sleep(input.ms);
36
- if (input.file)
37
- appendFileSync(input.file, "x");
38
- process.exit(input.code ?? 1);
39
- }
40
- // Records one execution, then crashes ONLY on the first execution (file was empty) and succeeds
41
- // on any retry — proves a retry-safe re-dispatch recovers and is bounded (file has 2 records).
42
- if (input.kind === "flaky-record") {
43
- let prior = 0;
44
- try {
45
- prior = input.file ? readFileSync(input.file, "utf8").length : 0;
46
- }
47
- catch {
48
- prior = 0;
49
- }
50
- if (input.file)
51
- appendFileSync(input.file, "x");
52
- if (prior === 0)
53
- process.exit(1);
54
- return input.value ?? "recovered";
55
- }
56
- return input.value;
57
- };
58
- export default task;
59
- //# sourceMappingURL=worker-task.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-task.js","sourceRoot":"","sources":["../../src/fixtures/worker-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvD,2FAA2F;AAC3F,+FAA+F;AAC/F,4FAA4F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;IAC3F,2FAA2F;IAC3F,8FAA8F;IAC9F,gFAAgF;IAChF,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QAClC,IAAI,KAAK,CAAC,EAAE;YAAE,MAAM,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACxC,IAAI,KAAK,CAAC,IAAI;YAAE,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;IAChC,CAAC;IACD,gGAAgG;IAChG,+FAA+F;IAC/F,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QAClC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,CAAC;YAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,KAAK,GAAG,CAAC,CAAC;QAAC,CAAC;QAC9F,IAAI,KAAK,CAAC,IAAI;YAAE,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAChD,IAAI,KAAK,KAAK,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjC,OAAO,KAAK,CAAC,KAAK,IAAI,WAAW,CAAC;IACpC,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,5 +0,0 @@
1
- export { createAsyncRunner, type AsyncRunner, type AsyncRunnerOptions } from "./async-runner.js";
2
- export { createSubprocessRunner, type SubprocessResult, type SubprocessRunner, type SubprocessRunnerOptions, type SubprocessSpec } from "./subprocess-runner.js";
3
- export { createWorkerPool, type WorkerPool, type WorkerPoolOptions, type WorkerPoolStats } from "./worker-pool.js";
4
- export { OffloadError, StrikeCounter, type EscalationEvent, type EscalationSink, type OffloadDefaults, type OffloadEnvelope, type OffloadErrorKind, type OffloadLogger } from "./types.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACjK,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -1,5 +0,0 @@
1
- export { createAsyncRunner } from "./async-runner.js";
2
- export { createSubprocessRunner } from "./subprocess-runner.js";
3
- export { createWorkerPool } from "./worker-pool.js";
4
- export { OffloadError, StrikeCounter } from "./types.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6C,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAmG,MAAM,wBAAwB,CAAC;AACjK,OAAO,EAAE,gBAAgB,EAAiE,MAAM,kBAAkB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAoI,MAAM,YAAY,CAAC"}
@@ -1,62 +0,0 @@
1
- import { type OffloadDefaults, type OffloadEnvelope } from "./types.js";
2
- export interface SubprocessSpec {
3
- command: string[];
4
- cwd?: string;
5
- env?: Record<string, string | undefined>;
6
- /**
7
- * Exit codes that are a normal ANSWER rather than a failure. Defaults to `[0]`; pass
8
- * `"any"` when every code is data (a land gate whose failing codes are not enumerable).
9
- *
10
- * Probe-shaped callers use a non-zero exit as data — `tmux has-session` exits 1 when the
11
- * session is absent, `git rev-parse` exits 128 outside a repo, `which` exits 1. Without
12
- * this they reject AND take an escalation strike for a healthy result, which inverts the
13
- * signal: the sink pages on a healthy fleet, then latches (it only re-arms on a success,
14
- * which never comes in that steady state) so the real outage is silent.
15
- *
16
- * `"any"` includes SIGNAL DEATHS — a child killed by SIGKILL (137) or SIGSEGV (139)
17
- * returns as a success and RE-ARMS the strike counter. That is intended for a land gate,
18
- * where an OOM-killed gate is simply a failed gate, but it means an infrastructure death
19
- * reads as a healthy answer and will never escalate. Prefer an explicit code list unless
20
- * the failing codes genuinely cannot be enumerated. Timeout and abort still throw.
21
- */
22
- okExitCodes?: readonly number[] | "any";
23
- }
24
- export interface SubprocessResult {
25
- exitCode: number;
26
- stdout: string;
27
- stderr: string;
28
- /** True when either stream hit `maxOutputBytes` and the captured text was cut short. */
29
- truncated: boolean;
30
- }
31
- export interface SubprocessRunnerOptions extends OffloadDefaults {
32
- concurrency?: number;
33
- /**
34
- * How long a child may keep running after SIGTERM before it is SIGKILLed. This is the
35
- * slack on the deadline: a run cannot outlive `timeoutMs + killGraceMs` (plus a short
36
- * reap window) even if it traps or ignores SIGTERM. Defaults to 2000ms.
37
- */
38
- killGraceMs?: number;
39
- /** Captured bytes per stream before output is truncated. Defaults to 8 MiB. */
40
- maxOutputBytes?: number;
41
- }
42
- export interface SubprocessRunner {
43
- run(taskName: string, process: SubprocessSpec, env?: OffloadEnvelope): Promise<SubprocessResult>;
44
- readonly stats: {
45
- active: number;
46
- queued: number;
47
- };
48
- /** A subprocess owns the heavy work, so maintenance callers may mark their await window off-thread. */
49
- readonly offThread: true;
50
- /** Resolves when everything accepted so far has finished. Does not cancel anything. */
51
- drain(): Promise<void>;
52
- /** SIGKILLs and awaits every live child, settles every outstanding caller, and refuses new work. */
53
- destroy(): Promise<void>;
54
- }
55
- /**
56
- * Bounded wrapper around the repo's standard `Bun.spawn(... { stdout: "pipe", stderr: "pipe" })`
57
- * pattern. On POSIX, each run gets its own process group so timeout/abort also kills
58
- * descendants (for example shell, git, or install subprocess trees); Windows falls back
59
- * to Bun's direct-child kill because POSIX process groups do not exist there.
60
- */
61
- export declare function createSubprocessRunner(options?: SubprocessRunnerOptions): SubprocessRunner;
62
- //# sourceMappingURL=subprocess-runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subprocess-runner.d.ts","sourceRoot":"","sources":["../src/subprocess-runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAEtI,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjG,QAAQ,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,uGAAuG;IACvG,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,uFAAuF;IACvF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,oGAAoG;IACpG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAmFD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,gBAAgB,CA4L9F"}
@@ -1,295 +0,0 @@
1
- import PQueue from "p-queue";
2
- import { beginRun, finishLog, recordResult, startLog } from "./envelope.js";
3
- import { OffloadError, StrikeCounter, normalizeError, validateTimeout } from "./types.js";
4
- const DEFAULT_KILL_GRACE_MS = 2_000;
5
- const DEFAULT_MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
6
- /** How long to wait for a SIGKILLed child to be reaped before giving its slot back anyway. */
7
- const REAP_GRACE_MS = 1_000;
8
- /**
9
- * `detached` children are reparented rather than reaped when the host dies (#1809 P1-5), so
10
- * every live group is killed from a single process-level exit hook. One module-scoped hook
11
- * keeps runner instances from piling up `exit` listeners.
12
- */
13
- const liveChildren = new Set();
14
- let exitHookInstalled = false;
15
- function killGroup(child, signal) {
16
- try {
17
- if (process.platform !== "win32")
18
- process.kill(-child.pid, signal);
19
- else
20
- child.kill();
21
- }
22
- catch {
23
- try {
24
- child.kill(signal);
25
- }
26
- catch { /* the child is already gone */ }
27
- }
28
- }
29
- function trackChild(child) {
30
- liveChildren.add(child);
31
- if (exitHookInstalled)
32
- return;
33
- exitHookInstalled = true;
34
- process.on("exit", () => {
35
- for (const live of liveChildren)
36
- killGroup(live, "SIGKILL");
37
- });
38
- }
39
- /** Reads a stream up to `limit` bytes, then keeps draining so the child never blocks on a full pipe. */
40
- async function readCapped(stream, limit) {
41
- if (!stream)
42
- return { text: "", truncated: false };
43
- const reader = stream.getReader();
44
- const chunks = [];
45
- let size = 0;
46
- let truncated = false;
47
- try {
48
- for (;;) {
49
- const { done, value } = await reader.read();
50
- if (done)
51
- break;
52
- if (!value)
53
- continue;
54
- const remaining = limit - size;
55
- if (remaining <= 0) {
56
- truncated = true;
57
- continue;
58
- }
59
- if (value.byteLength > remaining) {
60
- chunks.push(value.subarray(0, remaining));
61
- size = limit;
62
- truncated = true;
63
- continue;
64
- }
65
- chunks.push(value);
66
- size += value.byteLength;
67
- }
68
- }
69
- finally {
70
- reader.releaseLock();
71
- }
72
- const buffer = new Uint8Array(size);
73
- let offset = 0;
74
- for (const chunk of chunks) {
75
- buffer.set(chunk, offset);
76
- offset += chunk.byteLength;
77
- }
78
- return { text: new TextDecoder().decode(buffer), truncated };
79
- }
80
- /**
81
- * Bounded wrapper around the repo's standard `Bun.spawn(... { stdout: "pipe", stderr: "pipe" })`
82
- * pattern. On POSIX, each run gets its own process group so timeout/abort also kills
83
- * descendants (for example shell, git, or install subprocess trees); Windows falls back
84
- * to Bun's direct-child kill because POSIX process groups do not exist there.
85
- */
86
- export function createSubprocessRunner(options = {}) {
87
- const queue = new PQueue({ concurrency: options.concurrency ?? 1 });
88
- const counter = new StrikeCounter(options.escalationThreshold, options.escalationWindowAttempts);
89
- const killGraceMs = options.killGraceMs ?? DEFAULT_KILL_GRACE_MS;
90
- const maxOutputBytes = options.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
91
- if (!Number.isFinite(killGraceMs) || killGraceMs < 0)
92
- throw new RangeError("killGraceMs must be a non-negative finite number");
93
- if (!Number.isSafeInteger(maxOutputBytes) || maxOutputBytes < 1)
94
- throw new RangeError("maxOutputBytes must be a positive integer");
95
- const live = new Set();
96
- const children = new Set();
97
- let destroyed = false;
98
- const abortedError = (taskName, cause) => new OffloadError({ kind: "aborted", taskName, message: `${taskName} was aborted`, cause });
99
- const destroyedError = (taskName) => new OffloadError({ kind: "aborted", taskName, message: `${taskName} was cancelled: subprocess runner destroyed` });
100
- return {
101
- offThread: true,
102
- get stats() { return { active: queue.pending, queued: queue.size }; },
103
- async run(taskName, spec, env) {
104
- const labels = env?.labels ?? {};
105
- const logger = env?.logger ?? options.logger;
106
- const sink = env?.onEscalate ?? options.onEscalate;
107
- const reportRejection = async (error) => {
108
- // Rejecting before the run reaches startLog is still a terminal outcome; without this
109
- // the structured stream shows nothing at all for it.
110
- finishLog(logger, "subprocess", taskName, labels, performance.now(), error);
111
- await recordResult({ counter, taskName, backend: "subprocess", labels, error, sink, logger });
112
- throw error;
113
- };
114
- if (!spec.command.length)
115
- return reportRejection(new OffloadError({ kind: "rejected", taskName, message: "Subprocess command must not be empty" }));
116
- if (destroyed)
117
- return reportRejection(destroyedError(taskName));
118
- if (env?.signal?.aborted)
119
- return reportRejection(abortedError(taskName, env.signal.reason));
120
- try {
121
- validateTimeout(env?.timeoutMs ?? options.defaultTimeoutMs);
122
- }
123
- catch (error) {
124
- return reportRejection(normalizeError(taskName, error, "rejected"));
125
- }
126
- let publish;
127
- let published = false;
128
- const outcome = new Promise((resolve) => {
129
- publish = (value) => { if (!published) {
130
- published = true;
131
- resolve(value);
132
- } };
133
- });
134
- let started = false;
135
- let cancelled = false;
136
- const entry = {
137
- taskName,
138
- teardown: new AbortController(),
139
- settled: outcome.then(() => undefined),
140
- cancelIfQueued: (error) => {
141
- if (started || cancelled)
142
- return;
143
- cancelled = true;
144
- // The single funnel for both abort-while-queued and destroy()-cancels-queued, so
145
- // the one line each terminal path owes the structured stream is emitted here. The
146
- // callback bails on `cancelled` without logging, which keeps it to exactly one.
147
- finishLog(logger, "subprocess", taskName, labels, performance.now(), error);
148
- publish({ ok: false, error });
149
- },
150
- };
151
- live.add(entry);
152
- // p-queue's own `signal` option used to provide prompt abort for queued runs, but it
153
- // also released the slot while the child kept running (#1809 P1-7).
154
- const signal = env?.signal;
155
- const onQueuedAbort = signal ? () => entry.cancelIfQueued(abortedError(taskName, signal.reason)) : undefined;
156
- if (signal && onQueuedAbort)
157
- signal.addEventListener("abort", onQueuedAbort, { once: true });
158
- const task = queue.add(async () => {
159
- if (signal && onQueuedAbort)
160
- signal.removeEventListener("abort", onQueuedAbort);
161
- let context;
162
- let child;
163
- let onAbort;
164
- let killTimer;
165
- let abandonTimer;
166
- let reaped = false;
167
- let abandon;
168
- const abandoned = new Promise((resolve) => { abandon = () => resolve("abandoned"); });
169
- try {
170
- if (cancelled)
171
- return;
172
- if (destroyed || entry.teardown.signal.aborted) {
173
- const error = destroyedError(taskName);
174
- finishLog(logger, "subprocess", taskName, labels, performance.now(), error);
175
- publish({ ok: false, error });
176
- return;
177
- }
178
- started = true;
179
- context = beginRun(taskName, env, options, entry.teardown.signal);
180
- const run = context;
181
- const startedAt = startLog(logger, "subprocess", taskName, labels);
182
- // SIGTERM alone bounds nothing: a child that traps or ignores it runs to completion
183
- // while holding the slot (#1809 P0-3). Escalate to a group SIGKILL, then stop
184
- // waiting altogether so the deadline is real even for an unkillable child.
185
- onAbort = () => {
186
- if (!child || reaped)
187
- return;
188
- killGroup(child, "SIGTERM");
189
- killTimer = setTimeout(() => {
190
- // `reaped` keeps a late timer from signalling a process group whose pid the
191
- // kernel may already have handed to somebody else.
192
- if (!child || reaped)
193
- return;
194
- killGroup(child, "SIGKILL");
195
- abandonTimer = setTimeout(abandon, REAP_GRACE_MS);
196
- }, killGraceMs);
197
- };
198
- run.signal.addEventListener("abort", onAbort, { once: true });
199
- try {
200
- if (run.signal.aborted)
201
- throw run.abortError();
202
- child = Bun.spawn(spec.command, {
203
- cwd: spec.cwd,
204
- env: spec.env ? { ...process.env, ...spec.env } : process.env,
205
- stdin: "ignore", stdout: "pipe", stderr: "pipe",
206
- detached: process.platform !== "win32",
207
- });
208
- trackChild(child);
209
- children.add(child);
210
- const exiting = child;
211
- void exiting.exited.then(() => {
212
- reaped = true;
213
- liveChildren.delete(exiting);
214
- children.delete(exiting);
215
- });
216
- const completed = Promise.all([
217
- readCapped(child.stdout, maxOutputBytes),
218
- readCapped(child.stderr, maxOutputBytes),
219
- child.exited,
220
- ]);
221
- const settledRun = await Promise.race([completed, abandoned]);
222
- if (settledRun === "abandoned") {
223
- throw run.signal.aborted
224
- ? run.abortError()
225
- : new OffloadError({ kind: "timeout", taskName, message: `${taskName} did not exit after SIGKILL` });
226
- }
227
- const [stdout, stderr, exitCode] = settledRun;
228
- if (run.signal.aborted)
229
- throw run.abortError();
230
- const okExitCodes = spec.okExitCodes ?? [0];
231
- if (okExitCodes !== "any" && !okExitCodes.includes(exitCode))
232
- throw new OffloadError({
233
- kind: "rejected", taskName, code: String(exitCode), message: `${taskName} exited ${exitCode}: ${stderr.text.trim() || stdout.text.trim()}`,
234
- });
235
- const result = { exitCode, stdout: stdout.text, stderr: stderr.text, truncated: stdout.truncated || stderr.truncated };
236
- finishLog(logger, "subprocess", taskName, labels, startedAt);
237
- await recordResult({ counter, taskName, backend: "subprocess", labels, sink, logger });
238
- publish({ ok: true, value: result });
239
- }
240
- catch (error) {
241
- const normalized = run.signal.aborted ? run.abortError() : normalizeError(taskName, error);
242
- finishLog(logger, "subprocess", taskName, labels, startedAt, normalized);
243
- await recordResult({ counter, taskName, backend: "subprocess", labels, error: normalized, sink, logger });
244
- publish({ ok: false, error: normalized });
245
- }
246
- finally {
247
- if (onAbort)
248
- run.signal.removeEventListener("abort", onAbort);
249
- run.cleanup();
250
- }
251
- }
252
- catch (error) {
253
- const normalized = normalizeError(taskName, error, "rejected");
254
- finishLog(logger, "subprocess", taskName, labels, performance.now(), normalized);
255
- await recordResult({ counter, taskName, backend: "subprocess", labels, error: normalized, sink, logger });
256
- publish({ ok: false, error: normalized });
257
- }
258
- finally {
259
- context?.cleanup();
260
- // Keep the slot until the child is actually reaped, so the concurrency cap and
261
- // `stats` stay true while a kill is in flight (#1809 P1-7). `abandoned` bounds
262
- // this: the SIGKILL escalation above always ends the wait.
263
- if (child)
264
- await Promise.race([child.exited, abandoned]);
265
- if (killTimer)
266
- clearTimeout(killTimer);
267
- if (abandonTimer)
268
- clearTimeout(abandonTimer);
269
- live.delete(entry);
270
- }
271
- });
272
- void task.catch(() => undefined);
273
- const result = await outcome;
274
- if (!result.ok)
275
- throw result.error;
276
- return result.value;
277
- },
278
- drain: () => queue.onIdle(),
279
- async destroy() {
280
- destroyed = true;
281
- const outstanding = [...live];
282
- for (const entry of outstanding) {
283
- entry.cancelIfQueued(destroyedError(entry.taskName));
284
- entry.teardown.abort(new DOMException("Subprocess runner destroyed", "AbortError"));
285
- }
286
- for (const child of children)
287
- killGroup(child, "SIGKILL");
288
- await Promise.all([
289
- ...outstanding.map((entry) => entry.settled),
290
- ...[...children].map((child) => child.exited),
291
- ]);
292
- },
293
- };
294
- }
295
- //# sourceMappingURL=subprocess-runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subprocess-runner.js","sourceRoot":"","sources":["../src/subprocess-runner.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAA8C,MAAM,YAAY,CAAC;AA0DtI,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,wBAAwB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACjD,8FAA8F;AAC9F,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B;;;;GAIG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,EAAS,CAAC;AACtC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAE9B,SAAS,SAAS,CAAC,KAAY,EAAE,MAAsB;IACrD,IAAI,CAAC;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