c8ctl-plugin-nano 1.69.5 → 1.70.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.
- package/c8ctl-plugin.js +61 -1
- package/nanobpmn-binary.json +3 -3
- package/package.json +8 -8
package/c8ctl-plugin.js
CHANGED
|
@@ -4630,6 +4630,40 @@ function boundGitOutput(text, max = 500) {
|
|
|
4630
4630
|
// (remote git output is repository-controlled — a log-spoofing/dilution vector).
|
|
4631
4631
|
const oneLineLog = (v) => String(v ?? '').replace(/[\r\n\t\f\v\u0085\u2028\u2029]+/g, ' ');
|
|
4632
4632
|
|
|
4633
|
+
// #282 (class fix): settle the runner's OUTER catch — an unexpected throw anywhere
|
|
4634
|
+
// on the settlement path (e.g. the preGuardDrainTimedOut ReferenceError this issue
|
|
4635
|
+
// fixed) must FAIL the job rather than escape to the supervisor's `run failed` log
|
|
4636
|
+
// and leave the job to time out and re-activate forever. Extracted from the runner's
|
|
4637
|
+
// catch so the production behavior (abort → no settle; unexpected throw → settleJob.fail
|
|
4638
|
+
// with retries preserved; a rejected fallback fail → contained, left for the broker)
|
|
4639
|
+
// is exercised directly by tests (empty-job-guard.test.mjs) rather than only scanned
|
|
4640
|
+
// in source. Returns the settleJob.fail result on the fail path, and undefined when the
|
|
4641
|
+
// run was aborted or the fallback fail itself rejected (matching the runner's `return;`).
|
|
4642
|
+
async function settleRunError({ err, abortSignal, settleJob, profileName, jobType, jobKey, retries, logger }) {
|
|
4643
|
+
// An ABORTED run (force-stop / lock-loss) must NOT be failed here: its lease is
|
|
4644
|
+
// already being yielded/transferred, so return WITHOUT settling and let the
|
|
4645
|
+
// force-stop yield win — exactly as the setup-abort gates do.
|
|
4646
|
+
if (abortSignal?.aborted === true) {
|
|
4647
|
+
logger.warn(`[${jobType}] job ${jobKey} aborted mid-settlement — lease loss/force-stop won the race; stopping without a settle (the job is being yielded for retry).`);
|
|
4648
|
+
return undefined;
|
|
4649
|
+
}
|
|
4650
|
+
const errMsg = err instanceof Error ? (err.stack || err.message) : String(err);
|
|
4651
|
+
logger.error(`[${jobType}] job ${jobKey}: settlement-path error — failing job rather than leaving it unsettled (retries left ${retries}) — ${oneLineLog(errMsg)}`);
|
|
4652
|
+
try {
|
|
4653
|
+
return await settleJob.fail({
|
|
4654
|
+
errorMessage: `agent "${profileName}" settlement error: ${oneLineLog(err?.message || err)}`.slice(0, 2000),
|
|
4655
|
+
retries,
|
|
4656
|
+
});
|
|
4657
|
+
} catch (settleErr) {
|
|
4658
|
+
// The fail-settle itself rejected (e.g. the lease already lapsed and the broker
|
|
4659
|
+
// reclaimed the job — a 409/404). There is nothing more this worker can do: log
|
|
4660
|
+
// and return so the error does not propagate as a SECOND, masking failure. The
|
|
4661
|
+
// job is then the broker's to re-deliver.
|
|
4662
|
+
logger.error(`[${jobType}] job ${jobKey}: settlement-path fail also failed — job left for the broker to re-deliver — ${oneLineLog(settleErr?.message || settleErr)}`);
|
|
4663
|
+
return undefined;
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4633
4667
|
// Build an informative, token-redacted failure reason from a runGit result.
|
|
4634
4668
|
// Two things the old `stderr || stdout`.slice(0,500) message threw away:
|
|
4635
4669
|
// 1. On a timeout Node SIGTERM-kills git (status→128, signal='SIGTERM') — say
|
|
@@ -11129,6 +11163,13 @@ async function workAgent(req, flags, ctx) {
|
|
|
11129
11163
|
// try body, so an early throw is correctly reported as `error`.
|
|
11130
11164
|
let runCompleted = false;
|
|
11131
11165
|
let discardCheckpointOnAck = false;
|
|
11166
|
+
// #282: settlement-scoped. The empty-job guard reads this AFTER the run
|
|
11167
|
+
// try/finally below has closed, so it must be declared here — declaring it
|
|
11168
|
+
// inside the try left it out of scope at the guard and threw a
|
|
11169
|
+
// ReferenceError that dropped every successful job whose AgentInstance
|
|
11170
|
+
// producer was unavailable (so `appendedTurns` was undefined and the `||`
|
|
11171
|
+
// did not short-circuit). See the drainBounded call site for its meaning.
|
|
11172
|
+
let preGuardDrainTimedOut = false;
|
|
11132
11173
|
// #264: whether a TERMINAL WIP checkpoint decision (abort/failed flush, or the
|
|
11133
11174
|
// success-path stop) was already taken on the normal control flow. If the run
|
|
11134
11175
|
// throws before any of those (e.g. runAgentJob rejects), the finally below
|
|
@@ -11348,7 +11389,8 @@ async function workAgent(req, flags, ctx) {
|
|
|
11348
11389
|
// in flight (they keep draining in the background); that is itself transcript
|
|
11349
11390
|
// evidence — turns were produced but not yet confirmed — which the guard below
|
|
11350
11391
|
// treats as non-empty via `preGuardDrainTimedOut` (thread 4118913008).
|
|
11351
|
-
|
|
11392
|
+
// (#282: `preGuardDrainTimedOut` is declared at settlement scope above, not
|
|
11393
|
+
// here — the empty-job guard reads it after this try/finally closes.)
|
|
11352
11394
|
if (agentInstanceProducer) {
|
|
11353
11395
|
try { preGuardDrainTimedOut = (await agentInstanceProducer.drainBounded()) === false; } catch (err) { logger.warn(`[${jobType}] AgentInstance producer drainBounded() threw (${aiCorr}) — ${oneLineLog(err?.message || err)}; job settlement unaffected.`); }
|
|
11354
11396
|
}
|
|
@@ -11683,6 +11725,23 @@ async function workAgent(req, flags, ctx) {
|
|
|
11683
11725
|
retries,
|
|
11684
11726
|
variables: { [AGENT_RESULT_KEY]: resultEnvelope },
|
|
11685
11727
|
});
|
|
11728
|
+
} catch (err) {
|
|
11729
|
+
// #282 (class fix): no settlement-path exception may leave a job UNSETTLED.
|
|
11730
|
+
// The run try/finally above settles on every KNOWN path (complete, empty-job
|
|
11731
|
+
// fail, non-zero-exit fail, and the pre-setup fail sheds). An UNEXPECTED throw
|
|
11732
|
+
// anywhere in that settlement path (e.g. the preGuardDrainTimedOut
|
|
11733
|
+
// ReferenceError this issue fixed) otherwise escaped this handler and surfaced
|
|
11734
|
+
// only as the supervisor's `run failed — …` log (dispatch.ts), leaving the job
|
|
11735
|
+
// to time out and re-activate forever — the work ran, but the job never
|
|
11736
|
+
// settled. Delegate to settleRunError: it FAILS the job instead (retries
|
|
11737
|
+
// preserved, so it reactivates on a healthy worker), returns WITHOUT settling
|
|
11738
|
+
// on an abort (force-stop/lock-loss is yielding the lease), and contains a
|
|
11739
|
+
// rejected fallback fail. Extracted so this behavior is tested directly.
|
|
11740
|
+
const retries = Math.max(0, (Number(job.retries) || 1) - 1);
|
|
11741
|
+
return await settleRunError({
|
|
11742
|
+
err, abortSignal, settleJob, profileName: profile.name,
|
|
11743
|
+
jobType, jobKey: job.jobKey, retries, logger,
|
|
11744
|
+
});
|
|
11686
11745
|
} finally {
|
|
11687
11746
|
clearSettleInFlight(settleMark);
|
|
11688
11747
|
recordJobEnd(job);
|
|
@@ -17694,6 +17753,7 @@ export {
|
|
|
17694
17753
|
export { compareSemver, githubRepoSlug, filterReleasesSince, renderReleaseBody };
|
|
17695
17754
|
export { probeAgentCliVersion };
|
|
17696
17755
|
export { HARNESS_PROTOCOL_VERSION, buildAgenticCapability };
|
|
17756
|
+
export { settleRunError };
|
|
17697
17757
|
export {
|
|
17698
17758
|
webConsoleUrl,
|
|
17699
17759
|
consoleLinkLabel,
|
package/nanobpmn-binary.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c8ctl-plugin-nano",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.70.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.
|
|
80
|
-
"@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.
|
|
81
|
-
"@nanobpm/c8ctl-plugin-nano-linux-x64": "1.
|
|
82
|
-
"@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.
|
|
83
|
-
"@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.
|
|
84
|
-
"@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.
|
|
85
|
-
"@nanobpm/c8ctl-plugin-nano-win32-x64": "1.
|
|
79
|
+
"@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.70.0",
|
|
80
|
+
"@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.70.0",
|
|
81
|
+
"@nanobpm/c8ctl-plugin-nano-linux-x64": "1.70.0",
|
|
82
|
+
"@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.70.0",
|
|
83
|
+
"@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.70.0",
|
|
84
|
+
"@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.70.0",
|
|
85
|
+
"@nanobpm/c8ctl-plugin-nano-win32-x64": "1.70.0"
|
|
86
86
|
}
|
|
87
87
|
}
|