@botbuddy/cli 1.85.0 → 1.85.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.85.1
4
+
5
+ - `bb bootstrap` connects in a reused worktree when you are signed in as the owner (BOT-3253): another session's stale cached session is retired with its own credential instead of failing with `agent_identity_required`, and a cached credential the server no longer accepts is left to expire. A session that is still live keeps its cache and waits, and the command names it and says what to do next.
6
+
3
7
  ## 1.85.0
4
8
 
5
9
  - `bb release-notes digest --release <version> --voice internal|external` prints one production release's notes as Markdown, JSON (the bbrn-digest-1 schema) or Slack Block Kit (`--format`), byte for byte as the API returns them when piped, so a GitHub Actions step can post it to your own Slack or email (BOT-3204). On a terminal, control characters in a note print as visible escapes. `--repository owner/name` names the repository when a version exists in more than one; `--json` prints the whole answer.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.85.0",
3
- "source_commit": "0597756faf47e986dc7c147b0f8fee8e77db06b4",
4
- "source_sha256": "fe01dfc7bc60fb96051df54fbb1b690f7a8c535b271f39d46579c808015dd9ba",
2
+ "release_version": "1.85.1",
3
+ "source_commit": "686354d23b98bb6efdd2113834f98544bb169057",
4
+ "source_sha256": "b0d0b455d8d3c18fafdc66817cbbc62789b3ce0ae87184c32036a2a8ff2f1161",
5
5
  "target": "darwin-arm64",
6
- "sha256": "10d2ac05c6c9f1637a5beffc2709abf02ccd980b6ca714cf5970437abec74771"
6
+ "sha256": "119ce386d86f16bd2d084bf1f555a2752f8b5d9efbfb2744be999f953beb8eda"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.85.0",
3
- "source_commit": "0597756faf47e986dc7c147b0f8fee8e77db06b4",
4
- "source_sha256": "fe01dfc7bc60fb96051df54fbb1b690f7a8c535b271f39d46579c808015dd9ba",
2
+ "release_version": "1.85.1",
3
+ "source_commit": "686354d23b98bb6efdd2113834f98544bb169057",
4
+ "source_sha256": "b0d0b455d8d3c18fafdc66817cbbc62789b3ce0ae87184c32036a2a8ff2f1161",
5
5
  "target": "linux-x64",
6
- "sha256": "292c775e27a87b030dc719dc24b8d43a7859210cc216e3ff77c1959d3edc75bc"
6
+ "sha256": "474d3fc0ac7566916ef52cfe705fe46477f2e37e8267a1094a22564854c7c21d"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.85.0",
4
- "source_commit": "0597756faf47e986dc7c147b0f8fee8e77db06b4",
5
- "source_sha256": "fe01dfc7bc60fb96051df54fbb1b690f7a8c535b271f39d46579c808015dd9ba",
3
+ "release_version": "1.85.1",
4
+ "source_commit": "686354d23b98bb6efdd2113834f98544bb169057",
5
+ "source_sha256": "b0d0b455d8d3c18fafdc66817cbbc62789b3ce0ae87184c32036a2a8ff2f1161",
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": "10d2ac05c6c9f1637a5beffc2709abf02ccd980b6ca714cf5970437abec74771",
11
+ "sha256": "119ce386d86f16bd2d084bf1f555a2752f8b5d9efbfb2744be999f953beb8eda",
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": "292c775e27a87b030dc719dc24b8d43a7859210cc216e3ff77c1959d3edc75bc",
18
+ "sha256": "474d3fc0ac7566916ef52cfe705fe46477f2e37e8267a1094a22564854c7c21d",
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.85.0",
3
+ "version": "1.85.1",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,12 +50,10 @@ export async function claudeHolderActive(holder, worktree, { env = process.env,
50
50
  // Returns false (never bind), true (bootstrap as is), or { aside } — another
51
51
  // holder's cache to move out of the way first. The bootstrap would otherwise
52
52
  // try to retire that BB session and discard the new one when it cannot: the
53
- // server refuses the retirement for a live session (which would end the waits
54
- // other sessions still run on its token), and refuses it for an EXPIRED one too
55
- // whenever the durable credential is an owner bearer, since close_session needs
56
- // an agent identity (BOT-3252: the band then stayed on "belongs to another
57
- // session" forever in a reused worktree). Set aside, a live session expires on
58
- // its own once nothing renews it; the file is kept for recovery.
53
+ // server refuses the retirement for a session that is live in BB (which would
54
+ // end the waits other sessions still run on its token), even when its Claude
55
+ // session has gone. Set aside, a live session expires on its own once nothing
56
+ // renews it; the file is kept for recovery.
59
57
  export async function bindable(cwd, harnessSessionId, now, holderActive) {
60
58
  let state;
61
59
  let root;
@@ -474,7 +474,20 @@ export async function bootstrapHarnessSession({
474
474
  }
475
475
  retired = confirm;
476
476
  }
477
- if (!retired?.ok || retired.isError) {
477
+ // BOT-3253: close_session needs an agent identity, so an owner sign-in is
478
+ // always refused here. The cached session's own bearer can retire it, and
479
+ // if_stale still protects a live holder. A bearer the server rejects is
480
+ // dead for every process reading this cache, so that session is left to
481
+ // expire on its own.
482
+ let leftToExpire = false;
483
+ if ((retired?.data?.error || retired?.error) === "agent_identity_required" && cached.session_token) {
484
+ const own = await call("close_session", cachedCloseArgs, {
485
+ auth: { "x-agent-api-key": cached.session_token },
486
+ }).catch((error) => ({ ok: false, error: error?.message }));
487
+ if (own?.auth && !own.code) leftToExpire = true;
488
+ else retired = own;
489
+ }
490
+ if (!leftToExpire && (!retired?.ok || retired.isError)) {
478
491
  try {
479
492
  await discardNewSession();
480
493
  } catch (discardError) {
@@ -482,8 +495,15 @@ export async function bootstrapHarnessSession({
482
495
  // orphan and fail closed (propagating any marker-write failure).
483
496
  await recordOrphanAndFail({ session, cwd: worktree, retirementError: discardError });
484
497
  }
485
- throw new Error(retired?.data?.error || retired?.error || "cached harness session is still live or could not be retired");
498
+ const refusal = retired?.data?.error || retired?.error;
499
+ if (refusal === "session_still_active") {
500
+ throw Object.assign(new Error(
501
+ `session_still_active: BB session ${cached.session_id} is still live and holds this worktree's session cache, so it was left running. Use another worktree, or retry once that session has ended.`,
502
+ ), { code: refusal });
503
+ }
504
+ throw new Error(refusal || "cached harness session is still live or could not be retired");
486
505
  }
506
+ replacedCachedSession = { session_id: cached.session_id, retired: !leftToExpire };
487
507
  await clearHarnessSession(cached.session_id, {
488
508
  cwd: worktree,
489
509
  sessionToken: cached.session_token,