@botbuddy/cli 1.127.0 → 1.127.1

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.127.1
4
+
5
+ - BOT-3664: when a `bb stack` lease wait ends in error, the wait's receipt now records why as a fixed code: `stream_rearmed`, `stream_lost`, `stream_connect_failed`, `stream_http_error`, `unauthorized`, `register_failed`, `lease_failed` or `interrupted`. Agent Health counts these as known reasons. The transport's error text is never recorded.
6
+
3
7
  ## 1.127.0
4
8
 
5
9
  - BOT-3735: the daemon's test-child runner now runs `min(runner_limit, test_child.max_runs)` children at once. `runner_limit` is the host's control-plane setting (set in the /docker Manage drawer), answered on every `/test-child-runs/claim`; `test_child.max_runs` in the locked `daemon.json` becomes the host owner's ceiling; a block without it has a ceiling of 4. A missing, malformed or unreadable setting (including a failed claim, and a restart before the first claim) is 1, never the ceiling. The capability report carries the limit in force (`max_runs`) and the ceiling (`max_runs_ceiling`) and is re-sent on the next cycle after the limit changes. Each claim sends `live_runs`, so the server holds a run back once the live count reaches the setting; lowering the limit never stops a running child.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.127.0",
3
- "source_commit": "115081c5de6a562d6b6c9dc60f5cce1b6b1305e1",
4
- "source_sha256": "c7fd7718cad44ab97bbf59a42b1d3a797cccdd6feac731318ac6ede564233bac",
2
+ "release_version": "1.127.1",
3
+ "source_commit": "7360c1e56abff90df9602cd71da44eedd16178ca",
4
+ "source_sha256": "b37136fda0544545f2bd4faf4d7a8e94485ca8e5b7cb4f00188482e8604b1436",
5
5
  "target": "darwin-arm64",
6
- "sha256": "5e7391d24744a4bfbcb87d3871b9647e142a988f163e71df355c6ba72c71e3ad"
6
+ "sha256": "999b82e40039ca382b890ffdcb68233aac80013a28e59e4c753a44e1ae6758ed"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.127.0",
3
- "source_commit": "115081c5de6a562d6b6c9dc60f5cce1b6b1305e1",
4
- "source_sha256": "c7fd7718cad44ab97bbf59a42b1d3a797cccdd6feac731318ac6ede564233bac",
2
+ "release_version": "1.127.1",
3
+ "source_commit": "7360c1e56abff90df9602cd71da44eedd16178ca",
4
+ "source_sha256": "b37136fda0544545f2bd4faf4d7a8e94485ca8e5b7cb4f00188482e8604b1436",
5
5
  "target": "linux-x64",
