@botbuddy/cli 1.97.0 → 1.99.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.99.0
4
+
5
+ - BOT-3408: `bb daemon upgrade` takes `"testChild":{"enabled":true}` (optionally `"maxRuns":1..4`) to switch test children on for a handover-pinned host, and `"testChild":{"enabled":false}` to switch them off. The host's daemon changes only the `test_child` member of its `daemon.json`, after the server has fenced the plan that pins the amended digest, and the ordinary handover re-pins it; nobody edits the file by hand. Switching off removes the member and restores the earlier bytes, so the digest is the earlier pin again. The block carries no runtime path and no tool version. Enabling is refused when the running daemon is older than 1.90.0 (`daemon_test_child_previous_daemon_too_old`). On a host with automatic updates, add `"refreshAutomaticBinding":true` to re-install the updater binding against the new digest in the same command (`daemon_test_child_automatic_binding_refresh_required` without it). `"preview":true` reports both digests and changes nothing. A refused submission puts the earlier bytes back; other refusals are `daemon_test_child_amend_refused: <CODE>` (for example `TEST_CHILD_COORDINATOR_TOO_OLD` when the host's installed updater coordinator predates 1.90.0: run `bb daemon updater-install` first).
6
+
7
+ ## 1.98.0
8
+
9
+ - BOT-3395: a host test child's host tools `curl`, `git`, `jq`, `psql` and `tar` count only when they run inside a child's sandbox. The daemon's runtime probe (BOT-3402) now also runs `<tool> --version` for each one, and `child_capabilities` gains `tool_versions` (for example `{"jq":"1.8.1","psql":"18.6"}`). A tool the daemon user can see but the sandbox cannot run is listed in `missing`. `jq` is new: `--child-requires jq` now places a child only on a host whose sandbox runs it. Before, `curl`, `git`, `psql` and `tar` were checked on the daemon user's `PATH` and `jq` was never reported, so a child that required `jq` could never be placed.
10
+
3
11
  ## 1.97.0
4
12
 
5
13
  - BOT-3397: `bb stack run --test-child --child-artifacts <glob>` (repeatable, at most 16, relative to the checkout) brings a host test child's files back to the requester's worktree. When the child's unit stops (exit, failure, timeout or cancel) its `ExecStopPost` runs the bound `bb child-artifacts pack` as the run's own DynamicUser, inside the sandbox: matching regular files are packed into a gzip tar whose last entry `.bb-artifacts.json` lists each file's size and sha256. Symlinks are never followed or packed, and the files are capped at 200 MiB per run. The daemon uploads the archive to a signed, run-scoped Storage path and reports its sha256, size and typed refusals (`ARTIFACT_GLOB_NO_MATCH`, `ARTIFACT_OVER_CAP`, `ARTIFACT_SYMLINK_REFUSED`, …). The CLI downloads it, checks the archive against the host's sha256 and every file against the manifest, refuses the whole archive on any mismatch or unsafe path, writes the files at their relative paths before the run is seen to end, and records them on the receipt as `host_child.artifacts`. A run with nothing to return says why (`ARTIFACTS_NOT_PACKED`, `ARTIFACTS_UPLOAD_FAILED`, `ARTIFACTS_DIGEST_MISMATCH`, …); the exit code is always the child's. Archives are kept 24 h; `bb stack child-artifacts <run_id>` writes them again.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.97.0",
3
- "source_commit": "9624b16c5931a1caa8532d54b5c5bbcbfda7968f",
4
- "source_sha256": "e3eb890b49b33323cd956f58d69b7211787b86098e940fc6c35e2a71f703adad",
2
+ "release_version": "1.99.0",
3
+ "source_commit": "3bd5ba30fecfeef81634b3bcb05b45f4e313c119",
4
+ "source_sha256": "10082955eafe12ff070d400fb00a1431daec6d1c8882ea6cc8ec981bd6a5d086",
5
5
  "target": "darwin-arm64",
