@botbuddy/cli 1.73.3 → 1.73.4

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.73.4
4
+
5
+ - A new Claude Code session in a repo where both the bb-session start-up hook and the bb-status band run is registered by the hook again. The band's first read at session start bootstrapped the same session at the same moment, and both bootstraps failed: the session stayed unregistered for minutes and the model never got its BB identity. For its session's first 30 seconds `bb status-band read` (with the new `--session-started-at`) now leaves the bootstrap to the hook and answers `session_starting` with `retry_after_ms`; the band shows "Connecting this session to BB…" and reads once more when told. A session the hook did not register is still bound by the band after that window. The band's plugin version moves to 1.4.2.
6
+
3
7
  ## 1.73.3
4
8
 
5
9
  - The bb-status band is tidied after its first live look (BOT-3228). It says "project", never "epic": tickets outside the session's project read "no project" or "other project". A failed read is one short, single-spaced note, such as `Couldn't load project · Couldn't load staging`, and a band that had to guess its tickets from the branch says `Guessed from branch`. Badges are a darker shade of their colour with white letters and icons, rounded outside the terminal, and the staging-red banner is the same red badge as the context alarm. Wait badges use plain words (`Staging status`, `Codex review PR 1655`, `Timer`, `Playwright lane 8`). PRs nest under their ticket by indent, with no trunk line, and the band's rows are evenly spaced. The band now reads correctly when Claude's working directory is a subfolder of the worktree. The plugin version moves to 1.4.1, so `bb update` installs it.
@@ -11,7 +11,7 @@
11
11
  "name": "bb-status",
12
12
  "source": "./bb-status",
13
13
  "description": "BB session status above the prompt: tickets, PRs with review counts, epic, staging, context use and active waits, for BotBuddy and Supply Guard sessions",
14
- "version": "1.4.1"
14
+ "version": "1.4.2"
15
15
  },