6
- "sha256": "86b34fe7ea2e942259b5cdb260fc0a280bf46cfc1d32c231d62ef67a8f65aafc"
6
+ "sha256": "f9b7b1478f3af3082101edbcbcc6e15dd9f64ad0be93bf027351986a6b06e6b9"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.127.0",
4
- "source_commit": "115081c5de6a562d6b6c9dc60f5cce1b6b1305e1",
5
- "source_sha256": "c7fd7718cad44ab97bbf59a42b1d3a797cccdd6feac731318ac6ede564233bac",
3
+ "release_version": "1.127.1",
4
+ "source_commit": "7360c1e56abff90df9602cd71da44eedd16178ca",
5
+ "source_sha256": "b37136fda0544545f2bd4faf4d7a8e94485ca8e5b7cb4f00188482e8604b1436",
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": "5e7391d24744a4bfbcb87d3871b9647e142a988f163e71df355c6ba72c71e3ad",
11
+ "sha256": "999b82e40039ca382b890ffdcb68233aac80013a28e59e4c753a44e1ae6758ed",
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": "86b34fe7ea2e942259b5cdb260fc0a280bf46cfc1d32c231d62ef67a8f65aafc",
18
+ "sha256": "f9b7b1478f3af3082101edbcbcc6e15dd9f64ad0be93bf027351986a6b06e6b9",
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.127.0",
3
+ "version": "1.127.1",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
package/src/stack.mjs CHANGED
@@ -2106,7 +2106,7 @@ async function registerLeaseWait(leaseId, timeoutSec, auth, signal, fetchImpl =
2106
2106
  // return the way it did when `ac.abort()` was called before returning from
2107
2107
  // inside the loop.
2108
2108
  function resultForAbortReason(reason) {
2109
- if (reason === "interrupted") return { result: { interrupted: true }, status: "error" };
2109
+ if (reason === "interrupted") return { result: { interrupted: true }, status: "error", reason: "interrupted" };
2110
2110
  // "timeout", or any other/unset reason (e.g. an externally-triggered AbortError
2111
2111
  // with no reason attached) — defensively treated the same as a real deadline.
2112
2112
  return { result: { timeout: true }, status: "timeout" };
@@ -2127,7 +2127,9 @@ export async function waitForLease(leaseId, isDone, isFailed, { timeoutSec, auth
2127
2127
  if (signal?.aborted) ac.abort("interrupted");
2128
2128
  else signal?.addEventListener?.("abort", abortFromParent, { once: true });
2129
2129
  const timer = setTimeout(() => ac.abort("timeout"), Math.max(0, absoluteDeadlineMs - Date.now()));
2130
- const finish = async (result, status) => {
2130
+ // BOT-3664: an error finalization records WHY as a fixed reason code (the
2131
+ // server's WAIT_FEEDBACK_REASONS), never the transport's error text.
2132
+ const finish = async (result, status, reason = null) => {
2131
2133
  clearTimeout(timer);
2132
2134
  signal?.removeEventListener?.("abort", abortFromParent);
2133
2135
  if (waitSessionId) {
@@ -2137,7 +2139,7 @@ export async function waitForLease(leaseId, isDone, isFailed, { timeoutSec, auth
2137
2139
  try {
2138
2140
  const response = await fetchImpl(eventStreamBase(), {
2139
2141
  method: "POST", headers: { ...relayAuthHeaders(auth), "Content-Type": "application/json" },
2140
- body: JSON.stringify({ action: "finalize", wait_session_id: waitSessionId, status, receipt: { outcome: status, lease_id: leaseId } }),
2142
+ body: JSON.stringify({ action: "finalize", wait_session_id: waitSessionId, status, receipt: { outcome: status, lease_id: leaseId, ...(status === "error" && reason ? { error: reason } : {}) } }),
2141
2143
  signal: finalizer.signal,
2142
2144
  });
2143
2145
  if (!response.ok) process.stderr.write(`${yellow("⚠")} stack: wait finalization returned ${response.status}\n`);
@@ -2151,24 +2153,24 @@ export async function waitForLease(leaseId, isDone, isFailed, { timeoutSec, auth
2151
2153
  return result;
2152
2154
  };
2153
2155
  if (ac.signal.aborted) {
2154
- const { result, status } = resultForAbortReason(ac.signal.reason);
2155
- return finish(result, status);
2156
+ const { result, status, reason } = resultForAbortReason(ac.signal.reason);
2157
+ return finish(result, status, reason);
2156
2158
  }
2157
2159
  try {
2158
2160
  ({ cursorStart, waitSessionId } = await registerLeaseWait(leaseId, Math.max(0, Math.ceil((absoluteDeadlineMs - Date.now()) / 1000)), auth, ac.signal, fetchImpl));
2159
2161
  } catch (err) {
2160
2162
  if (ac.signal.aborted) {
2161
- const { result, status } = resultForAbortReason(ac.signal.reason);
2162
- return finish(result, status);
2163
+ const { result, status, reason } = resultForAbortReason(ac.signal.reason);
2164
+ return finish(result, status, reason);
2163
2165
  }
2164
2166
  // BOT-2099 (hop 6, 2026-10-06 01:54Z): a registration rejected by an auth or
2165
2167
  // availability blip is RETRIED by the park (parkOnLease), never downgraded to a
2166
2168
  // live-only park that is invisible on /waits and keeps nothing alive server-side.
2167
2169
  // Only a definite client-side rejection (another 4xx) keeps the old live-only path.
2168
2170
  const status = err?.status ?? null;
2169
- if (status === 401 || status === 403) return finish({ auth: true, phase: "register" }, "error");
2171
+ if (status === 401 || status === 403) return finish({ auth: true, phase: "register" }, "error", "unauthorized");
2170
2172
  if (status == null || status === 408 || status === 429 || status >= 500) {
2171
- return finish({ error: `wait registration: ${err?.message ?? err}`, phase: "register" }, "error");
2173
+ return finish({ error: `wait registration: ${err?.message ?? err}`, phase: "register" }, "error", "register_failed");
2172
2174
  }
2173
2175
  process.stderr.write(`${yellow("⚠")} stack: wait registration failed (${err?.message ?? err}); the lease will not appear on /waits — parking live-only.\n`);
2174
2176
  }
@@ -2182,13 +2184,13 @@ export async function waitForLease(leaseId, isDone, isFailed, { timeoutSec, auth
2182
2184
  res = await fetchImpl(url, { headers: { ...relayAuthHeaders(auth), Accept: "text/event-stream", "Accept-Encoding": "identity" }, signal: ac.signal });
2183
2185
  } catch (err) {
2184
2186
  if (ac.signal.aborted) {
2185
- const { result, status } = resultForAbortReason(ac.signal.reason);
2186
- return finish(result, status);
2187
+ const { result, status, reason } = resultForAbortReason(ac.signal.reason);
2188
+ return finish(result, status, reason);
2187
2189
  }
2188
- return finish({ error: `sse connect: ${err?.message ?? err}` }, "error");
2190
+ return finish({ error: `sse connect: ${err?.message ?? err}` }, "error", "stream_connect_failed");
2189
2191
  }
2190
- if (res.status === 401 || res.status === 403) return finish({ auth: true }, "error");
2191
- if (!res.ok || !res.body) return finish({ error: `sse responded ${res.status}`, status: res.status }, "error");
2192
+ if (res.status === 401 || res.status === 403) return finish({ auth: true }, "error", "unauthorized");
2193
+ if (!res.ok || !res.body) return finish({ error: `sse responded ${res.status}`, status: res.status }, "error", "stream_http_error");
2192
2194
  const decoder = new TextDecoder();
2193
2195
  let buf = "";
2194
2196
  // BOT-1827: record a match/failure locally and `break` out of BOTH loops
@@ -2213,7 +2215,7 @@ export async function waitForLease(leaseId, isDone, isFailed, { timeoutSec, auth
2213
2215
  if (isFailed(st, sig.payload)) {
2214
2216
  // BOT-2013: carry the server's reap_reason so the receipt says WHY the lease is gone.
2215
2217
  const reapReason = typeof sig.payload?.reap_reason === "string" ? sig.payload.reap_reason : null;
2216
- decided = { reason: "failed", result: { failed: true, state: st, ...(reapReason ? { reap_reason: reapReason } : {}) }, status: "error" };
2218
+ decided = { reason: "failed", result: { failed: true, state: st, ...(reapReason ? { reap_reason: reapReason } : {}) }, status: "error", errorReason: "lease_failed" };
2217
2219
  break frameLoop;
2218
2220
  }
2219
2221
  if (isDone(st, sig.payload)) { decided = { reason: "matched", result: { woke: true, state: st, ...(sig.payload?.cleanup_verified === true ? { cleanupEvidence: sig.payload } : {}) }, status: "matched" }; break frameLoop; }
@@ -2226,22 +2228,22 @@ export async function waitForLease(leaseId, isDone, isFailed, { timeoutSec, auth
2226
2228
  // reporting the teardown failure.
2227
2229
  if (!decided) {
2228
2230
  if (ac.signal.aborted) {
2229
- const { result, status } = resultForAbortReason(ac.signal.reason);
2230
- return finish(result, status);
2231
+ const { result, status, reason } = resultForAbortReason(ac.signal.reason);
2232
+ return finish(result, status, reason);
2231
2233
  }
2232
- return finish({ error: `sse stream: ${err?.message ?? err}` }, "error");
2234
+ return finish({ error: `sse stream: ${err?.message ?? err}` }, "error", "stream_lost");
2233
2235
  }
2234
2236
  }
2235
2237
  if (decided) {
2236
2238
  ac.abort(decided.reason);
2237
- return finish(decided.result, decided.status);
2239
+ return finish(decided.result, decided.status, decided.errorReason ?? null);
2238
2240
  }
2239
2241
  // A clean relay EOF is not a timeout: the server intentionally closes on
2240
2242
  // scope changes and proxies can recycle idle streams. Re-arm from a fresh
2241
2243
  // cursor until the original deadline, never silently fall back to polling.
2242
2244
  const remainingSec = Math.ceil((absoluteDeadlineMs - Date.now()) / 1000);
2243
2245
  if (remainingSec > 0 && !ac.signal.aborted) {
2244
- await finish({ reconnected: true }, "error");
2246
+ await finish({ reconnected: true }, "error", "stream_rearmed");
2245
2247
  return waitForLease(leaseId, isDone, isFailed, { timeoutSec: remainingSec, auth, signal, deadlineMs: absoluteDeadlineMs }, fetchImpl);
2246
2248
  }
2247
2249
  return finish({ timeout: true }, "timeout");