6
- "sha256": "54c2ae2eb7ad2b829d7e1072ac35c145f1e6cb058032d5ee9083b859b3a93e32"
6
+ "sha256": "a799940075f9bb9e74af284b8e57896b7667ffcb900c71237288a846a5cd484e"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.97.0",
3
- "source_commit": "9624b16c5931a1caa8532d54b5c5bbcbfda7968f",
4
- "source_sha256": "e3eb890b49b33323cd956f58d69b7211787b86098e940fc6c35e2a71f703adad",
2
+ "release_version": "1.99.0",
3
+ "source_commit": "3bd5ba30fecfeef81634b3bcb05b45f4e313c119",
4
+ "source_sha256": "10082955eafe12ff070d400fb00a1431daec6d1c8882ea6cc8ec981bd6a5d086",
5
5
  "target": "linux-x64",
6
- "sha256": "69d0a5d44faddb8029c99e061a5c1b9ee1134d38e3695f2348e6039a3f5fafa6"
6
+ "sha256": "b6b1e5a122c97946f2f405b32ebe69e87a4bf7567b592815bac86386fcc6564b"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.97.0",
4
- "source_commit": "9624b16c5931a1caa8532d54b5c5bbcbfda7968f",
5
- "source_sha256": "e3eb890b49b33323cd956f58d69b7211787b86098e940fc6c35e2a71f703adad",
3
+ "release_version": "1.99.0",
4
+ "source_commit": "3bd5ba30fecfeef81634b3bcb05b45f4e313c119",
5
+ "source_sha256": "10082955eafe12ff070d400fb00a1431daec6d1c8882ea6cc8ec981bd6a5d086",
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": "54c2ae2eb7ad2b829d7e1072ac35c145f1e6cb058032d5ee9083b859b3a93e32",
11
+ "sha256": "a799940075f9bb9e74af284b8e57896b7667ffcb900c71237288a846a5cd484e",
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": "69d0a5d44faddb8029c99e061a5c1b9ee1134d38e3695f2348e6039a3f5fafa6",
18
+ "sha256": "b6b1e5a122c97946f2f405b32ebe69e87a4bf7567b592815bac86386fcc6564b",
19
19
  "mode": "0755"
20
20
  }
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbuddy/cli",
3
- "version": "1.97.0",
3
+ "version": "1.99.0",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,35 @@
1
+ // The automatic-update binding is root-owned and pins the host's owner, its
2
+ // inert rollout label and its config digest. Both `bb daemon updater-install`
3
+ // and a test_child amend (BOT-3408) install it through these two steps, so a
4
+ // re-pin can never name an owner or label the server did not answer.
5
+ const fail = (code) => {
6
+ throw new Error(code);
7
+ };
8
+
9
+ // BOT-3127: the host's owner asks the server for the host's rollout label.
10
+ export async function describeAutomaticBinding({ hostKey, ownerEmail, auth }, { describe }) {
11
+ const described = await describe({ action: "describe", host_key: hostKey }, { auth });
12
+ const owner = described?.data?.owner_email, label = described?.data?.tenant_id;
13
+ if (
14
+ !described?.ok || described.data?.success !== true ||
15
+ described.data.host_key !== hostKey ||
16
+ typeof owner !== "string" || owner.toLowerCase() !== ownerEmail.toLowerCase() ||
17
+ typeof label !== "string" || !label
18
+ ) {
19
+ // A 4xx answer carries its code in `error` (e.g. daemon_host_scope).
20
+ const code = described?.data?.code ?? described?.error;
21
+ fail(
22
+ typeof code === "string" && /^(?:[A-Z_]{1,64}|[a-z_]{1,64})$/.test(code)
23
+ ? `daemon_automatic_install_owner_refused: ${code}`
24
+ : "daemon_automatic_install_owner_refused",
25
+ );
26
+ }
27
+ return { host_key: hostKey, owner_email: owner, tenant_id: label };
28
+ }
29
+
30
+ export async function installAutomaticBinding({ sshHost, binary, binding }, { native }) {
31
+ const result = await native({ host: sshHost, binary, mode: "automatic-install", input: binding });
32
+ if (result?.installed !== true || result.protocol !== 2) {
33
+ fail("daemon_automatic_install_receipt_invalid");
34
+ }
35
+ }
@@ -6,6 +6,7 @@ import {
6
6
  } from "./installer.mjs";
