@botbuddy/cli 1.124.1 → 1.125.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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.125.0
4
+
5
+ - BOT-3691: `.botbuddy/lanes.json` lanes may declare `"advisory": true` and `"capacity": "none"`. An advisory lane's run is created with `advisory: true` (stamped as `metadata.advisory` on the test run), registered as `--category other --kind other` instead of `validation` / `full_suite`, and its `.botbuddy/test-runs/` summary carries `advisory: true`, so it never reaches `test_executions`, never counts toward the full-suite rerun block, and `publish_evidence` refuses it. `capacity: "none"` is recorded on the run; the lane's child gets `BOTBUDDY_LANE_CAPACITY=none` and `BOTBUDDY_LANE_ADVISORY=1` (both always set, empty when undeclared). A non-boolean `advisory`, a `capacity` other than `"none"`, and an advisory lane that is a result-bearing gate lane in `.botbuddy/telemetry-manifest.json` (`advisory_gate_lane`) are refused before any run is created, and so is an advisory lane whose `.botbuddy/telemetry-manifest.json` cannot be read (`gate_manifest_unreadable`). Lanes that declare neither field are unchanged. An older CLI ignores both fields and records such a lane as before (a full suite); see the PR for why that is accepted.
6
+
3
7
  ## 1.124.1
4
8
 
5
9
  - BOT-3700: a fleet host now applies a stack's migrations with `supabase db push --local --include-all`, as staging and production do. A lease that re-adopts a warm stack no longer fails at `stage=schema` when the branch gained a migration older than one the stack already held. A remaining migration-history refusal is named on the provision failure as `history=out_of_order` or `history=missing_local`.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.124.1",
3
- "source_commit": "1f3575a48c4f392a5bb2883570cf97b7cb5af3ce",
4
- "source_sha256": "73ecaebabf8ac69618fb4066bc8ac90c12e700bca67c6806ec6931a95fe7d0ff",
2
+ "release_version": "1.125.0",
3
+ "source_commit": "571dbc18725c560144f38fe93db9427e3bb24143",
4
+ "source_sha256": "189395522b4589de33706c053e3dd35f000158d58ec20270257be9f6dd999526",
5
5
  "target": "darwin-arm64",
6
- "sha256": "749c2e8fc3284122973aa6f3763ce09c4e6bd53e2d5700a79d16ca4dcfa865d1"
6
+ "sha256": "cb1eb69ad302708b4cbb7892dd105c55dee59c4acb6cf2d0f0a4d6a265c9969b"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.124.1",
3
- "source_commit": "1f3575a48c4f392a5bb2883570cf97b7cb5af3ce",
4
- "source_sha256": "73ecaebabf8ac69618fb4066bc8ac90c12e700bca67c6806ec6931a95fe7d0ff",
2
+ "release_version": "1.125.0",
3
+ "source_commit": "571dbc18725c560144f38fe93db9427e3bb24143",
4
+ "source_sha256": "189395522b4589de33706c053e3dd35f000158d58ec20270257be9f6dd999526",
5
5
  "target": "linux-x64",
6
- "sha256": "5934188f52f9db719e80dda1a471e96888b835f72fb4e6c50d094f0ecf8e3d10"
6
+ "sha256": "2f3b85a488baebcecdf658b9606ed8a65a1bf153e4df08556c572302333c9ecc"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.124.1",
4
- "source_commit": "1f3575a48c4f392a5bb2883570cf97b7cb5af3ce",
5
- "source_sha256": "73ecaebabf8ac69618fb4066bc8ac90c12e700bca67c6806ec6931a95fe7d0ff",
3
+ "release_version": "1.125.0",
4
+ "source_commit": "571dbc18725c560144f38fe93db9427e3bb24143",
5
+ "source_sha256": "189395522b4589de33706c053e3dd35f000158d58ec20270257be9f6dd999526",
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": "749c2e8fc3284122973aa6f3763ce09c4e6bd53e2d5700a79d16ca4dcfa865d1",
11
+ "sha256": "cb1eb69ad302708b4cbb7892dd105c55dee59c4acb6cf2d0f0a4d6a265c9969b",
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": "5934188f52f9db719e80dda1a471e96888b835f72fb4e6c50d094f0ecf8e3d10",
18
+ "sha256": "2f3b85a488baebcecdf658b9606ed8a65a1bf153e4df08556c572302333c9ecc",
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.124.1",
3
+ "version": "1.125.0",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
package/src/run.mjs CHANGED
@@ -1075,7 +1075,7 @@ async function completeTestRun(context, { status, exitCode, signal, startedAt, e
1075
1075
  lane: tr.lane, runner: tr.runner, testRunId: tr.test_run_id,
1076
1076
  startedAt, finishedAt: endedAt, durationMs, exitCode, signal,
1077
1077
  command: context.command, cwd: context.cwd, gitSha: tr.git_sha ?? null, branch: tr.branch ?? null,
1078
- counts, cancelled, lefthookEnv: laneLefthookEnv(),
1078
+ counts, cancelled, lefthookEnv: laneLefthookEnv(), advisory: tr.advisory === true,
1079
1079
  });
