@botbuddy/cli 1.123.5 → 1.123.7

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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.123.5",
3
- "source_commit": "d7e0fbf3a5bb19574ec32f1f6051b0db396e9fd2",
4
- "source_sha256": "c9b00d299977d1d17ed6da59b3dac32229da0e2014ee84bca6c4cdb6705574de",
2
+ "release_version": "1.123.7",
3
+ "source_commit": "6facb2c1345d29afdeb7e01dc7b48c6f3a22b7c1",
4
+ "source_sha256": "32da3f0dde227064c68fbd924594ee0a6315340f74acdc3acf18d7dca7b9fd57",
5
5
  "target": "darwin-arm64",
6
- "sha256": "97d7b621f9970f17c07a9b02d42110fc7b0dc74f3410eebc5be4fe4cc64bce76"
6
+ "sha256": "a7c335c6d6fc11340f6a4cb7422471d68f7b2ede49585c43a1e6f34673ed959e"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.123.5",
3
- "source_commit": "d7e0fbf3a5bb19574ec32f1f6051b0db396e9fd2",
4
- "source_sha256": "c9b00d299977d1d17ed6da59b3dac32229da0e2014ee84bca6c4cdb6705574de",
2
+ "release_version": "1.123.7",
3
+ "source_commit": "6facb2c1345d29afdeb7e01dc7b48c6f3a22b7c1",
4
+ "source_sha256": "32da3f0dde227064c68fbd924594ee0a6315340f74acdc3acf18d7dca7b9fd57",
5
5
  "target": "linux-x64",
6
- "sha256": "cd22194965d32299b1887c880944fd44596d5bdb42fe2889fae7f09ce7bb6166"
6
+ "sha256": "5827dad83423d04732a0176e05395d5d8b2ff98c867f738b180acf63a26e7a11"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.123.5",
4
- "source_commit": "d7e0fbf3a5bb19574ec32f1f6051b0db396e9fd2",
5
- "source_sha256": "c9b00d299977d1d17ed6da59b3dac32229da0e2014ee84bca6c4cdb6705574de",
3
+ "release_version": "1.123.7",
4
+ "source_commit": "6facb2c1345d29afdeb7e01dc7b48c6f3a22b7c1",
5
+ "source_sha256": "32da3f0dde227064c68fbd924594ee0a6315340f74acdc3acf18d7dca7b9fd57",
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": "97d7b621f9970f17c07a9b02d42110fc7b0dc74f3410eebc5be4fe4cc64bce76",
11
+ "sha256": "a7c335c6d6fc11340f6a4cb7422471d68f7b2ede49585c43a1e6f34673ed959e",
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": "cd22194965d32299b1887c880944fd44596d5bdb42fe2889fae7f09ce7bb6166",
18
+ "sha256": "5827dad83423d04732a0176e05395d5d8b2ff98c867f738b180acf63a26e7a11",
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.123.5",
3
+ "version": "1.123.7",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
package/src/feedback.mjs CHANGED
@@ -12,6 +12,8 @@ import { hasPendingFeedback, queueFeedback, withFeedbackOutbox } from "./feedbac
12
12
  import { CONDITION_TYPES } from "./wait-core.mjs";
13
13
 
14
14
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
15
+ // BOT-3665: `recorded` is an automatic failure capture an agent may still enrich.
16
+ const FEEDBACK_CAPTURE_STATES = ["complete", "needs_context", "recorded"];
15
17
  const RUN_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
16
18
  const OPTIONAL_TEXT = new Set(["goal", "steps", "expected", "actual", "blocked_reason", "blocking_step", "safe_next_action", "environment", "operation", "component_version", "error_code", "correlation_id", "workaround", "cause_confidence", "ticket_ref"]);