16
16
  {
17
17
  "name": "bb-session",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bb-status",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "BB session status above the prompt: tickets, PRs with review counts, epic, staging, context use and active waits, live only while the session is on screen.",
5
5
  "author": {
6
6
  "name": "BotBuddy"
@@ -64,6 +64,13 @@ ticket". Each row is three columns: the tree and id link (`BOT-123 ↗`,
64
64
  epic, GitHub for PRs; a tint on Desktop, a solid fill with contrasting ink in the
65
65
  terminal), and the title.
66
66
 
67
+ **BOT-3222 start-up registration.** The `bb-session` plugin's SessionStart hook
68
+ registers the session with BB before the first prompt. For the session's first
69
+ 30 s the band passes `--session-started-at` and its read never bootstraps: it
70
+ answers `session_starting` and the band shows "Connecting this session to BB…",
71
+ then reads once more. Only a session the hook did not register is bound by the
72
+ band after that.
73
+
67
74
  ## Install
68
75
 
69
76
  The bb CLI ships this mod and installs it (BOT-3152). `bb setup` and `bb update`
@@ -33,6 +33,10 @@ let unbound = false;
33
33
  let context = null;
34
34
  // BOT-3213: the tenant's ticket prefix the adapter named with ticket_missing.
35
35
  let hintPrefix = null;
36
+ // BOT-3222: when this Claude session started, so the adapter leaves the
37
+ // session's bootstrap to the bb-session hook in its first 30 s.
38
+ let sessionStartedAt = null;
39
+ let retryAfterMs = null;
36
40
  // BOT-3212: the waits badge pulses once, for PULSE_MS, when the count changes.
37
41
  const PULSE_MS = 2000;
38
42
  let pulsing = false;
@@ -41,6 +45,7 @@ const ERRORS = {
41
45
  linear_key_missing:
42
46
  "Export LINEAR_BB_API_KEY to Claude Desktop before using Live.",
43
47
  session_missing: "Connect BB in this worktree before using Live.",
48
+ session_starting: "Connecting this session to BB…",
44
49
  harness_session_missing:
45
50
  "This Claude session has no supported session identifier.",
46
51
  session_mismatch:
@@ -337,6 +342,7 @@ async function refresh($, { wake = false, keep = false } = {}) {
337
342
  const cwd = await $.session.cwd();
338
343
  const argv = ["bb", "status-band", "read", "--harness-session-id", harness];
339
344
  if (selectedTicket) argv.push("--ticket-id", selectedTicket);
345
+ if (Number.isSafeInteger(sessionStartedAt) && sessionStartedAt > 0) argv.push("--session-started-at", String(sessionStartedAt));
340
346
  // BOT-3135: a wake re-read skips the slow epic read and keeps the last one.
341
347
  const previous = wake ? snapshot : null;
342
348
  if (previous) argv.push("--skip-epic");
@@ -363,6 +369,7 @@ async function refresh($, { wake = false, keep = false } = {}) {
363
369
  }
364
370
  if (result.exitCode !== 0) {
365
371
  hintPrefix = data?.error === "ticket_missing" && /^[A-Z]{2,10}$/.test(data.prefix ?? "") ? data.prefix : null;
372
+ retryAfterMs = data?.error === "session_starting" && Number.isFinite(data.retry_after_ms) ? Math.min(Math.max(data.retry_after_ms, 1000), 30000) : null;
366
373
  throw new Error(
367
374
  typeof data.error === "string" ? data.error : "source_unavailable",
368
375
  );
@@ -402,6 +409,22 @@ async function refresh($, { wake = false, keep = false } = {}) {
402
409
  errorCode = Object.hasOwn(ERRORS, error.message)
403
410
  ? error.message
404
411
  : "status_unavailable";
412
+ // BOT-3222: the hook is still registering this session; read once more
413
+ // when the adapter says, unless another read has started since.
414
+ if (errorCode === "session_starting") {
415
+ const after = retryAfterMs ?? 30000;
416
+ void (async () => {
417
+ await delay($, after + 500);
418
+ if (request !== generation || errorCode !== "session_starting" || mode !== "live") return;
419
+ // Codex P2 on #1661: a hidden session stays parked; followVisibility
420
+ // reads once when a surface draws it again.
421
+ if (parked || !(await onScreen($))) {
422
+ parked = true;
423
+ return;
424
+ }
425
+ await refresh($);
426
+ })();
427
+ }
405
428
  }
406
429
  } finally {
407
430
  if (request === generation) {
@@ -1063,6 +1086,7 @@ export function register(on) {
1063
1086
  immediate: true,
1064
1087
  });
1065
1088
  parked = false;
1089
+ sessionStartedAt = await $.clock.now();
1066
1090
  await readContext($);
1067
1091
  if (await onScreen($)) await refresh($);
1068
1092
  else parked = true;
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.3",
3
- "source_commit": "1d11f9a0881e212eda6474d158c2d30ca54abfce",
4
- "source_sha256": "13855ea27a4a26cf5ea2d49ce058d4e8ba459a78d49aa123f351eb8834f67b27",
2
+ "release_version": "1.73.4",
3
+ "source_commit": "0b33bfa2eb6de470d62b9f6bff2a9c60713a4d18",
4
+ "source_sha256": "d48572c37a0929ac8800bbc8cca933ecd915557e4e2f99d129dafd3ffc3816ca",
5
5
  "target": "darwin-arm64",
6
- "sha256": "756319e58995c75e35175fceda15be53222c72a0cfa831e2edfee2a72ef43786"
6
+ "sha256": "282e1f7777f12b54bb31969b3d34b808f83c149eefe3a03056de93d724439de2"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.3",
3
- "source_commit": "1d11f9a0881e212eda6474d158c2d30ca54abfce",
4
- "source_sha256": "13855ea27a4a26cf5ea2d49ce058d4e8ba459a78d49aa123f351eb8834f67b27",
2
+ "release_version": "1.73.4",
3
+ "source_commit": "0b33bfa2eb6de470d62b9f6bff2a9c60713a4d18",
4
+ "source_sha256": "d48572c37a0929ac8800bbc8cca933ecd915557e4e2f99d129dafd3ffc3816ca",
5
5
  "target": "linux-x64",
6
- "sha256": "2d292e6c266e2f797d39cd409aa103983242eb31d2fd4440f995e5161dcad272"
6
+ "sha256": "4be7b327985e1cad4d60c5c6ae01d1976c60156dd1bba24282cc82469fe5a9b1"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.73.3",
4
- "source_commit": "1d11f9a0881e212eda6474d158c2d30ca54abfce",
5
- "source_sha256": "13855ea27a4a26cf5ea2d49ce058d4e8ba459a78d49aa123f351eb8834f67b27",
3
+ "release_version": "1.73.4",
4
+ "source_commit": "0b33bfa2eb6de470d62b9f6bff2a9c60713a4d18",
5
+ "source_sha256": "d48572c37a0929ac8800bbc8cca933ecd915557e4e2f99d129dafd3ffc3816ca",
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": "756319e58995c75e35175fceda15be53222c72a0cfa831e2edfee2a72ef43786",
11
+ "sha256": "282e1f7777f12b54bb31969b3d34b808f83c149eefe3a03056de93d724439de2",
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": "2d292e6c266e2f797d39cd409aa103983242eb31d2fd4440f995e5161dcad272",
18
+ "sha256": "4be7b327985e1cad4d60c5c6ae01d1976c60156dd1bba24282cc82469fe5a9b1",
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.73.3",
3
+ "version": "1.73.4",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -575,6 +575,10 @@ export async function readStatus({
575
575
  // for HOLDER_IDLE_MS is gone; one with no transcript on this host keeps the
576
576
  // BB-expiry rule.
577
577
  const BINDABLE = new Set(["session_missing", "session_mismatch", "session_expired"]);
578
+ // BOT-3222: the bb-session hook's bootstrap is bounded at 20 s (hooks.json
579
+ // timeout 30 s); the band waits this long after its session starts before it
580
+ // bootstraps a session itself.
581
+ export const START_GRACE_MS = 30_000;
578
582
  const HOLDER_IDLE_MS = 30 * 60 * 1000;
579
583
  const UUID_ONLY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
580
584
  // true: the holder's transcript was written within HOLDER_IDLE_MS; false: it
@@ -750,6 +754,14 @@ export async function main(args, {
750
754
  args = [...args];
751
755
  const skipEpic = args.at(-1) === "--skip-epic";
752
756
  if (skipEpic) args.pop();
757
+ // BOT-3222: when the band's Claude session started (ms since the epoch).
758
+ let startedAt = null;
759
+ if (args.at(-2) === "--session-started-at") {
760
+ const value = args.at(-1);
761
+ if (!/^[0-9]{1,15}$/.test(value)) refuse("invalid_arguments");
762
+ startedAt = Number(value);
763
+ args.splice(-2, 2);
764
+ }
753
765
  if (args.length !== 2 && args.length !== 4) refuse("invalid_arguments");
754
766
  if (
755
767
  args[0] !== "--harness-session-id" ||
@@ -768,6 +780,16 @@ export async function main(args, {
768
780
  } catch (error) {
769
781
  const bind = BINDABLE.has(error?.message) && UUID.test(args[1]) ? await bindable(cwd, args[1], now, holderActive) : false;
770
782
  if (!bind) throw error;
783
+ // BOT-3222: the bb-session SessionStart hook registers this session; a
784
+ // band bootstrap racing it for the same harness id makes BOTH fail. Inside
785
+ // the hook's window the band leaves the bootstrap to the hook and asks to
786
+ // be read again once the window has passed.
787
+ const left = startedAt === null ? 0 : startedAt + START_GRACE_MS - now();
788
+ if (left > 0) {
789
+ const starting = new Error("session_starting");
790
+ starting.retryAfterMs = Math.min(left, START_GRACE_MS);
791
+ throw starting;
792
+ }
771
793
  let branch = null;
772
794
  try {
773
795
  branch = (await execFileAsync("git", ["branch", "--show-current"], { cwd })).stdout.trim() || null;
@@ -795,7 +817,8 @@ export async function main(args, {
795
817
  } catch (error) {
796
818
  const known = /^[a-z_]+$/.test(error?.message ?? "") ? error.message : "status_unavailable";
797
819
  const prefix = known === "ticket_missing" && /^[A-Z]{2,10}$/.test(error?.prefix ?? "") ? { prefix: error.prefix } : {};
798
- out.write(JSON.stringify({ error: known, ...prefix }) + "\n");
820
+ const retry = known === "session_starting" && Number.isFinite(error?.retryAfterMs) ? { retry_after_ms: Math.ceil(error.retryAfterMs) } : {};
821
+ out.write(JSON.stringify({ error: known, ...prefix, ...retry }) + "\n");
799
822
  return 1;
800
823
  }
801
824
  }