@botbuddy/cli 1.73.2 → 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,13 @@
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
+
7
+ ## 1.73.3
8
+
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.
10
+
3
11
  ## 1.73.2
4
12
 
5
13
  - `bb doctor --fix` keeps the worktree's own BB session. It renews that session in place, fresh or lapsed, and re-checks the stack-lease capability on the same session (`renew_agent_session` with `host` and `worktree`). Before, it registered a new session, which replaced the old one and cut the bb-status band off from the session's tickets and pull requests. A closed session, another Claude session's cache, or a server that returns no capability verdict still gets a new session as before.
@@ -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.0"
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.0",
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`
@@ -189,3 +196,13 @@ BB_STATUS_PREVIEW_HARNESS_SESSION_ID=<current-harness-uuid> \
189
196
  ```
190
197
 
191
198
  Live receipts for each BOT-3152 criterion are on the ticket.
199
+
200
+ **BOT-3228 polish.** The band says "project", never "epic" ("no project", "other
201
+ project"). Failed reads share one dim note, single-spaced and joined by ` · `
202
+ (`Couldn't load PRs`, `Couldn't load project`, `Couldn't load staging`, and
203
+ `Guessed from branch` when `session_read` is not `ok`). Badges are a darker shade
204
+ of their status colour with white letters and white icons on every surface,
205
+ rounded (`borderStyle: "round"`) outside the terminal; the staging banner is the
206
+ same red badge as the context alarm. PRs nest by indent with no trunk line, and
207
+ rows sit in one column Box with an even `rowGap`. The read runs from the
208
+ worktree root even when Claude's working directory is a subfolder.
@@ -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:
@@ -196,6 +201,8 @@ function validSnapshot(value, harness, now) {
196
201
  (value.blockers !== null &&
197
202
  !(value.tenant === "botbuddy" && Array.isArray(value.blockers) && value.blockers.length <= 100)) ||
198
203
  (value.epic_unreadable !== undefined && typeof value.epic_unreadable !== "boolean") ||
204
+ // BOT-3228 AC-3: why the session's own read was not used.
205
+ (value.session_read !== undefined && !["ok", "unavailable", "other_session", "other_tenant", "malformed"].includes(value.session_read)) ||
199
206
  (value.staging != null &&
200
207
  !(
201
208
  typeof value.staging.configured === "boolean" &&
@@ -335,6 +342,7 @@ async function refresh($, { wake = false, keep = false } = {}) {
335
342
  const cwd = await $.session.cwd();
336
343
  const argv = ["bb", "status-band", "read", "--harness-session-id", harness];
337
344
  if (selectedTicket) argv.push("--ticket-id", selectedTicket);
345
+ if (Number.isSafeInteger(sessionStartedAt) && sessionStartedAt > 0) argv.push("--session-started-at", String(sessionStartedAt));
338
346
  // BOT-3135: a wake re-read skips the slow epic read and keeps the last one.
339
347
  const previous = wake ? snapshot : null;
340
348
  if (previous) argv.push("--skip-epic");
@@ -361,6 +369,7 @@ async function refresh($, { wake = false, keep = false } = {}) {
361
369
  }
362
370
  if (result.exitCode !== 0) {
363
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;
364
373
  throw new Error(
365
374
  typeof data.error === "string" ? data.error : "source_unavailable",
366
375
  );
@@ -400,6 +409,22 @@ async function refresh($, { wake = false, keep = false } = {}) {
400
409
  errorCode = Object.hasOwn(ERRORS, error.message)
401
410
  ? error.message
402
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
+ }
403
428
  }
404
429
  } finally {
405
430
  if (request === generation) {
@@ -758,19 +783,37 @@ function statusWidth(spec) {
758
783
  if (!spec.status.length) return spec.icon ? 2 : 0;
759
784
  return 2 + (spec.icon ? 2 : 0) + spec.status.reduce((w, part, i) => w + (i ? 3 : 0) + part.text.length, 0);
760
785
  }
761
- // BOT-3223 AC-3: the status is a badge in the band's own palette (Linear for
762
- // tickets and the epic, GitHub for PRs). On Desktop a tint of the colour behind
763
- // the coloured word, as the web chips draw it; the terminal has no alpha, so
764
- // there the colour fills the badge and the word takes a contrasting ink.
765
- function ink(hex) {
766
- const m = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex || "");
767
- if (!m) return "#ffffff";
768
- const [r, g, b] = m.slice(1).map((x) => parseInt(x, 16) / 255);
769
- return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.55 ? "#1f2328" : "#ffffff";
770
- }
786
+ // BOT-3223 AC-3 / BOT-3228: the status is a badge in the band's palette
787
+ // (Linear for tickets and the project, GitHub for PRs), filled with a darker
788
+ // shade of its colour and lettered in white, on every surface (Jono,
789
+ // 2026-11-14). Each fill holds at least 4.5:1 against white. On graphical
790
+ // surfaces the badge is rounded, as Claude Code draws its own chips.
791
+ const DARK = {
792
+ "#f2c94c": "#8a5a00", // Linear started (yellow)
793
+ "#4cb782": "#1f7a4d", // Linear in review (green)
794
+ "#5e6ad2": "#4b55b8", // Linear done (violet)
795
+ "#95a2b3": "#5b6675", // Linear backlog / todo / canceled (grey)
796
+ "#f2994a": "#a8510c", // Linear project backlog (orange)
797
+ "#1a7f37": "#1a7f37", // GitHub open
798
+ "#59636e": "#59636e", // GitHub draft
799
+ "#8250df": "#8250df", // GitHub merged
800
+ "#cf222e": "#cf222e", // GitHub closed / conflict
801
+ };
771
802
  function badgeColors(hex) {
772
- const solid = surface === "terminal" || !/^#[0-9a-f]{6}$/i.test(hex || "");
773
- return solid ? { bg: hex, fg: ink(hex), muted: ink(hex) } : { bg: hex + "26", fg: hex, muted: ICON.grey };
803
+ const bg = DARK[String(hex || "").toLowerCase()] || "#5b6675";
804
+ return { bg, fg: "#ffffff", muted: "#ffffff" };
805
+ }
806
+ // The status icon, redrawn in the badge's white ink: its colour strokes and
807
+ // fills turn white, and a white mark inside a filled shape (the Done check)
808
+ // takes the badge's fill so it still reads.
809
+ function inked(source, bg) {
810
+ return String(source || "")
811
+ .replace(/#fff\b/g, "@BG@")
812
+ .replace(/#[0-9a-f]{6}\b/gi, "#ffffff")
813
+ .replace(/@BG@/g, bg);
814
+ }
815
+ function rounded() {
816
+ return surface === "terminal" ? {} : { borderStyle: "round" };
774
817
  }
775
818
  function statusBadge(el, key, spec) {
776
819
  if (!spec.status.length) return spec.icon ? [spec.icon] : [];
@@ -780,7 +823,7 @@ function statusBadge(el, key, spec) {
780
823
  if (i) children.push(el.Text({ color: muted, children: [" · "] }));
781
824
  children.push(el.Text({ color: part.muted ? muted : fg, children: [part.text] }));
782
825
  });
783
- return [el.Box({ key, flexDirection: "row", flexShrink: 0, backgroundColor: bg, paddingX: 1, children })];
826
+ return [el.Box({ key, flexDirection: "row", flexShrink: 0, backgroundColor: bg, ...rounded(), borderColor: bg, paddingX: 1, children })];
784
827
  }
785
828
  function bandLine(el, spec, widths, right) {
786
829
  const ids = [];
@@ -826,18 +869,18 @@ function waitBadges(el, key, w, now) {
826
869
  if (!w || !Number.isSafeInteger(w.count) || w.count < 1) return [];
827
870
  const style = pulsing ? { bold: true } : {};
828
871
  const { bg, fg } = badgeColors(ICON.violet);
872
+ const shape = { backgroundColor: bg, ...rounded(), borderColor: bg, paddingX: 1 };
829
873
  // An older BB lists no items: the one count badge, as before.
830
874
  if (!Array.isArray(w.items) || !w.items.length) {
831
875
  const text = waitsText(w, now);
832
- return text ? [el.Box({ key: key + "-waits", flexDirection: "row", flexShrink: 0, backgroundColor: bg, paddingX: 1, children: [el.Text({ color: fg, ...style, children: [text] })] })] : [];
876
+ return text ? [el.Box({ key: key + "-waits", flexDirection: "row", flexShrink: 0, ...shape, children: [el.Text({ color: fg, ...style, children: [text] })] })] : [];
833
877
  }
834
878
  const out = w.items.slice(0, MAX_WAIT_BADGES).map((i) =>
835
879
  el.Box({
836
880
  key: key + "-wait-" + i.id,
837
881
  flexDirection: "row",
838
882
  flexShrink: 0,
839
- backgroundColor: bg,
840
- paddingX: 1,
883
+ ...shape,
841
884
  children: [
842
885
  el.Text({ color: fg, ...style, children: ["⏳ " + i.label + " · " + shortAge(i.created_at, now) + " "] }),
843
886
  el.Link({ href: LINKS.wait(i.id), label: "↗" }),
@@ -852,7 +895,7 @@ function contextLine(el, key, waits = null) {
852
895
  const alarm = contextAlarm(context);
853
896
  if (alarm)
854
897
  children.push(
855
- el.Box({ key: key + "-ctx", flexDirection: "row", flexShrink: 0, backgroundColor: "error", paddingX: 1, children: [el.Text({ color: "#ffffff", bold: true, children: [alarm] })] }),
898
+ el.Box({ key: key + "-ctx", flexDirection: "row", flexShrink: 0, backgroundColor: "error", ...rounded(), borderColor: "error", paddingX: 1, children: [el.Text({ color: "#ffffff", bold: true, children: [alarm] })] }),
856
899
  );
857
900
  children.push(...waitBadges(el, key, waits, currentTime));
858
901
  if (!children.length) return null;
@@ -865,10 +908,14 @@ async function readContext($) {
865
908
  context = null;
866
909
  }
867
910
  }
911
+ // BOT-3228 AC-1: one short, single-spaced note per failed read, joined by " · ".
912
+ // The band says "project", never "epic" (Jono, 2026-11-14).
868
913
  const UNREAD = {
869
- prs: "Couldn't read this session's PRs",
870
- epic: "Couldn't read this session's epic",
871
- staging: "staging: couldn't read",
914
+ prs: "Couldn't load PRs",
915
+ epic: "Couldn't load project",
916
+ staging: "Couldn't load staging",
917
+ // BOT-3228 AC-3: the session's own read was not used; the tickets are a guess.
918
+ session: "Guessed from branch",
872
919
  };
873
920
  // The chip's own age format: minutes, then hours under two days, then days.
874
921
  function shortAge(fromIso, now) {
@@ -883,7 +930,17 @@ function stagingBanner(el, key, since) {
883
930
  flexDirection: "row",
884
931
  columnGap: 1,
885
932
  children: [
886
- el.Text({ color: "error", bold: true, children: ["▲ Staging red" + (since ? " " + shortAge(since, currentTime) : "")] }),
933
+ // BOT-3228: the same red badge, white lettering, as the context alarm.
934
+ el.Box({
935
+ key: key + "-badge",
936
+ flexDirection: "row",
937
+ flexShrink: 0,
938
+ backgroundColor: "error",
939
+ ...rounded(),
940
+ borderColor: "error",
941
+ paddingX: 1,
942
+ children: [el.Text({ color: "#ffffff", bold: true, children: ["▲ Staging red" + (since ? " " + shortAge(since, currentTime) : "")] })],
943
+ }),
887
944
  el.Link({ href: LINKS.staging, label: "Open staging ↗" }),
888
945
  ],
889
946
  });
@@ -919,7 +976,7 @@ function bandLines(el, $, inPane) {
919
976
  key: k("line-ticket-" + t.key),
920
977
  prefix,
921
978
  ids: [{ label: t.key, href: LINKS.ticket(t.key), out: OUT.ticket(s.tenant, t.key) }],
922
- icon: lead(el, "◆", badgeColors(ticketHex(t.status)).fg, "ticket " + t.status, ticketIcon(t.status)),
979
+ icon: lead(el, "◆", "#ffffff", "ticket " + t.status, inked(ticketIcon(t.status), badgeColors(ticketHex(t.status)).bg)),
923
980
  hex: ticketHex(t.status),
924
981
  status: [{ text: t.status }],
925
982
  title: t.title,
@@ -935,7 +992,7 @@ function bandLines(el, $, inPane) {
935
992
  key: k("line-pr-" + p.number),
936
993
  prefix,
937
994
  ids: [{ label: "PR " + p.number, href: LINKS.pr(p.repo, p.number), out: OUT.pr(p.repo, p.number) }],
938
- icon: lead(el, "⎇", badgeColors(hex).fg, "pr " + p.state, prIcon(p.state)),
995
+ icon: lead(el, "⎇", "#ffffff", "pr " + p.state, inked(prIcon(p.state), badgeColors(hex).bg)),
939
996
  hex,
940
997
  status,
941
998
  title: p.title,
@@ -954,7 +1011,7 @@ function bandLines(el, $, inPane) {
954
1011
  out: s.epic.url,
955
1012
  },
956
1013
  ],
957
- icon: lead(el, "◇", badgeColors(epicHex(s.epic.state)).fg, "epic " + s.epic.state + " " + s.epic.percent + "%", epicIcon(s.epic.state, s.epic.percent)),
1014
+ icon: lead(el, "◇", "#ffffff", "project " + s.epic.state + " " + s.epic.percent + "%", inked(epicIcon(s.epic.state, s.epic.percent), badgeColors(epicHex(s.epic.state)).bg)),
958
1015
  hex: epicHex(s.epic.state),
959
1016
  status: [{ text: s.epic.percent + "%" }, ...(Number.isSafeInteger(s.epic.total) && s.epic.total > 0 ? [{ text: s.epic.done + "/" + s.epic.total, muted: true }] : [])],
960
1017
  // BOT-3213: the project a coordinator session runs, with its tickets by state.
@@ -962,14 +1019,15 @@ function bandLines(el, $, inPane) {
962
1019
  ? "Coordinating · " + (s.epic.counts ? countsText(s.epic.counts) + " · " : "") + s.epic.name
963
1020
  : s.epic.name,
964
1021
  });
965
- else if (s.epic_unreadable)
966
- specs.push({ key: k("line-epic"), ids: [], icon: el.Text({ color: "warning", children: ["◇ "] }), status: [], title: UNREAD.epic, dim: true });
967
1022
  const keys = s.tickets.map((t) => t.key);
968
1023
  const prsOf = (key) => (s.prs || []).filter((p) => p.ticket === key);
969
1024
  // A ticket whose project BB did not report (an older CLI) stays in the epic.
970
1025
  const inEpic = (t) => !!s.epic && (t.project === undefined || t.project === s.epic.id);
971
1026
  const branch = (last) => (last ? "└─ " : "├─ ");
972
- const stem = (last) => (last ? " " : "│ ");
1027
+ // BOT-3228: no trunk between a ticket's PRs and the next ticket. A row
1028
+ // draws only its own branch, so a wrapped title broke the trunk into stray
1029
+ // dashes (Jono, 2026-11-14); the indent alone nests the PRs.
1030
+ const stem = () => " ";
973
1031
  const epicTickets = s.tickets.filter(inEpic);
974
1032
  epicTickets.forEach((t, i) => {
975
1033
  const last = i === epicTickets.length - 1;
@@ -979,31 +1037,31 @@ function bandLines(el, $, inPane) {
979
1037
  });
980
1038
  for (const t of s.tickets.filter((t) => !inEpic(t))) {
981
1039
  // A ticket in another project is not epic-less (review on #1657).
982
- specs.push(ticketSpec(t, "", !s.epic ? null : t.project ? "other epic" : "no epic"));
1040
+ specs.push(ticketSpec(t, "", !s.epic ? null : t.project ? "other project" : "no project"));
983
1041
  const prs = prsOf(t.key);
984
1042
  prs.forEach((p, j) => specs.push(prSpec(p, branch(j === prs.length - 1))));
985
1043
  }
986
1044
  // BOT-3152 AC-1: no PR means no row; a failed read says so.
987
1045
  if (s.prs) for (const p of s.prs.filter((p) => !keys.includes(p.ticket))) specs.push(prSpec(p, "", "no ticket"));
988
- else
989
- specs.push({
990
- key: k("line-pr"),
991
- ids: [],
992
- icon: el.Text({ color: "warning", children: ["⎇ "] }),
993
- status: [],
994
- title: UNREAD.prs,
995
- dim: true,
996
- });
997
- const widths = {
998
- ids: Math.max(...specs.map((x) => idsWidth(x.ids, x.prefix))),
999
- status: Math.max(...specs.map(statusWidth)),
1000
- };
1046
+ // BOT-3152 AC-1 / BOT-3228 AC-1: a failed read is a note, never an empty
1047
+ // state; every note shares one dim line, joined by a single " · ".
1048
+ const notes = [];
1049
+ if (s.binding === "branch" && s.session_read && s.session_read !== "ok") notes.push(UNREAD.session);
1050
+ if (!s.prs) notes.push(UNREAD.prs);
1051
+ if (s.epic_unreadable) notes.push(UNREAD.epic);
1052
+ // BOT-3152 edge case: unknown staging is its own signal, never a quiet green.
1053
+ if (s.staging == null) notes.push(UNREAD.staging);
1001
1054
  const right = [...tag];
1002
1055
  if (stale()) right.push(el.Text({ color: "warning", children: ["STALE"] }));
1003
- // BOT-3152 edge case: unknown staging is its own signal, never a quiet green.
1004
- if (s.staging == null) right.push(dim(el, UNREAD.staging));
1056
+ if (notes.length) right.push(el.Text({ key: k("line-notes"), dimColor: true, children: [notes.join(" · ")] }));
1005
1057
  if (details) right.push(details);
1006
- const lines = specs.map((spec, i) => bandLine(el, spec, widths, i === 0 ? right : null));
1058
+ const widths = {
1059
+ ids: Math.max(0, ...specs.map((x) => idsWidth(x.ids, x.prefix))),
1060
+ status: Math.max(0, ...specs.map(statusWidth)),
1061
+ };
1062
+ const lines = specs.length
1063
+ ? specs.map((spec, i) => bandLine(el, spec, widths, i === 0 ? right : null))
1064
+ : [el.Box({ key: k("line-notes-only"), flexDirection: "row", columnGap: 1, children: right })];
1007
1065
  // BOT-3223 AC-1: context alarm and wait badges lead, on one wrapping line.
1008
1066
  const ctx = contextLine(el, k("line-context"), s.waits);
1009
1067
  if (ctx) lines.unshift(ctx);
@@ -1028,6 +1086,7 @@ export function register(on) {
1028
1086
  immediate: true,
1029
1087
  });
1030
1088
  parked = false;
1089
+ sessionStartedAt = await $.clock.now();
1031
1090
  await readContext($);
1032
1091
  if (await onScreen($)) await refresh($);
1033
1092
  else parked = true;
@@ -1114,9 +1173,11 @@ export function register(on) {
1114
1173
  surface = e.surface;
1115
1174
  const theirs = await next(e);
1116
1175
  if (unbound && mode === "live") return theirs;
1176
+ // BOT-3228: one even gap between the band's rows (none in the terminal,
1177
+ // where a row is a line; the surface's small step elsewhere).
1117
1178
  return el.Box({
1118
1179
  flexDirection: "column",
1119
- children: [theirs, ...bandLines(el, $)],
1180
+ children: [theirs, el.Box({ key: "band", flexDirection: "column", rowGap: "xs", children: bandLines(el, $) })],
1120
1181
  });
1121
1182
  });
1122
1183
  on("ui.render", { component: "Pane" }, async ($, e, next) => {
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.2",
3
- "source_commit": "a68b7621d7a09d47f21817aa4142cc569d413308",
4
- "source_sha256": "121a9bd036dd71b421a3e5cabc790e46bf1c7412bbd22b16ee737e1c821b2afb",
2
+ "release_version": "1.73.4",
3
+ "source_commit": "0b33bfa2eb6de470d62b9f6bff2a9c60713a4d18",
4
+ "source_sha256": "d48572c37a0929ac8800bbc8cca933ecd915557e4e2f99d129dafd3ffc3816ca",
5
5
  "target": "darwin-arm64",
6
- "sha256": "ca76663fcf476ee7388bbc2121861b8f54dc5bb959cf43abc500279365a4a77b"
6
+ "sha256": "282e1f7777f12b54bb31969b3d34b808f83c149eefe3a03056de93d724439de2"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.2",
3
- "source_commit": "a68b7621d7a09d47f21817aa4142cc569d413308",
4
- "source_sha256": "121a9bd036dd71b421a3e5cabc790e46bf1c7412bbd22b16ee737e1c821b2afb",
2
+ "release_version": "1.73.4",
3
+ "source_commit": "0b33bfa2eb6de470d62b9f6bff2a9c60713a4d18",
4
+ "source_sha256": "d48572c37a0929ac8800bbc8cca933ecd915557e4e2f99d129dafd3ffc3816ca",
5
5
  "target": "linux-x64",
6
- "sha256": "019bb0e768691f06645ce50408446a9b76894b99d23203d427b2435631e0baf4"
6
+ "sha256": "4be7b327985e1cad4d60c5c6ae01d1976c60156dd1bba24282cc82469fe5a9b1"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.73.2",
4
- "source_commit": "a68b7621d7a09d47f21817aa4142cc569d413308",
5
- "source_sha256": "121a9bd036dd71b421a3e5cabc790e46bf1c7412bbd22b16ee737e1c821b2afb",
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": "ca76663fcf476ee7388bbc2121861b8f54dc5bb959cf43abc500279365a4a77b",
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": "019bb0e768691f06645ce50408446a9b76894b99d23203d427b2435631e0baf4",
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.2",
3
+ "version": "1.73.4",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,6 +5,7 @@ import { execFile } from "node:child_process";
5
5
  import { promisify } from "node:util";
6
6
  import { join } from "node:path";
7
7
  import { homedir } from "node:os";
8
+ import { findAgentStateRoot } from "./agent-state.mjs";
8
9
  const execFileAsync = promisify(execFile);
9
10
  const UUID =
10
11
  /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
@@ -265,6 +266,17 @@ export async function readStatus({
265
266
  const own = await bb("get_session_status", {});
266
267
  const ownOk =
267
268
  own?.session_id === state.session_id && own?.tenant_id === tenant && Array.isArray(own?.tickets);
269
+ // BOT-3228 AC-3: why the session's own read was not used, so a branch guess
270
+ // says so and the cause can be found.
271
+ const sessionRead = ownOk
272
+ ? "ok"
273
+ : own == null
274
+ ? "unavailable"
275
+ : own?.session_id !== state.session_id
276
+ ? "other_session"
277
+ : own?.tenant_id !== tenant
278
+ ? "other_tenant"
279
+ : "malformed";
268
280
  const sessionKeys = ownOk && !selected
269
281
  ? [...new Set(own.tickets.map((x) => String(x?.key || "").toUpperCase()).filter((k) => keyPattern.test(k)))].slice(0, 5)
270
282
  : [];
@@ -541,6 +553,7 @@ export async function readStatus({
541
553
  // BOT-3136: where the tickets came from — the registered session, an explicit
542
554
  // pick, or (only when the session registered none) a guess from the branch.
543
555
  binding: bindingKind,
556
+ session_read: sessionRead,
544
557
  blockers: useLinear && key
545
558
  ? [...new Map(blockers.map((b) => [b.key, b])).values()].sort((a, b) =>
546
559
  a.key.localeCompare(b.key),
@@ -562,6 +575,10 @@ export async function readStatus({
562
575
  // for HOLDER_IDLE_MS is gone; one with no transcript on this host keeps the
563
576
  // BB-expiry rule.
564
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;
565
582
  const HOLDER_IDLE_MS = 30 * 60 * 1000;
566
583
  const UUID_ONLY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
567
584
  // true: the holder's transcript was written within HOLDER_IDLE_MS; false: it
@@ -737,12 +754,24 @@ export async function main(args, {
737
754
  args = [...args];
738
755
  const skipEpic = args.at(-1) === "--skip-epic";
739
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
+ }
740
765
  if (args.length !== 2 && args.length !== 4) refuse("invalid_arguments");
741
766
  if (
742
767
  args[0] !== "--harness-session-id" ||
743
768
  (args.length === 4 && args[2] !== "--ticket-id")
744
769
  )
745
770
  refuse("invalid_arguments");
771
+ // BOT-3228 AC-2: Claude's working directory can be any folder of the
772
+ // worktree (a `cd` in the session moves it); the binding and the session
773
+ // cache live at the worktree's root, so read from there.
774
+ cwd = await findAgentStateRoot(await realpath(cwd).catch(() => cwd));
746
775
  const request = { cwd, harnessSessionId: args[1], ticketId: args[3], linearKey: env.LINEAR_BB_API_KEY, skipEpic };
747
776
  if (UUID.test(args[1])) await keepSessionAlive({ cwd, harnessSessionId: args[1], now, heartbeat, renew });
748
777
  let snapshot;
@@ -751,6 +780,16 @@ export async function main(args, {
751
780
  } catch (error) {
752
781
  const bind = BINDABLE.has(error?.message) && UUID.test(args[1]) ? await bindable(cwd, args[1], now, holderActive) : false;
753
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
+ }
754
793
  let branch = null;
755
794
  try {
756
795
  branch = (await execFileAsync("git", ["branch", "--show-current"], { cwd })).stdout.trim() || null;
@@ -778,7 +817,8 @@ export async function main(args, {
778
817
  } catch (error) {
779
818
  const known = /^[a-z_]+$/.test(error?.message ?? "") ? error.message : "status_unavailable";
780
819
  const prefix = known === "ticket_missing" && /^[A-Z]{2,10}$/.test(error?.prefix ?? "") ? { prefix: error.prefix } : {};
781
- 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");
782
822
  return 1;
783
823
  }
784
824
  }