c8ctl-plugin-nano 1.70.8 → 1.71.0

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 (2) hide show
  1. package/c8ctl-plugin.js +39 -1
  2. package/package.json +8 -8
package/c8ctl-plugin.js CHANGED
@@ -9961,6 +9961,39 @@ function baseAgentEnv(profile, job) {
9961
9961
  * is force-removed so it never leaks a slot or disk.
9962
9962
  * Both paths resolve to the same result contract.
9963
9963
  */
9964
+ // #305: derive the harness PROVIDER timeout from the worker idle-kill budget.
9965
+ // The worker idle-kills a silent harness after `idleTimeoutMs`; if the harness's
9966
+ // own provider (LLM request) stall timeout is >= that budget, a hung model request
9967
+ // kills the WHOLE run instead of being retried inside the harness. We hand the
9968
+ // harness `NANO_CODER_PROVIDER_TIMEOUT_SECS = floor(idleMs/1000/2)` so a stalled
9969
+ // request always times out (and can retry) well inside the idle window. Returns
9970
+ // null when there is no idle kill (<= 0 / non-finite) or the budget is too small
9971
+ // to express a whole-second timeout strictly below it. Invariant (tested):
9972
+ // `secs * 1000 < idleTimeoutMs` whenever non-null.
9973
+ export const PROVIDER_TIMEOUT_ENV = 'NANO_CODER_PROVIDER_TIMEOUT_SECS';
9974
+ export function deriveProviderTimeoutSecs(idleTimeoutMs) {
9975
+ const ms = Number(idleTimeoutMs);
9976
+ if (!Number.isFinite(ms) || ms <= 0) return null;
9977
+ const secs = Math.floor(ms / 1000 / 2);
9978
+ return secs >= 1 ? secs : null;
9979
+ }
9980
+ export function providerTimeoutEnv(idleTimeoutMs) {
9981
+ const secs = deriveProviderTimeoutSecs(idleTimeoutMs);
9982
+ return secs == null ? {} : { [PROVIDER_TIMEOUT_ENV]: String(secs) };
9983
+ }
9984
+ // #305: startup guard — a profile-configured harness provider timeout that is
9985
+ // >= the idle budget means a hung request idle-kills the run. Returns a warning
9986
+ // string (or null).
9987
+ export function providerTimeoutWarning(env, idleTimeoutMs) {
9988
+ const raw = env && typeof env === 'object' ? env[PROVIDER_TIMEOUT_ENV] : undefined;
9989
+ const ms = Number(idleTimeoutMs);
9990
+ if (raw == null || String(raw).trim() === '' || !Number.isFinite(ms) || ms <= 0) return null;
9991
+ const secs = Number(String(raw).trim());
9992
+ if (!Number.isFinite(secs)) return null;
9993
+ if (secs * 1000 < ms) return null;
9994
+ return `configured harness provider timeout ${PROVIDER_TIMEOUT_ENV}=${raw}s is >= the worker idle budget (${ms}ms) — a hung model request will idle-kill the whole run instead of being retried inside the harness; lower it below ${Math.floor(ms / 1000)}s (derived default: ${deriveProviderTimeoutSecs(ms) ?? 'unset'}s)`;
9995
+ }
9996
+
9964
9997
  function runAgentJob(profile, job, opts = {}) {
9965
9998
  const { timeoutMs, idleTimeoutMs, recoveryWindowMs, envelope, sandbox = 'none', image, runId, secretEnv = {}, passThroughSecretNames = [], cwd, extraEnv = {}, profileEnv = {}, gitEnv = null, resultFile, stream = false, streamPrefix = '', onStreamOut, onStreamErr, args: commandArgs, terminal = 'pipe', protocol = 'pipe', permission = 'yolo', relaySession = null, ptyFactory, nudgePayload = null, onAcpUpdate = null, abortSignal = null, onSpawn = null, resumePlan = null } = opts;
9966
9999
  // #110: `protocol`/`permission` drive the ACP executor branch below. The
@@ -9982,7 +10015,7 @@ function runAgentJob(profile, job, opts = {}) {
9982
10015
  // harness's permission toggles) plus the per-job envelope's setup.env
9983
10016
  // (job-specific tuning wins over the profile default). Reserved AGENT_* and
9984
10017
  // resolved secrets are layered on top so user env can never shadow them.
9985
- const staticEnv = { ...normalizeEnvMap(profileEnv), ...normalizeEnvMap(envelope?.setup?.env) };
10018
+ const staticEnv = { ...providerTimeoutEnv(idleTimeoutMs), ...normalizeEnvMap(profileEnv), ...normalizeEnvMap(envelope?.setup?.env) };
9986
10019
  // #283: the provisioning git env (non-interactive editor no-ops,
9987
10020
  // GIT_TERMINAL_PROMPT=0, GIT_CONFIG_NOSYSTEM=1, …) is the harness env's
9988
10021
  // BOTTOM layer above process.env — a headless agent's own `git commit` (no
@@ -11953,6 +11986,11 @@ async function workAgent(req, flags, ctx) {
11953
11986
  logger.info(` sandbox: ${sandbox}${isContainer ? ` (image ${image})` : ''}`);
11954
11987
  const profileEnvKeys = Object.keys(profileEnv);
11955
11988
  if (profileEnvKeys.length > 0) logger.info(` harness env: ${profileEnvKeys.join(', ')}`);
11989
+ {
11990
+ const ptWarn = providerTimeoutWarning(profileEnv, idleTimeoutMs);
11991
+ if (ptWarn) logger.warn(` ${ptWarn}`);
11992
+ else if (deriveProviderTimeoutSecs(idleTimeoutMs) != null && !(PROVIDER_TIMEOUT_ENV in profileEnv)) logger.info(` harness provider timeout: ${PROVIDER_TIMEOUT_ENV}=${deriveProviderTimeoutSecs(idleTimeoutMs)}s (derived from idle budget ${idleTimeoutMs}ms)`);
11993
+ }
11956
11994
  if (autoMode) {
11957
11995
  logger.info(` enrolment: --auto (zero-config engine read${autoScope ? `, scope "${autoScope}"` : ', all agent job types'}) — no capability gate; serves any deployed agent job on this engine.`);
11958
11996
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c8ctl-plugin-nano",
3
- "version": "1.70.8",
3
+ "version": "1.71.0",
4
4
  "type": "module",
5
5
  "description": "c8ctl plugin to start, inspect, and stop a local Nano BPM (nanobpmn) cluster",
6
6
  "main": "c8ctl-plugin.js",
@@ -76,12 +76,12 @@
76
76
  },
77
77
  "optionalDependencies": {
78
78
  "node-pty": "^1.0.0",
79
- "@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.70.8",
80
- "@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.70.8",
81
- "@nanobpm/c8ctl-plugin-nano-linux-x64": "1.70.8",
82
- "@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.70.8",
83
- "@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.70.8",
84
- "@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.70.8",
85
- "@nanobpm/c8ctl-plugin-nano-win32-x64": "1.70.8"
79
+ "@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.71.0",
80
+ "@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.71.0",
81
+ "@nanobpm/c8ctl-plugin-nano-linux-x64": "1.71.0",
82
+ "@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.71.0",
83
+ "@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.71.0",
84
+ "@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.71.0",
85
+ "@nanobpm/c8ctl-plugin-nano-win32-x64": "1.71.0"
86
86
  }
87
87
  }