1080
1080
  try {
1081
1081
  const summaryPath = join(context.cwd, ".botbuddy", "test-runs", laneSummaryFilename(endedAt, tr.lane));
@@ -1084,7 +1084,12 @@ async function completeTestRun(context, { status, exitCode, signal, startedAt, e
1084
1084
  } catch { /* the summary is best-effort; the test_runs row is authoritative */ }
1085
1085
  await retryUpdateTestRun({
1086
1086
  test_run_id: tr.test_run_id, status: "completed",
1087
- metadata: { lane: tr.lane, runner: tr.runner, exit_code: exitCode ?? null, duration_ms: durationMs, cwd: context.cwd, command: context.command, command_run_id: context.run_id, cancelled, ...counts },
1087
+ metadata: {
1088
+ lane: tr.lane, runner: tr.runner, exit_code: exitCode ?? null, duration_ms: durationMs, cwd: context.cwd, command: context.command, command_run_id: context.run_id, cancelled, ...counts,
1089
+ // BOT-3691: re-assert the create-time stamp, so a run created by an
1090
+ // edge that predates the advisory argument still ends advisory.
1091
+ ...(tr.advisory === true ? { advisory: true } : {}), ...(tr.capacity ? { capacity: tr.capacity } : {}),
1092
+ },
1088
1093
  }, call);
1089
1094
  return summary;
1090
1095
  }
@@ -90,8 +90,12 @@ export async function flushLaneCases({ call, testRunId, cases }) {
90
90
  export function buildLaneSummary({
91
91
  lane, runner, testRunId, startedAt, finishedAt, durationMs, exitCode, signal,
92
92
  command, cwd, gitSha = null, branch = null, counts = null, cancelled = false, lefthookEnv = null,
93
+ advisory = false,
93
94
  }) {
94
95
  return {
96
+ // BOT-3691: an advisory lane's summary says so; report-test-runs drains it
97
+ // without ingesting it, so it never reaches test_executions (no gate reads it).
98
+ ...(advisory === true ? { advisory: true } : {}),
95
99
  runner, source: "cli-lane",
96
100
  command: Array.isArray(command) ? command.join(" ") : String(command ?? ""),
97
101
  started_at: startedAt, finished_at: finishedAt, duration_ms: durationMs,
package/src/test-lane.mjs CHANGED
@@ -127,7 +127,55 @@ export function resolveLane(laneName, { cwd = process.cwd(), readFileImpl = read
127
127
  if (lane.kind != null && !LANE_KIND_SET.has(lane.kind)) {
128
128
  return { ok: false, error: "invalid", path, root, detail: `lane "${laneName}" lane_kind must be one of ${LANE_KINDS.join("|")} (got "${lane.kind}")` };
129
129
  }
130
- return { ok: true, appSlug: config.app_slug ?? null, lane, laneKind: lane.kind ?? null, path, root };
130
+ // BOT-3691: `advisory` is a boolean and `capacity` is "none" when present; any
131
+ // other value is a named failure, never a guessed default (gate 9).
132
+ if (lane.advisory !== undefined && typeof lane.advisory !== "boolean") {
133
+ return { ok: false, error: "invalid", path, root, detail: `lane "${laneName}" advisory must be true or false (got ${JSON.stringify(lane.advisory)})` };
134
+ }
135
+ if (lane.capacity !== undefined && lane.capacity !== "none") {
136
+ return { ok: false, error: "invalid", path, root, detail: `lane "${laneName}" capacity must be "none" when set (got ${JSON.stringify(lane.capacity)})` };
137
+ }
138
+ const advisory = lane.advisory === true;
139
+ // An advisory lane a gate requires would silently strip that gate of its
140
+ // evidence. A gate's required lanes are the result-bearing lanes of the repo's
141
+ // committed telemetry manifest (BOT-1319), keyed `<hook>:<lane>`.
142
+ if (advisory) {
143
+ const gate = gateLaneNamed(root, laneName, readFileImpl);
144
+ if (gate?.unreadable) return { ok: false, error: "gate_manifest_unreadable", path, root, detail: `lane "${laneName}" is advisory but .botbuddy/telemetry-manifest.json cannot be read (${gate.unreadable}); without it no one can prove the lane is not a gate lane` };
145
+ if (gate) return { ok: false, error: "advisory_gate_lane", path, root, detail: `lane "${laneName}" is advisory but the gate lane "${gate}" in .botbuddy/telemetry-manifest.json requires it; a gate lane cannot be advisory` };
146
+ }
147
+ return { ok: true, appSlug: config.app_slug ?? null, lane, laneKind: lane.kind ?? null, advisory, capacity: lane.capacity ?? null, path, root };
148
+ }
149
+
150
+ function gateLaneNamed(root, laneName, readFileImpl) {
151
+ const manifestPath = join(root, ".botbuddy", "telemetry-manifest.json");
152
+ if (!existsSync(manifestPath)) return null;
153
+ let manifest;
154
+ // Fail closed: a manifest that exists but cannot be read or parsed proves
155
+ // nothing about which lanes the gates require.
156
+ try { manifest = JSON.parse(readFileImpl(manifestPath, "utf8")); } catch (err) { return { unreadable: err?.message ?? String(err) }; }
157
+ const lanes = manifest?.lanes && typeof manifest.lanes === "object" ? manifest.lanes : {};
158
+ for (const [key, entry] of Object.entries(lanes)) {
159
+ if (entry?.result_bearing === true && key.slice(key.indexOf(":") + 1) === laneName) return key;
160
+ }
161
+ return null;
162
+ }
163
+
164
+ // BOT-3691: how the durable launcher registers a lane's command run. An
165
+ // advisory lane is never `validation` / `full_suite`, so the BOT-816 full-suite
166
+ // rerun block never counts it; every other lane registers exactly as before.
167
+ export function laneRunClass({ advisory = false } = {}) {
168
+ return advisory ? { category: "other", kind: "other" } : { category: "validation", kind: "full_suite" };
169
+ }
170
+
171
+ export function laneRunArgv({ sessionId = null, sessionToken = null, rerunReason = null, environment, category, kind, expectedDurationSeconds, command }) {
172
+ return [
173
+ ...(sessionId ? ["--session-id", sessionId] : []),
174
+ ...(sessionToken ? ["--agent-session-token", sessionToken] : []),
175
+ ...(rerunReason ? ["--rerun-reason", rerunReason] : []),
176
+ "--environment", environment, "--category", category, "--kind", kind,
177
+ "--expected-duration", String(expectedDurationSeconds ?? 0), "--", ...command,
178
+ ];
131
179
  }
132
180
 
133
181
  // Best-effort git/gh context. Every field falls back to null — never fabricated
@@ -157,17 +205,11 @@ export function defaultGitInfo({ cwd = process.cwd(), ticket = null, pr = null,
157
205
 
158
206
  // The production lane launcher: run the lane through the durable `botbuddy run`
159
207
  // worker, carrying the telemetry env into its detached child.
160
- async function defaultLaunchLane({ command, sessionId, sessionToken, environment, expectedDurationSeconds, childEnv, testRun, cwd, call, rerunReason }) {
208
+ async function defaultLaunchLane({ command, sessionId, sessionToken, environment, expectedDurationSeconds, childEnv, testRun, cwd, call, rerunReason, category, kind }) {
161
209
  // BOT-1572/1582: pass --session-id only when a plain id is used; a token-only lane
162
210
  // relies on the inherited $BOTBUDDY_AGENT_SESSION_TOKEN (and an explicit --agent-session-token
163
211
  // so the child never falls back to a machine credential).
164
- const argv = [
165
- ...(sessionId ? ["--session-id", sessionId] : []),
166
- ...(sessionToken ? ["--agent-session-token", sessionToken] : []),
167
- ...(rerunReason ? ["--rerun-reason", rerunReason] : []),
168
- "--environment", environment, "--category", "validation", "--kind", "full_suite",
169
- "--expected-duration", String(expectedDurationSeconds ?? 0), "--", ...command,
170
- ];
212
+ const argv = laneRunArgv({ sessionId, sessionToken, rerunReason, environment, category, kind, expectedDurationSeconds, command });
171
213
  const result = await launchRun(argv, { cwd, call: sessionToken ? null : call, childEnv, testRun });
172
214
  return { exitCode: result.exitCode, runId: result.receipt?.run_id ?? null, receipt: result.receipt ?? null };
173
215
  }
@@ -302,6 +344,9 @@ export async function launchTestLane(argv, {
302
344
  source_kind: "cli-lane", source_id: laneRunId,
303
345
  // BOT-1549: stamp the resolved lane kind on the run; absent ⇒ omitted (NULL).
304
346
  lane_kind: laneKind ?? undefined,
347
+ // BOT-3691: stamped only when declared, so a normal lane's create is unchanged.
348
+ advisory: resolved.advisory ? true : undefined,
349
+ capacity: resolved.capacity ?? undefined,
305
350
  };
306
351
  const created = await callWithSessionRetry("create_test_run", createArgs);
307
352
  const testRunId = created?.ok && !created.isError ? created.data?.id ?? null : null;
@@ -334,10 +379,18 @@ export async function launchTestLane(argv, {
334
379
  childEnv.BOTBUDDY_TICKET = git.ticket ?? "";
335
380
  childEnv.BOTBUDDY_PR_NUMBER = git.prNumber != null ? String(git.prNumber) : "";
336
381
  childEnv.BOTBUDDY_PR_URL = git.prUrl ?? "";
382
+ // BOT-3691: tell the lane's command it runs advisory / capacity-free. Always
383
+ // set ("" when not declared) so a stale inherited value never leaks in.
384
+ childEnv.BOTBUDDY_LANE_ADVISORY = resolved.advisory ? "1" : "";
385
+ childEnv.BOTBUDDY_LANE_CAPACITY = resolved.capacity ?? "";
337
386
  if (testRunId) { childEnv.BOTBUDDY_TEST_RUN_ID = testRunId; childEnv.BOTBUDDY_TEST_RUN_EVENTS = eventsPath; }
338
387
  const testRun = testRunId
339
- ? { test_run_id: testRunId, events_path: eventsPath, lane: laneName, runner: resolved.lane.runner, git_sha: git.sha ?? null, branch: git.branch ?? null }
388
+ ? {
389
+ test_run_id: testRunId, events_path: eventsPath, lane: laneName, runner: resolved.lane.runner, git_sha: git.sha ?? null, branch: git.branch ?? null,
390
+ ...(resolved.advisory ? { advisory: true } : {}), ...(resolved.capacity ? { capacity: resolved.capacity } : {}),
391
+ }
340
392
  : null;
393
+ const runClass = laneRunClass({ advisory: resolved.advisory });
341
394
  let launch;
342
395
  try {
343
396
  launch = await launchLane({
@@ -345,7 +398,7 @@ export async function launchTestLane(argv, {
345
398
  sessionId: opts.sessionId, sessionToken: opts.sessionToken, environment: opts.environment,
346
399
  expectedDurationSeconds: resolved.lane.expected_duration_seconds ?? 0,
347
400
  childEnv, testRun, cwd, call, testRunId, lane: laneName, runner: resolved.lane.runner,
348
- rerunReason: opts.rerunReason,
401
+ rerunReason: opts.rerunReason, category: runClass.category, kind: runClass.kind,
349
402
  });
350
403
  } catch (e) {
351
404
  const error = `launch_exception:${e instanceof Error ? e.message : String(e)}`;
@@ -378,11 +431,13 @@ export async function launchTestLane(argv, {
378
431
  const line = testRunId
379
432
  ? {
380
433
  outcome: "launched", test_run_id: testRunId, command_run_id: commandRunId, lane: laneName,
434
+ ...(resolved.advisory ? { advisory: true } : {}),
381
435
  wait: waitCommand(testRunId, opts.sessionId, opts.sessionToken),
382
436
  receipt_path: commandRunId ? receiptPath(commandRunId) : null, waits_url: WAITS_URL,
383
437
  }
384
438
  : {
385
439
  outcome: "launched", test_run_id: null, command_run_id: commandRunId, lane: laneName,
440
+ ...(resolved.advisory ? { advisory: true } : {}),
386
441
  telemetry: "unavailable", wait: null,
387
442
  receipt_path: commandRunId ? receiptPath(commandRunId) : null, waits_url: WAITS_URL,
388
443
  };