@botbuddy/cli 1.95.0 → 1.96.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/CHANGELOG.md +4 -0
- package/daemon/bin/darwin-arm64/botbuddy-daemon +0 -0
- package/daemon/bin/linux-x64/botbuddy-daemon +0 -0
- package/daemon-release/darwin-arm64.json +4 -4
- package/daemon-release/linux-x64.json +4 -4
- package/daemon-release/manifest.json +5 -5
- package/package.json +1 -1
- package/src/stack.mjs +32 -6
- package/src/test-child.mjs +19 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.95.1
|
|
4
|
+
|
|
5
|
+
- BOT-3412: a host test child can execute native binaries that live in its own workspace (native npm packages after `pnpm install`, compiled test binaries, downloaded tools). systemd mounts a DynamicUser `StateDirectory` `noexec`; the daemon's unit now carries `ExecPaths=` for exactly that run's state directory. Every other sandbox property is unchanged.
|
|
6
|
+
|
|
3
7
|
## 1.95.0
|
|
4
8
|
|
|
5
9
|
- BOT-3407: a repo that commits `mise.toml` and `mise.lock` at its root gets exactly those tools in a host test child. The host daemon reads the two files from the head bundle, installs them with a pinned, sha256-verified mise in a sandboxed unit into `/var/lib/private/bb-toolchain/<tenant>/<digest>`, and binds that directory read-only at `/run/bb-child/toolchain`. A host `node_dir` stays on `PATH` behind it. A repeat run with the same tenant and digest starts no install unit. Hosts report one new capability, `toolchain` (and `toolchain_error` when the installer is unavailable). `bb stack run --test-child` requires `toolchain` when the head declares a toolchain, in place of the tools the manifest declares, and warns when `mise.toml` is committed without `mise.lock`. A versioned requirement such as `node>=24` counts as met only when the version the lock resolves meets it; otherwise the run is refused before any lease (`TOOLCHAIN_PREREQUISITE_CONFLICT`, exit 4). Only `core:` and `aqua:` backends with an https URL and a checksum for the host's platform are installed; anything else fails the run before the child starts (`TOOLCHAIN_BACKEND_REFUSED`, `TOOLCHAIN_CHECKSUM_MISSING`, `TOOLCHAIN_CHECKSUM_MISMATCH`, `TOOLCHAIN_MANIFEST_INVALID`, `TOOLCHAIN_INSTALL_FAILED`, `TOOLCHAIN_INSTALL_TIMEOUT`, `TOOLCHAIN_QUOTA_EXCEEDED`, `TOOLCHAIN_UNAVAILABLE`). Each tenant may hold 8 GiB of toolchains per host; one unused for 14 days is removed.
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.96.0",
|
|
3
|
+
"source_commit": "88fafccd1e03e7a0129065aaee14e23e35160660",
|
|
4
|
+
"source_sha256": "44663b4b3e7b7335d621e489826f886c2258f5031bfcca23bc82f2af3de94aea",
|
|
5
5
|
"target": "darwin-arm64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "0e5f1e5fc122f11c8408cb65ec3a355cb41d4ccb48f39588642e2ef2e7beaf8e"
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.96.0",
|
|
3
|
+
"source_commit": "88fafccd1e03e7a0129065aaee14e23e35160660",
|
|
4
|
+
"source_sha256": "44663b4b3e7b7335d621e489826f886c2258f5031bfcca23bc82f2af3de94aea",
|
|
5
5
|
"target": "linux-x64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "808be4bfb9a3208b55d3d94699afc5e5f3ec8c2a78e193805df429e4f5dac5c8"
|
|
7
7
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"release_version": "1.
|
|
4
|
-
"source_commit": "
|
|
5
|
-
"source_sha256": "
|
|
3
|
+
"release_version": "1.96.0",
|
|
4
|
+
"source_commit": "88fafccd1e03e7a0129065aaee14e23e35160660",
|
|
5
|
+
"source_sha256": "44663b4b3e7b7335d621e489826f886c2258f5031bfcca23bc82f2af3de94aea",
|
|
6
6
|
"targets": {
|
|
7
7
|
"darwin-arm64": {
|
|
8
8
|
"goos": "darwin",
|
|
9
9
|
"goarch": "arm64",
|
|
10
10
|
"binary": "daemon/bin/darwin-arm64/botbuddy-daemon",
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "0e5f1e5fc122f11c8408cb65ec3a355cb41d4ccb48f39588642e2ef2e7beaf8e",
|
|
12
12
|
"mode": "0755"
|
|
13
13
|
},
|
|
14
14
|
"linux-x64": {
|
|
15
15
|
"goos": "linux",
|
|
16
16
|
"goarch": "amd64",
|
|
17
17
|
"binary": "daemon/bin/linux-x64/botbuddy-daemon",
|
|
18
|
-
"sha256": "
|
|
18
|
+
"sha256": "808be4bfb9a3208b55d3d94699afc5e5f3ec8c2a78e193805df429e4f5dac5c8",
|
|
19
19
|
"mode": "0755"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
package/src/stack.mjs
CHANGED
|
@@ -64,7 +64,7 @@ import { REQUESTER_NETWORK_CANDIDATE_CODES, REQUESTER_NETWORK_LOST_CODE, createR
|
|
|
64
64
|
import { provisionFailureFields, provisionFailureLine } from "./stack-provision-failure.mjs";
|
|
65
65
|
import { hostChildApi, hostChildReceiptFields, startHostChild, childEnvFrom, HOST_CHILD_DEFAULT_MAX_RUNTIME_S } from "./host-child.mjs";
|
|
66
66
|
import { headToolchain, toolchainConflictError, toolchainPrerequisites } from "./host-toolchain.mjs";
|
|
67
|
-
import { acquireTestChildSlot, defaultTestChildWait, readPs, requesterSample, startChildSampler, testChildApi, testChildReceiptFields } from "./test-child.mjs";
|
|
67
|
+
import { acquireTestChildSlot, CHILD_PLACEMENT_REQUIRED, defaultTestChildWait, readPs, requesterSample, startChildSampler, testChildApi, testChildReceiptFields } from "./test-child.mjs";
|
|
68
68
|
|
|
69
69
|
export const STACK_SCHEMA_VERSION = 1;
|
|
70
70
|
|
|
@@ -301,6 +301,14 @@ ${bold("run OPTIONS")}
|
|
|
301
301
|
its own systemd unit with a per-run user, on the host's own ports; its
|
|
302
302
|
output is printed when it ends, and child_resources is its cgroup peak
|
|
303
303
|
memory and CPU. The requester keeps the lease, the slot and the reap.
|
|
304
|
+
--child-placement MODE BOT-3398: prefer-host (default) runs the child here when placement does not
|
|
305
|
+
choose the serving host. require-host runs it on the serving host or not at
|
|
306
|
+
all: any other placement (child_placement_disabled, stack_colocated,
|
|
307
|
+
host_child_capabilities_unknown, host_child_prerequisites_missing, a full
|
|
308
|
+
requester pool) is refused before the child starts with CHILD_PLACEMENT_REQUIRED
|
|
309
|
+
(exit 5); the receipt adds child_placement_reason, missing_prerequisites and
|
|
310
|
+
serving_host, and the slot and the lease are released. A full serving-host
|
|
311
|
+
pool still waits for a slot.
|
|
304
312
|
--child-requires LIST BOT-3030: what the child needs on a host (comma list: node>=24,pnpm,deno,
|
|
305
313
|
curl,psql,playwright-chromium-libs). node, pnpm and deno count only when
|
|
306
314
|
they run inside a child's sandbox on that host (BOT-3402). A host lacking
|
|
@@ -563,7 +571,7 @@ export function parseStackArgs(argv) {
|
|
|
563
571
|
connectionFile: null, noWait: false, claimOnly: false, localExec: false, keepVolumes: false, waitCapacity: null, holdOnTimeout: null,
|
|
564
572
|
dockerContext: null, dockerEndpoint: null,
|
|
565
573
|
// BOT-2142: execution placement (null = command default), remote-lease callback + bundle cap.
|
|
566
|
-
execution: null, remote: false, localOnly: false, testChild: false, childRequires: [], childEnv: [], childMaxRuntime: null, executionRing: "stable", callbackPort: null, bundleMaxBytes: null,
|
|
574
|
+
execution: null, remote: false, localOnly: false, testChild: false, childPlacement: "prefer-host", childRequires: [], childEnv: [], childMaxRuntime: null, executionRing: "stable", callbackPort: null, bundleMaxBytes: null,
|
|
567
575
|
// BOT-2269: exact stack-relative files shipped in the remote-lease bundle despite the
|
|
568
576
|
// default exclusions (`--bundle-include`, repeatable).
|
|
569
577
|
bundleInclude: [],
|
|
@@ -666,6 +674,15 @@ export function parseStackArgs(argv) {
|
|
|
666
674
|
case "--remote": opts.remote = true; break;
|
|
667
675
|
case "--local-only": opts.localOnly = true; break;
|
|
668
676
|
case "--test-child": opts.testChild = true; break;
|
|
677
|
+
// BOT-3398: require-host runs the child on the serving host or refuses it.
|
|
678
|
+
case "--child-placement": {
|
|
679
|
+
if (need(a, rest[i + 1])) {
|
|
680
|
+
const mode = rest[++i];
|
|
681
|
+
if (!["prefer-host", "require-host"].includes(mode)) errors.push("--child-placement takes prefer-host or require-host");
|
|
682
|
+
else { opts.childPlacement = mode; opts.childPlacementSet = true; }
|
|
683
|
+
}
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
669
686
|
// BOT-3030: what a host-placed child needs, and the only variables it is given.
|
|
670
687
|
case "--child-requires": {
|
|
671
688
|
if (need(a, rest[i + 1])) {
|
|
@@ -776,8 +793,8 @@ export function parseStackArgs(argv) {
|
|
|
776
793
|
if ((opts.callbackPort != null || opts.bundleMaxBytes != null) && command !== "run") {
|
|
777
794
|
errors.push("--callback-port and --bundle-max-mb are valid only with `stack run`");
|
|
778
795
|
}
|
|
779
|
-
if ((opts.childRequires.length || opts.childEnv.length || opts.childMaxRuntime != null) && !opts.testChild) {
|
|
780
|
-
errors.push("--child-requires, --child-env and --child-max-runtime need --test-child");
|
|
796
|
+
if ((opts.childRequires.length || opts.childEnv.length || opts.childMaxRuntime != null || opts.childPlacementSet) && !opts.testChild) {
|
|
797
|
+
errors.push("--child-placement, --child-requires, --child-env and --child-max-runtime need --test-child");
|
|
781
798
|
}
|
|
782
799
|
if (opts.testChild && command !== "run") {
|
|
783
800
|
errors.push("--test-child is valid only with `stack run` (only run starts a child)");
|
|
@@ -5521,7 +5538,7 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
5521
5538
|
signal: testChildWaitAbort.signal,
|
|
5522
5539
|
api: testChildCalls, leaseId, wait: adapters.testChildWait ?? defaultTestChildWait, log: stderrLine, prerequisites: toolchain.prerequisites,
|
|
5523
5540
|
isStopped: () => Boolean(receivedSignal || tunnelLost || callbackLost || originLost),
|
|
5524
|
-
onPark: touchWhileWaiting,
|
|
5541
|
+
onPark: touchWhileWaiting, requireHost: opts.childPlacement === "require-host",
|
|
5525
5542
|
});
|
|
5526
5543
|
} finally {
|
|
5527
5544
|
clock.clearInterval(waitTouch);
|
|
@@ -5558,7 +5575,9 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
5558
5575
|
await closeTunnel();
|
|
5559
5576
|
const cleanup = await requestCleanup();
|
|
5560
5577
|
const exitCode = receivedSignal ? SIGNAL_EXIT[receivedSignal] : cleanup.ok ? EXIT.BACKEND : EXIT.CLEANUP_FAILED;
|
|
5561
|
-
|
|
5578
|
+
// BOT-3398: a require-host refusal says where placement went and why.
|
|
5579
|
+
const required = placed.code === CHILD_PLACEMENT_REQUIRED ? { testChild, requiredPlacement: placed.placement ?? null } : {};
|
|
5580
|
+
return { exitCode, outcome: receivedSignal ? "interrupted" : "refused", code: placed.code, leaseId, cleanup, error: placed.error, ...required };
|
|
5562
5581
|
}
|
|
5563
5582
|
}
|
|
5564
5583
|
if (testChild?.placement?.host_kind === "serving_host") {
|
|
@@ -5868,6 +5887,13 @@ export function runReceiptFields(result) {
|
|
|
5868
5887
|
child_exit_code: result.childExitCode ?? null,
|
|
5869
5888
|
// BOT-3240: where a --test-child run's child ran, its slot, and what it cost.
|
|
5870
5889
|
...testChildReceiptFields(result.testChild),
|
|
5890
|
+
// BOT-3398: a require-host refusal names the child's placement (the lease's own is placement_reason).
|
|
5891
|
+
...(result.code === CHILD_PLACEMENT_REQUIRED && result.requiredPlacement ? {
|
|
5892
|
+
child_placement: result.requiredPlacement,
|
|
5893
|
+
child_placement_reason: result.requiredPlacement.placement_reason ?? null,
|
|
5894
|
+
...(result.requiredPlacement.missing_prerequisites?.length ? { missing_prerequisites: result.requiredPlacement.missing_prerequisites } : {}),
|
|
5895
|
+
...(result.requiredPlacement.serving_host ? { serving_host: result.requiredPlacement.serving_host } : {}),
|
|
5896
|
+
} : {}),
|
|
5871
5897
|
// BOT-1803: an idle release is `cleanup: { idle: true, idle_since }` (nothing was reaped).
|
|
5872
5898
|
cleanup: result.cleanup?.idle ? { idle: true, idle_since: result.cleanup.idle_since ?? null } : result.cleanup?.ok ?? null,
|
|
5873
5899
|
cleanup_code: result.cleanup?.code ?? null,
|
package/src/test-child.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import { cpus, freemem, loadavg, totalmem } from "node:os";
|
|
|
17
17
|
|
|
18
18
|
export const TEST_CHILD_CAPACITY = "TEST_CHILD_CAPACITY";
|
|
19
19
|
export const CHILD_PLACEMENT_UNSUPPORTED = "CHILD_PLACEMENT_UNSUPPORTED";
|
|
20
|
+
export const CHILD_PLACEMENT_REQUIRED = "CHILD_PLACEMENT_REQUIRED";
|
|
20
21
|
export const TEST_CHILD_UNAVAILABLE = "TEST_CHILD_UNAVAILABLE";
|
|
21
22
|
/** A full pool with no reported expiry parks at most one default slot TTL. */
|
|
22
23
|
export const FALLBACK_PARK_MS = 180_000;
|
|
@@ -92,9 +93,16 @@ export function defaultTestChildWait(target, { bin = process.execPath, cli = pro
|
|
|
92
93
|
* Returns `{ ok: true, slotId, ttlSeconds, placement, waits }` or
|
|
93
94
|
* `{ ok: false, code, error, placement?, waits }`. Never throws.
|
|
94
95
|
*/
|
|
96
|
+
/** BOT-3398: why a require-host child was refused, in the words of the placement. */
|
|
97
|
+
export function requiredHostError(placement) {
|
|
98
|
+
const missing = Array.isArray(placement?.missing_prerequisites) && placement.missing_prerequisites.length
|
|
99
|
+
? `; ${placement.serving_host ?? "the serving host"} lacks ${placement.missing_prerequisites.join(", ")}` : "";
|
|
100
|
+
return `--child-placement require-host: placement chose ${placement?.host_kind ?? "no host"} (${placement?.placement_reason ?? "unknown"}), not the serving host${missing}; the child was not started`;
|
|
101
|
+
}
|
|
102
|
+
|
|
95
103
|
export const RUNNABLE_HOST_KINDS = Object.freeze(["requester", "serving_host"]);
|
|
96
104
|
|
|
97
|
-
export async function acquireTestChildSlot({ api, leaseId, wait = defaultTestChildWait, log = () => {}, isStopped = () => false, maxWaits = Infinity, onPark = async () => {}, signal = null, sample = placementSample, prerequisites = null }) {
|
|
105
|
+
export async function acquireTestChildSlot({ api, leaseId, wait = defaultTestChildWait, log = () => {}, isStopped = () => false, maxWaits = Infinity, onPark = async () => {}, signal = null, sample = placementSample, prerequisites = null, requireHost = false }) {
|
|
98
106
|
const waits = [];
|
|
99
107
|
for (;;) {
|
|
100
108
|
// A reading that fails never blocks the run: the server then falls back to the host's cap.
|
|
@@ -109,12 +117,22 @@ export async function acquireTestChildSlot({ api, leaseId, wait = defaultTestChi
|
|
|
109
117
|
return { ok: false, code: CHILD_PLACEMENT_UNSUPPORTED, placement, waits, slotId: data.slot_id,
|
|
110
118
|
error: `the control plane placed this child on ${placement?.host ?? "another host"} as ${placement?.host_kind ?? "an unknown kind"} (${placement?.placement_reason ?? "unknown"}), which this CLI cannot run` };
|
|
111
119
|
}
|
|
120
|
+
// BOT-3398: require-host runs on the serving host or not at all; the taken slot is
|
|
121
|
+
// reported so the run releases it before anything starts.
|
|
122
|
+
if (requireHost && placement.host_kind !== "serving_host") {
|
|
123
|
+
return { ok: false, code: CHILD_PLACEMENT_REQUIRED, placement, waits, slotId: data.slot_id, error: requiredHostError(placement) };
|
|
124
|
+
}
|
|
112
125
|
// BOT-3030 (AC-5): say why a declared child stayed off its serving host.
|
|
113
126
|
if (Array.isArray(placement.missing_prerequisites) && placement.missing_prerequisites.length) {
|
|
114
127
|
log(`stack: the child runs on the requester: ${placement.serving_host ?? "the serving host"} lacks ${placement.missing_prerequisites.join(", ")} (${placement.placement_reason})`);
|
|
115
128
|
}
|
|
116
129
|
return { ok: true, slotId: data.slot_id, ttlSeconds: data.ttl_seconds ?? 180, expiresAt: data.expires_at ?? null, placement, waits };
|
|
117
130
|
}
|
|
131
|
+
// BOT-3398: a full pool that is not the serving host's would only ever run the child here.
|
|
132
|
+
if (data?.code === TEST_CHILD_CAPACITY && requireHost && data.host_kind !== "serving_host") {
|
|
133
|
+
const placement = { host: data.run_host ?? null, host_kind: data.host_kind ?? null, placement_reason: data.placement_reason ?? null };
|
|
134
|
+
return { ok: false, code: CHILD_PLACEMENT_REQUIRED, placement, waits, error: requiredHostError(placement) };
|
|
135
|
+
}
|
|
118
136
|
if (data?.code === TEST_CHILD_CAPACITY) {
|
|
119
137
|
// The pool's next expiry bounds the park; a missing one falls back to one slot TTL from now.
|
|
120
138
|
const expiryMs = Date.parse(data.next_expiry_at ?? "");
|