7
7
  import { validateDaemonRelease } from "./release.mjs";
8
8
  import { nativeHandoverCommand } from "./handover.mjs";
9
+ import { describeAutomaticBinding, installAutomaticBinding } from "./automatic-binding.mjs";
9
10
  const fail = (code) => {
10
11
  throw new Error(code);
11
12
  };
@@ -58,25 +59,11 @@ export async function installAutomaticDaemonUpdater(spec, {
58
59
  !who?.ok || who.isError || typeof who.data?.owner_email !== "string" ||
59
60
  !who.data.owner_email.includes("@")
60
61
  ) fail("daemon_automatic_install_owner_unavailable");
61
- const described = await describe({
62
- action: "describe",
63
- host_key: spec.expectedHostKey,
64
- }, { auth: resolved.auth });
65
- const owner = described?.data?.owner_email, label = described?.data?.tenant_id;
66
- if (
67
- !described?.ok || described.data?.success !== true ||
68
- described.data.host_key !== spec.expectedHostKey ||
69
- typeof owner !== "string" || owner.toLowerCase() !== who.data.owner_email.toLowerCase() ||
70
- typeof label !== "string" || !label
71
- ) {
72
- // A 4xx answer carries its code in `error` (e.g. daemon_host_scope).
73
- const code = described?.data?.code ?? described?.error;
74
- fail(
75
- typeof code === "string" && /^(?:[A-Z_]{1,64}|[a-z_]{1,64})$/.test(code)
76
- ? `daemon_automatic_install_owner_refused: ${code}`
77
- : "daemon_automatic_install_owner_refused",
78
- );
79
- }
62
+ const binding = await describeAutomaticBinding({
63
+ hostKey: spec.expectedHostKey,
64
+ ownerEmail: who.data.owner_email,
65
+ auth: resolved.auth,
66
+ }, { describe });
80
67
  const staged = await stage({
81
68
  platform: spec.platform,
82
69
  host: spec.sshHost,
@@ -85,18 +72,6 @@ export async function installAutomaticDaemonUpdater(spec, {
85
72
  });
86
73
  const binary = installedBinaryPath(release);
87
74
  if (staged?.binary !== binary) fail("daemon_automatic_install_stage_invalid");
88
- const result = await native({
89
- host: spec.sshHost,
90
- binary,
91
- mode: "automatic-install",
92
- input: {
93
- host_key: spec.expectedHostKey,
94
- owner_email: owner,
95
- tenant_id: label,
96
- },
97
- });
98
- if (result?.installed !== true || result.protocol !== 2) {
99
- fail("daemon_automatic_install_receipt_invalid");
100
- }
75
+ await installAutomaticBinding({ sshHost: spec.sshHost, binary, binding }, { native });
101
76
  return { installed: true, protocol: 2, host_key: spec.expectedHostKey };
102
77
  }
@@ -53,6 +53,12 @@ export const daemonHelp = `Usage:
53
53
  bb daemon updater-install '<json automatic updater installation spec>'
54
54
  bb daemon upgrade '<json controlled host upgrade spec>'
55
55
 
56
+ Upgrade also switches test children on or off for a handover-pinned host: add
57
+ "testChild":{"enabled":true} (optionally "maxRuns":1..4) or {"enabled":false}.
58
+ The host changes only the test_child member of its daemon.json and the handover
59
+ re-pins it. "preview":true reports both config digests and changes nothing; a
60
+ host with automatic updates also needs "refreshAutomaticBinding":true.
61
+
56
62
  The Go payload is verified from the extracted universal package before sudo.
57
63
  Install runs the Go runtime's --check-config receipt before loading a native,
58
64
  root-owned service. Add "sshHost" and target "arch" to deploy from this CLI
@@ -5,9 +5,14 @@ import { spawn } from "node:child_process";
5
5
  import { randomUUID } from "node:crypto";
6
6
  import {
7
7
  callToolJson,
8
+ daemonAutomaticUpdateRequest,
8
9
  daemonHandoverRequest,
9
10
  resolveCallAuth,
10
11
  } from "../api.mjs";
12
+ import {
13
+ describeAutomaticBinding,
14
+ installAutomaticBinding,
15
+ } from "./automatic-binding.mjs";
11
16
  import {
12
17
  assertSshHost,
13
18
  installedBinaryPath,
@@ -22,16 +27,77 @@ const hostRE = /^bbh-[0-9a-f]{24}$/;
22
27
  const immutableBinaryRE =
23
28
  /^\/opt\/botbuddy\/daemon\/releases\/[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?\/(?:linux-x64|darwin-arm64)\/botbuddy-daemon$/;
24
29
 
30
+ const nativeFlags = {
31
+ inspect: "--native-handover-inspect",
32
+ submit: "--native-handover-submit",
33
+ "automatic-install": "--native-automatic-update-install",
34
+ "test-child-amend": "--native-test-child-amend",
35
+ };
36
+
37
+ // BOT-3408: the first daemon whose config loader reads a `test_child` member.
38
+ // A failed handover restarts the previous daemon on the amended file.
39
+ const TEST_CHILD_FLOOR = [1, 90, 0];
40
+ const olderThanTestChildFloor = (version) => {
41
+ const match = /^(\d+)\.(\d+)\.(\d+)/.exec(typeof version === "string" ? version : "");
42
+ if (!match) return true;
43
+ for (let i = 0; i < 3; i++) {
44
+ const part = Number(match[i + 1]);
45
+ if (part !== TEST_CHILD_FLOOR[i]) return part < TEST_CHILD_FLOOR[i];
46
+ }
47
+ return false;
48
+ };
49
+ const tooOld = (version) =>
50
+ fail(
51
+ `daemon_test_child_previous_daemon_too_old: ${
52
+ typeof version === "string" && /^[0-9A-Za-z.-]{1,40}$/.test(version) ? version : "unknown"
53
+ } < ${TEST_CHILD_FLOOR.join(".")}`,
54
+ );
55
+ const shaRE = /^sha256:[0-9a-f]{64}$/;
56
+
57
+ // The spec's whole allow-list: { enabled } or { enabled: true, maxRuns: 1..4 }.
58
+ // Returns the wire block; null removes the member and restores the earlier bytes.
59
+ function testChildBlock(value) {
60
+ if (
61
+ !value || typeof value !== "object" || Array.isArray(value) ||
62
+ Object.keys(value).some((key) => !["enabled", "maxRuns"].includes(key)) ||
63
+ typeof value.enabled !== "boolean" ||
64
+ (value.maxRuns !== undefined &&
65
+ (!value.enabled || !Number.isInteger(value.maxRuns) || value.maxRuns < 1 || value.maxRuns > 4))
66
+ ) fail("daemon_handover_spec_invalid");
67
+ if (!value.enabled) return null;
68
+ return value.maxRuns === undefined ? { enabled: true } : { enabled: true, max_runs: value.maxRuns };
69
+ }
70
+
71
+ // The updater binding pins the config digest too. It needs a re-install when
72
+ // the host has one and it does not already pin the digest this reply names.
73
+ const bindingStale = (reply) =>
74
+ reply.automatic_binding === true && reply.automatic_binding_current !== true;
75
+
76
+ async function amendTestChild(native, { host, binary, input }) {
77
+ const reply = await native({ host, binary, mode: "test-child-amend", input });
78
+ if (reply?.amended !== true) {
79
+ if (reply?.code === "TEST_CHILD_PREVIOUS_DAEMON_TOO_OLD") tooOld(reply.previous_version);
80
+ fail(
81
+ typeof reply?.code === "string" && /^[A-Z_]{1,64}$/.test(reply.code)
82
+ ? `daemon_test_child_amend_refused: ${reply.code}`
83
+ : "daemon_test_child_amend_refused",
84
+ );
85
+ }
86
+ if (
87
+ !shaRE.test(reply.config_sha256_before) || !shaRE.test(reply.config_sha256) ||
88
+ typeof reply.changed !== "boolean"
89
+ ) fail("daemon_test_child_amend_response_invalid");
90
+ return reply;
91
+ }
92
+
25
93
  export function nativeHandoverCommand(
26
94
  { host, binary, mode, input },
27
95
  { spawnImpl = spawn } = {},
28
96
  ) {
29
97
  if (
30
- !immutableBinaryRE.test(binary) || !["inspect", "submit", "automatic-install"].includes(mode)
98
+ !immutableBinaryRE.test(binary) || !Object.hasOwn(nativeFlags, mode)
31
99
  ) fail("daemon_handover_command_invalid");
32
- const flag = mode === "automatic-install" ? "--native-automatic-update-install" : mode === "inspect"
33
- ? "--native-handover-inspect"
34
- : "--native-handover-submit";
100
+ const flag = nativeFlags[mode];
35
101
  let command = "sudo", args = ["-n", binary, flag];
36
102
  if (host) {
37
103
  assertSshHost(host);
@@ -91,6 +157,7 @@ export async function upgradeDaemonHost(spec, {
91
157
  resolveAuth = resolveCallAuth,
92
158
  identity = callToolJson,
93
159
  transition = daemonHandoverRequest,
160
+ describe = daemonAutomaticUpdateRequest,
94
161
  native = nativeHandoverCommand,
95
162
  uuid = randomUUID,
96
163
  } = {}) {
@@ -106,6 +173,9 @@ export async function upgradeDaemonHost(spec, {
106
173
  "expectedHostKey",
107
174
  "tenant",
108
175
  "resume",
176
+ "testChild",
177
+ "preview",
178
+ "refreshAutomaticBinding",
109
179
  ].includes(key)
110
180
  ) || !["linux", "darwin"].includes(spec.platform) ||
111
181
  typeof spec.serviceUser !== "string" || spec.serviceUser === "root" ||
@@ -113,6 +183,14 @@ export async function upgradeDaemonHost(spec, {
113
183
  !hostRE.test(spec.expectedHostKey) || typeof spec.tenant !== "string" ||
114
184
  !spec.tenant
115
185
  ) fail("daemon_handover_spec_invalid");
186
+ const amending = Object.hasOwn(spec, "testChild");
187
+ if (
188
+ (!amending && (Object.hasOwn(spec, "preview") || Object.hasOwn(spec, "refreshAutomaticBinding"))) ||
189
+ (spec.preview !== undefined && spec.preview !== true) ||
190
+ (spec.refreshAutomaticBinding !== undefined && spec.refreshAutomaticBinding !== true) ||
191
+ (spec.preview && spec.resume)
192
+ ) fail("daemon_handover_spec_invalid");
193
+ const block = amending ? testChildBlock(spec.testChild) : undefined;
116
194
  if (typeof spec.sshHost !== "string") {
117
195
  fail("daemon_handover_ssh_host_required");
118
196
  }
@@ -141,7 +219,13 @@ export async function upgradeDaemonHost(spec, {
141
219
  });
142
220
  const binary = installedBinaryPath(release);
143
221
  if (staged?.binary !== binary) fail("daemon_handover_stage_invalid");
144
- let plan;
222
+ let plan, binding = null, bindingInstalled = false, amendSummary;
223
+ const amend = (input) =>
224
+ amendTestChild(native, {
225
+ host: spec.sshHost,
226
+ binary,
227
+ input: { host_key: spec.expectedHostKey, test_child: block, ...input },
228
+ });
145
229
  if (spec.resume) {
146
230
  if (spec.resume === true) {
147
231
  const saved = await transition({
@@ -173,6 +257,49 @@ export async function upgradeDaemonHost(spec, {
173
257
  observed?.service_user !== spec.serviceUser ||
174
258
  !Number.isSafeInteger(observed.service_uid) || observed.service_uid <= 0
175
259
  ) fail("daemon_handover_host_mismatch");
260
+ let configSha = observed.config_sha256;
261
+ if (amending) {
262
+ if (block && olderThanTestChildFloor(observed.previous?.version)) {
263
+ tooOld(observed.previous?.version);
264
+ }
265
+ // Nothing is written yet: the host answers which digest the amended file
266
+ // will have, so the server fences exactly the plan that pins it.
267
+ const dry = await amend({ dry_run: true });
268
+ if (dry.config_sha256_before !== observed.config_sha256) {
269
+ fail("daemon_test_child_amend_config_changed");
270
+ }
271
+ if (spec.preview) {
272
+ return {
273
+ outcome: "preview",
274
+ host_key: observed.host_key,
275
+ previous_version: observed.previous.version,
276
+ candidate_version: release.releaseVersion,
277
+ test_child: {
278
+ enabled: block !== null,
279
+ ...(block?.max_runs ? { max_runs: block.max_runs } : {}),
280
+ config_sha256_before: dry.config_sha256_before,
281
+ config_sha256: dry.config_sha256,
282
+ changed: dry.changed,
283
+ automatic_binding: dry.automatic_binding === true,
284
+ automatic_binding_refresh_needed: bindingStale(dry),
285
+ },
286
+ };
287
+ }
288
+ if (bindingStale(dry)) {
289
+ // The automatic-update binding pins the config digest as well, and its
290
+ // coordinator refuses a plan that names another one. Re-pinning it
291
+ // replaces root coordinator code, so the operator asks for it by name.
292
+ if (!spec.refreshAutomaticBinding) {
293
+ fail("daemon_test_child_automatic_binding_refresh_required");
294
+ }
295
+ binding = await describeAutomaticBinding({
296
+ hostKey: spec.expectedHostKey,
297
+ ownerEmail: who.data.owner_email,
298
+ auth,
299
+ }, { describe });
300
+ }
301
+ configSha = dry.config_sha256;
302
+ }
176
303
  plan = {
177
304
  version: 1,
178
305
  rollout_id: uuid(),
@@ -182,7 +309,7 @@ export async function upgradeDaemonHost(spec, {
182
309
  machine_id: observed.machine_id,
183
310
  engine_id: observed.engine_id,
184
311
  service_uid: observed.service_uid,
185
- config_sha256: observed.config_sha256,
312
+ config_sha256: configSha,
186
313
  previous_instance_id: observed.previous_instance_id,
187
314
  previous: observed.previous,
188
315
  candidate: {
@@ -211,17 +338,90 @@ export async function upgradeDaemonHost(spec, {
211
338
  result: begun.data.result,
212
339
  };
213
340
  }
214
- const queued = await native({
215
- host: spec.sshHost,
216
- binary,
217
- mode: "submit",
218
- input: { plan, authority_key: begun.data.authority_key },
341
+ let applied = null;
342
+ if (amending) {
343
+ // Only now does the file change, and only to the digest the fenced plan pins.
344
+ applied = await amend({ expect_config_sha256: plan.config_sha256 });
345
+ amendSummary = {
346
+ enabled: block !== null,
347
+ ...(block?.max_runs ? { max_runs: block.max_runs } : {}),
348
+ config_sha256_before: applied.config_sha256_before,
349
+ config_sha256: applied.config_sha256,
350
+ changed: applied.changed,
351
+ automatic_binding_refreshed: false,
352
+ };
353
+ }
354
+ // A daemon restart between the amend and the handover is fenced by the old
355
+ // pin. A definite refusal therefore puts the earlier bytes back; a submission
356
+ // that never answered may be queued, so its amend stays for "resume".
357
+ const afterAmend = async (step) => {
358
+ try {
359
+ return await step();
360
+ } catch (error) {
361
+ if (!applied?.changed) throw error;
362
+ let reverted = false, bindingRestored = true;
363
+ if (error.message !== "daemon_handover_command_timeout" && applied.previous_expressible === true) {
364
+ try {
365
+ await amendTestChild(native, {
366
+ host: spec.sshHost,
367
+ binary,
368
+ input: {
369
+ host_key: spec.expectedHostKey,
370
+ test_child: applied.previous_test_child ?? null,
371
+ expect_config_sha256: applied.config_sha256_before,
372
+ },
373
+ });
374
+ reverted = true;
375
+ if (bindingInstalled) {
376
+ bindingRestored = false;
377
+ await installAutomaticBinding({ sshHost: spec.sshHost, binary, binding }, { native });
378
+ bindingRestored = true;
379
+ }
380
+ } catch { /* reported below, by what was and was not put back */ }
381
+ }
382
+ fail(
383
+ `${error.message}; test_child amend ${
384
+ !reverted
385
+ ? 'left applied: re-run with "resume":true'
386
+ : bindingRestored
387
+ ? "reverted"
388
+ : "reverted, automatic binding not restored: run bb daemon updater-install"
389
+ }`,
390
+ );
391
+ }
392
+ };
393
+ await afterAmend(async () => {
394
+ // The host says whether its binding already pins this digest. A resumed
395
+ // upgrade whose binding was re-pinned before its submission failed must not
396
+ // install it again: the updater refuses that beneath a published request.
397
+ if (applied && bindingStale(applied)) {
398
+ if (!spec.refreshAutomaticBinding) {
399
+ fail("daemon_test_child_automatic_binding_refresh_required");
400
+ }
401
+ binding ??= await describeAutomaticBinding({
402
+ hostKey: spec.expectedHostKey,
403
+ ownerEmail: who.data.owner_email,
404
+ auth,
405
+ }, { describe });
406
+ // An install that fails part-way may already have published the new
407
+ // binding, so the attempt itself is what a revert has to undo.
408
+ bindingInstalled = true;
409
+ await installAutomaticBinding({ sshHost: spec.sshHost, binary, binding }, { native });
410
+ amendSummary.automatic_binding_refreshed = true;
411
+ }
412
+ const answer = await native({
413
+ host: spec.sshHost,
414
+ binary,
415
+ mode: "submit",
416
+ input: { plan, authority_key: begun.data.authority_key },
417
+ });
418
+ if (answer?.queued !== true) fail("daemon_handover_submission_refused");
219
419
  });
220
- if (queued?.queued !== true) fail("daemon_handover_submission_refused");
221
420
  return {
222
421
  outcome: "queued",
223
422
  host_key: plan.host_key,
224
423
  rollout_id: plan.rollout_id,
225
424
  plan,
425
+ ...(amendSummary ? { test_child: amendSummary } : {}),
226
426
  };
227
427
  }
package/src/stack.mjs CHANGED
@@ -314,9 +314,12 @@ ${bold("run OPTIONS")}
314
314
  serving_host, and the slot and the lease are released. A full serving-host
315
315
  pool still waits for a slot.
316
316
  --child-requires LIST BOT-3030: what the child needs on a host (comma list: node>=24,pnpm,deno,
317
- curl,psql,playwright-chromium-libs). node, pnpm and deno count only when
318
- they run inside a child's sandbox on that host (BOT-3402). A host lacking
319
- one is not placed on; the child runs here and the run names what was missing.
317
+ curl,git,jq,psql,tar,playwright-chromium-libs). node, pnpm and deno count
318
+ only when they run inside a child's sandbox on that host (BOT-3402).
319
+ BOT-3395: curl, git, jq, psql and tar count only when they run inside a
320
+ child's sandbox too, and the host reports each one's version. A host
321
+ lacking one is not placed on; the child runs here and the run names what
322
+ was missing.
320
323
  BOT-3407: a head that commits mise.toml and mise.lock at its root gets
321
324
  exactly those tools on the host, built in a sandbox per tenant and bound
322
325
  read-only into the child. Placement then requires \`toolchain\` in
@@ -703,7 +706,7 @@ export function parseStackArgs(argv) {
703
706
  case "--child-requires": {
704
707
  if (need(a, rest[i + 1])) {
705
708
  const list = rest[++i].split(",").map((x) => x.trim()).filter(Boolean);
706
- if (!list.length || list.some((x) => !/^(node>=[0-9]{1,3}|[a-z][a-z0-9-]{0,47})$/.test(x))) errors.push("--child-requires takes a comma list of node>=<major> or capability names (curl, psql, playwright-chromium-libs)");
709
+ if (!list.length || list.some((x) => !/^(node>=[0-9]{1,3}|[a-z][a-z0-9-]{0,47})$/.test(x))) errors.push("--child-requires takes a comma list of node>=<major> or capability names (curl, git, jq, psql, tar, playwright-chromium-libs)");
707
710
  else opts.childRequires.push(...list.filter((x) => !opts.childRequires.includes(x)));
708
711
  }
709
712
  break;