17
19
  const USAGE = `Usage: bb feedback init --file <report.json>
@@ -97,7 +99,7 @@ export async function cmdFeedback(args, { call = callToolJson, resolveAuth = res
97
99
  enrich_command: argv.map((value) => `'${value.replaceAll("'", "'\\''")}'`).join(" ") };
98
100
  }
99
101
  if (!response?.ok || response.isError || (response.status != null && (response.status < 200 || response.status >= 300)) || data?.ok !== true ||
100
- typeof data.feedback_id !== "string" || !UUID.test(data.feedback_id) || typeof data.occurrence_id !== "string" || !UUID.test(data.occurrence_id) || !["complete", "needs_context"].includes(data.capture_state)) {
102
+ typeof data.feedback_id !== "string" || !UUID.test(data.feedback_id) || typeof data.occurrence_id !== "string" || !UUID.test(data.occurrence_id) || !FEEDBACK_CAPTURE_STATES.includes(data.capture_state)) {
101
103
  return { ok: false, error: "delivery_unconfirmed", delivered, receipts, remaining: true,
102
104
  ...(typeof data?.feedback_id === "string" && UUID.test(data.feedback_id) ? { feedback_id: data.feedback_id, status_command: `bb feedback status --feedback-id ${data.feedback_id}` } : {}) };
103
105
  }
@@ -252,7 +254,7 @@ export async function cmdFeedback(args, { call = callToolJson, resolveAuth = res
252
254
  }
253
255
  catch { result = { ok: false, status: null, error: "transport_unavailable" }; }
254
256
  if (!result?.ok || (result.status != null && (result.status < 200 || result.status >= 300)) || result.isError || result.data?.ok !== true || typeof result.data.feedback_id !== "string" || !UUID.test(result.data.feedback_id) ||
255
- typeof result.data.occurrence_id !== "string" || !UUID.test(result.data.occurrence_id) || !["complete", "needs_context"].includes(result.data.capture_state)) {
257
+ typeof result.data.occurrence_id !== "string" || !UUID.test(result.data.occurrence_id) || !FEEDBACK_CAPTURE_STATES.includes(result.data.capture_state)) {
256
258
  const reported = result?.auth ? "authentication_failed" : result?.data?.error ?? result?.code ?? result?.error;
257
259
  const code = typeof reported === "string" && /^[A-Za-z0-9_.:-]{1,80}$/.test(reported) ? reported : "feedback_receipt_unavailable";
258
260
  const retryArgv = enrich ? null : ["bb", "feedback", "submit", "--file", filename];
@@ -273,7 +275,7 @@ export async function cmdFeedback(args, { call = callToolJson, resolveAuth = res
273
275
  return result?.auth ? CALL_EXIT.AUTH : !result?.ok && result?.status == null ? CALL_EXIT.TRANSPORT : CALL_EXIT.ERROR;
274
276
  }
275
277
  const sourceDuplicate = result.data.source_duplicate === true && result.data.submitted_context_saved === false;
276
- const enrichArgv = result.data.capture_state === "needs_context" || sourceDuplicate ? ["bb", "feedback", "enrich", "--feedback-id", result.data.feedback_id, "--file", filename] : null;
278
+ const enrichArgv = result.data.capture_state !== "complete" || sourceDuplicate ? ["bb", "feedback", "enrich", "--feedback-id", result.data.feedback_id, "--file", filename] : null;
277
279
  const statusArgv = ["bb", "feedback", "status", "--feedback-id", result.data.feedback_id];
278
280
  const updatesArgv = ["bb", "feedback", "updates", "--feedback-id", result.data.feedback_id];
279
281
  log(JSON.stringify({ ...result.data, ...(sourceDuplicate ? { ok: false, error: "source_already_reported" } : {}), status_argv: statusArgv, status_command: statusArgv.join(" "), updates_argv: updatesArgv, updates_command: updatesArgv.join(" "), ...(enrichArgv ? { enrich_argv: enrichArgv, enrich_command: enrichArgv.map((value) => `'${value.replaceAll("'", "'\\''")}'`).join(" ") } : {}) }));
@@ -14,6 +14,13 @@ export const RUN_REGISTRY_ENV = "BOTBUDDY_RUN_REGISTRY";
14
14
  */
15
15
  export const LEGACY_RUN_MARKERS = Object.freeze(["BOTBUDDY_STACK_LEASE_ID", "BOTBUDDY_TEST_RUN_ID"]);
16
16
  export const ALL_RUN_MARKERS = Object.freeze([RUN_ID_ENV, RUN_REGISTRY_ENV, ...LEGACY_RUN_MARKERS]);
17
+ /**
18
+ * BOT-3655: set by the host daemon on every process of a host test child (a transient
19
+ * systemd unit, daemon/test_child_systemd.go). That unit owns its processes
20
+ * (KillMode=control-group), so the orphan reaper never judges them, though the unit also
21
+ * exports the legacy lease marker and its main process's parent is PID 1.
22
+ */
23
+ export const HOST_CHILD_RUN_ENV = "BOTBUDDY_HOST_CHILD_RUN_ID";
17
24
 
18
25
  /**
19
26
  * The environment for a long-lived bb helper (the run delivery process, the orphan
@@ -23,7 +23,9 @@
23
23
  // outbox until sensor-ingest accepts it.
24
24
  //
25
25
  // Host test children are not handled here: they run as transient systemd units with
26
- // KillMode=control-group, which the host daemon stops (daemon/test_child_systemd.go).
26
+ // KillMode=control-group, which the host daemon stops (daemon/test_child_systemd.go). A
27
+ // reaper started inside one (by a test's spawned bb) never takes the unit's own processes
28
+ // for a pre-fix orphan: they carry BOTBUDDY_HOST_CHILD_RUN_ID (BOT-3655).
27
29
 
28
30
  import { execFile, spawn } from "node:child_process";
29
31
  import { createHash, randomUUID } from "node:crypto";
@@ -32,7 +34,7 @@ import { homedir, hostname } from "node:os";
32
34
  import { basename, dirname, join } from "node:path";
33
35
  import { fileURLToPath } from "node:url";
34
36
 
35
- import { LEGACY_RUN_MARKERS, RUN_ID_ENV, RUN_REGISTRY_ENV, withoutRunMarkers } from "./run-markers.mjs";
37
+ import { HOST_CHILD_RUN_ENV, LEGACY_RUN_MARKERS, RUN_ID_ENV, RUN_REGISTRY_ENV, withoutRunMarkers } from "./run-markers.mjs";
36
38
  import { acquireDeliveryLock, pidAlive } from "./run-delivery.mjs";
37
39
  import { VERSION } from "./version.mjs";
38
40
 
@@ -88,7 +90,7 @@ export function parseElapsed(text) {
88
90
  /** The marker values in an environment block (`NAME=value` tokens, last one wins). */
89
91
  export function markersFromEnvText(text) {
90
92
  const markers = {};
91
- for (const name of [RUN_ID_ENV, RUN_REGISTRY_ENV, ...LEGACY_RUN_MARKERS]) {
93
+ for (const name of [RUN_ID_ENV, RUN_REGISTRY_ENV, ...LEGACY_RUN_MARKERS, HOST_CHILD_RUN_ENV]) {
92
94
  const re = new RegExp(`(?:^|[\\s\\0])${name}=([^\\s\\0]*)`, "g");
93
95
  let value = null;
94
96
  for (const match of String(text).matchAll(re)) value = match[1];
@@ -293,6 +295,10 @@ export function findRunsToReap(processes, {
293
295
  continue;
294
296
  }
295
297
  if (!legacy || onlyRunId) continue;
298
+ // BOT-3655: a host test child's processes belong to its systemd unit, which stops them
299
+ // (KillMode=control-group); its lease marker is not a pre-fix run's, and the unit's main
300
+ // process sits under PID 1 by design, so it would always look orphaned.
301
+ if (proc.markers[HOST_CHILD_RUN_ENV]) continue;
296
302
  const name = LEGACY_RUN_MARKERS.find((marker) => proc.markers[marker]);
297
303
  if (!name) continue;
298
304
  const key = `${name}=${proc.markers[name]}`;