Skip to content

stewards: the printed reviewer command drops --parent-self (BB-323) - #356

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-323-reviewer-spawn-without-parent-self-thr_c2fk8ihctm
Nov 14, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-323-reviewer-spawn-without-parent-self-thr_c2fk8ihctm

Conversation

@trotterdylan

@trotterdylan trotterdylan commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Implements BB-323. The printed reviewer command keeps --lifecycle-owner-thread "$BB_THREAD_ID" but drops --parent-self, which bb core refuses for a child of an active Pi thread; a worker is active when it runs the command, so the command could not run at all. The plugin now recognizes a reviewer from that lifecycle owner: spawnedOwner/reviewerOwner, reviewersOf/supersedeOlderReviewers, archiveWorkers and the thread.created handler treat a parentless thread whose lifecycle owner is a worker of an open binding as that worker's reviewer, never validate it as a worker, and keep its worker unarchived while it is still live. A steward-owned or steward-parented thread is unchanged.

A merge to bb-plugins main moves the pin, builds a new bb-server image and stages a restart for every developer's server.

Sibling PR: none (one half; #355 is the stacked base, not a sibling).

Classification

owner-reviewed: the change alters what an existing command (bb stewards spawn-flags --role reviewer) prints and how the plugin recognizes reviewer threads, which is the project steward's decide-list entry for bb-plugins/plugins/stewards/**. It does not alter what the merge or spec gate reads.

What changes

  • wake.ts: spawnCommand({ role: "reviewer" }) prints no --parent-self, and keeps --lifecycle-owner-thread "$BB_THREAD_ID", --parent-notifications off, --visibility hidden, --permission-mode full and the reviewer model flags. The worker command is unchanged.
  • server.ts: reviewerOwner also recognizes a parentless reviewer whose lifecycle owner is a worker of an open binding; reviewersOf lists parentless reviewers (bb has no lifecycle-owner filter, so the worker's project's root threads are read and filtered); supersedeOlderReviewers archives older reviewers of either form; archiveWorkers now also reads a candidate's live reviewers through reviewersOf, so a parentless reviewer — which is not a descendant — keeps the worker unarchived, and the worker is archived once the reviewer is; the thread.created handler supersedes a recognized reviewer and returns early only when neither its lifecycle owner nor its parent is an open binding's steward, so a steward-owned or steward-parented thread is still filed and validated. A parentless thread owned by a steward or an unknown thread is handled exactly as before.
  • Tests: a new createdReviewer fixture, a test for a parentless reviewer (recognized, not validated, superseded), the unchanged parented form, a steward-parented wrong-model thread still stopped, the parent-is-worker/lifecycle-owner-is-steward thread still stopped, and a worker kept while its parentless reviewer is unarchived and archived once the reviewer is.
  • read-counts.test.ts: the pinned reconcile reads rise 183 → 185 — the extra reviewersOf lookup reads the worker row and its binding.
  • Docs: the spawn-flags description, the BB-133 doc comment, README.md, DESIGN.md and the build-tickets skill no longer say a reviewer is parented with --parent-self; the skill also finds an existing reviewer by lifecycle owner, because the --parent-thread lookup is always empty for the new command.

Testing

  • npm install --include=dev --legacy-peer-deps --no-audit --no-fund then npm run typecheck: pass.
  • npm test: pass (1794 tests, 39 files).
  • New fixtures exercised: bb stewards spawn-flags --role reviewer output in server.test.ts (no --parent-self), the parentless reviewer recognition/supersede path, and the archiveWorkers keep-then-archive path.
  • Not tested: the live bb thread spawn command itself (bb core's canSpawnChild), which is out of scope.

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_n5xu6nd8a8.

— from bb thread thr_c2fk8ihctm

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (Claude Opus 5.5, at 53ba361)

Owner review required: yes — the PR changes what an existing command prints (bb stewards spawn-flags --role reviewer) and which threads the plugin treats as reviewers. The decide-list entry "The stewards plugin outside its authority seams …" is decide: project, so the project steward approves. Nothing here changes what the merge gate or the spec gate reads.

Product

This builds the fix in BB-323's approved spec (approved 2026-11-14) and stays inside its scope. Nothing in the product already covered it.

Blockers

  1. plugins/stewards/skills/build-tickets/SKILL.md:181-183, 211-213 — the skill still finds an existing reviewer with bb thread list --parent-thread "$BB_THREAD_ID" --include-hidden --json ("no child thread", and "look again with the --include-hidden list"). A reviewer started by the new command has no parent, so that lookup always comes back empty. I checked this live: this reviewer thread was spawned with the new command, and --parent-thread thr_c2fk8ihctm returns []. A worker that resumes, or that lost the id, will spawn a second reviewer, and thread.created then archives the first one mid-round. Fix: find the reviewer by lifecycle owner in both places. For example: bb thread list --project <project> --include-hidden --json | jq '.[] | select(.parentThreadId == null and .lifecycleOwnerThreadId == env.BB_THREAD_ID)'. That query finds this thread. Also change "A new child may sit in pending" so it no longer calls the reviewer a child.
  2. plugins/stewards/server.ts:3825-3836 (archiveWorkers) — the BB-47 rule says a worker with an unarchived reviewer must stay. The check uses descendantsOfMany, which walks the parent tree, so it never sees a reviewer that has no parent. I probed it: a worker that goes idle with a message that does not say "waiting" while its reviewer is still active is kept when the reviewer has a parent (t.created). With t.createdReviewer it is archived and the reviewer is left unarchived. The new command creates every reviewer this way, so the rule stops covering any reviewer from now on. The comment above the function has the same gap. Fix: count a candidate's live reviewersOf entries as well as its descendants, or do one hasParent: false listing per project, and add a test for the parentless case. archiveWorkers is not one of the server.ts functions the approved limits allow, so ask the steward to widen the limit before editing it. If you think the rule does not apply, show that bb core's experimental_listDescendants follows lifecycle owners. I could not confirm that: the SDK doc says "every thread below it", and the test world walks parents.
  3. plugins/stewards/server.ts:8562-8565 — the new early return also skips a thread whose parent is a worker but whose lifecycle owner is a steward. On the base branch that thread is filed and validated as a worker. On this head store.worker is null, so it is never validated. I probed both commits. This breaks AC2 and the approved limit: "validateWorkerSpawn still runs on steward-owned or steward-parented threads". Fix: return only when neither the lifecycle owner nor the parent is an open binding's steward, and add that case to the new test.

Tested

  • Ran: npm run typecheck && npm test in plugins/stewards. Both pass (39 files, 1793 tests). CI's quality_checks (stewards) was still running when I loaded the PR.
  • Off-diff: the bb thread list lookups for blocker 1 were run against the live server. The probes for blockers 2 and 3 were throwaway vitest files, deleted after the run.

— from bb thread thr_n5xu6nd8a8

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed at 736054a:

  • Blocker 1 (build-tickets skill finds the reviewer by --parent-thread): fixed. The skill's existence check is now the lifecycle-owner query bb thread list --project "$BB_PROJECT_ID" --include-hidden --json | jq '[.[] | select(.parentThreadId == null and .lifecycleOwnerThreadId == env.BB_THREAD_ID)]', and the "look again" line points at it. "A new child may sit in pending" now says "A new reviewer".
  • Blocker 2 (archiveWorkers never sees a parentless reviewer): fixed. archiveWorkers now also reads each candidate's live reviewers through reviewersOf and keeps the worker while one is unarchived; a failed lookup is "unknown", so the worker waits. The project steward widened the server.ts limit to allow this and the comment above it. New test: a worker whose parentless reviewer is active is kept, and archived once the reviewer is idle.
  • Blocker 3 (the early return skipped a worker whose parent is a worker but whose lifecycle owner is a steward): fixed. The handler now returns early only when neither its lifecycle owner nor its parent is an open binding's steward; that thread is still filed and validated. Added the exact case to the test (wrong model still stopped).
  • read-counts.test.ts: the pinned reconcile reads rise 183 → 185 for the extra reviewersOf read (the worker row and its binding); the PR body names it.

npm run typecheck and npm test pass (1794 tests, 39 files).

— from bb thread thr_c2fk8ihctm

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (Claude Opus 5.5, at 736054a)

Owner review required: yes — the PR changes what bb stewards spawn-flags --role reviewer prints and which threads the plugin treats as reviewers. The decide-list entry "The stewards plugin outside its authority seams …" is decide: project, so the project steward approves.

Resolved since round 1

  • Blocker 1: resolved. Both places in the skill now look the reviewer up by lifecycle owner. Run live with this worker's id, the query returns this reviewer thread.
  • Blocker 2: resolved. archiveWorkers now also reads reviewersOf, and a failed listing keeps the worker too. The new BB-47 test covers a parentless reviewer.
  • Blocker 3: resolved. The early return now runs only when neither the lifecycle owner nor the parent is an open binding's steward, and thr_weird covers that case.

Tested

  • Ran: npm run typecheck && npm test in plugins/stewards. Both pass (39 files, 1794 tests).

— from bb thread thr_n5xu6nd8a8

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Approved at 736054a. Round 2 is approved and checks are green. The diff stays in the stewards plugin and changes nothing the merge or spec gate reads: no approvals.ts, prGate, assessment or decide-list code. One limit: after #355 squash-merges, rebase #356 onto main so its diff is BB-323's own before you merge. If GitHub retargets without a rebase, BB-322's commits, including the self-widening approvals.ts, show up in #356's file list and the gate routes it to the owner. The rebase needs no new approval.

— from bb thread thr_rkn6gtwp8m

@trotterdylan
trotterdylan force-pushed the bb/bb-323-reviewer-spawn-without-parent-self-thr_c2fk8ihctm branch from 736054a to d95f57e Compare November 14, 2026 18:08
@trotterdylan
trotterdylan changed the base branch from bb/bb-322-merge-gate-surfaces-read-the-stored-asses-thr_ewyfnr8k4z to main November 14, 2026 18:08
@trotterdylan
trotterdylan merged commit 6869413 into main Nov 14, 2026
11 checks passed
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed lane, reviewer approved 736054a, checks green, approved by the project steward.
since then: the head moved to d95f57e
merge commit 6869413
Note: merging this moves the pin and stages a restart for every developer's server (Restart now, or in the 03:00–05:00 ET quiet window).
dispatched bb-server.yaml on bitcomplete/bb-gate@main

trotterdylan added a commit that referenced this pull request Nov 14, 2026
…BB-325) (#357)

Implements [BB-325](https://linear.app/bit-complete/issue/BB-325/stewards-an-ended-binding-takes-no-new-question-forward-or-report).

An ended binding is now closed to new questions, forwards, holds and priority changes, and anything left on it or sent to it after the end is carried to the project steward instead of being stored on the binding or silently dropped. `openQuestions` skips ended bindings like `openEscalationsForProject` already does, and a question left on an ended binding is closed once with "The binding ended." and reported once.

> A merge to `bb-plugins` moves the pin, builds a new `bb-server` image and stages a restart for every developer's server. Do not press Restart now from a thread you still need.

Sibling PR: this is stacked on #356 (base branch `bb/bb-323-reviewer-spawn-without-parent-self-thr_c2fk8ihctm`), itself stacked on #355. It rebases onto `main` and retargets before merge once #356 lands.

## Classification
owner-reviewed: the stewards plugin outside its authority seams (`bb-plugins/plugins/stewards/**`, project-decided); `store.ts` also matches the store-migration entry. `escalations.ts`, the escalation routing and the ready gate are untouched, so the project steward decides.

## What changes
- `server.ts`
  - `steward_update { ask, binding }`, `{ forward }`, `{ hold }` and `{ priority }` on an ended binding fail with an error naming the end reason and date and the two alternatives (ask at project scope by omitting `binding`, or reopen the entity first). Nothing is stored. `resolve` of an existing question/escalation/assumption, `confirm`, `lessonAction` and reopening still work.
  - `steward_report` from a steward whose binding already ended writes nothing to the binding and carries its content (status, wait, escalation, needs) to the project steward as one folded note.
  - `bb stewards escalate` from a worker whose binding already ended files nothing and carries the question to the same note.
  - `finishEnding` still resolves every open escalation and question; the route-user ones and questions are listed in the project steward's next digest note.
  - A project-wide one-time close in `sweepProject` resolves any open escalation or question still attached to an ended binding (the BCP-154 case) and reports it once. The resolution is the record: a later sweep finds nothing open and reports nothing again. The test drives the production sweep, so deleting the call fails it.
- `store.ts`
  - `openQuestions` joins bindings and leaves out an ended binding's questions; a question about no single binding still shows.
  - `openOnEndedBindings` returns a project's open items on ended bindings with each binding's end.
  - `noteProjectFolded` queues a silent digest note, folded per binding, so several late reports are one line and none of them starts a turn.
- Tests in `server.test.ts` and `store.test.ts`.

## Testing
- `npm run typecheck`: pass.
- `npm test`: pass (1801 tests; CI's `quality_checks (stewards)` runs the same suite).
- Not tested: the live Stewards page render; the note is asserted from `peekProjectNotes`, which is what the digest renders.

## Reads (BB-291 criterion 10)
- Per-reconcile fixture (`read-counts.test.ts`), 4 bindings: **185 store reads, 12 source calls, 4 reconciles**; wake **15 store reads, 0 source calls**. Unchanged: the one-time close is a project-wide pass step (`store.openOnEndedBindings`, one read) beside `store.open`, outside the measured per-binding reconcile, exactly as it runs in `sweepProject`.
- No new network reads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant