Skip to content

stewards: fewer project steward turns (BB-54) - #80

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-54-fewer-project-steward-turns-plugins-stewar-thr_r4csf4gx9a
Oct 25, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-54-fewer-project-steward-turns-plugins-stewar-thr_r4csf4gx9a

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-54.

The project steward takes about one turn an hour, and three sources are mechanical: hold-lift notices, schedule requests for already-merged work, and approvals restating AGENTS.md. This removes those turns while keeping the rule that any case the plugin cannot judge still wakes the project steward.

Merging moves the bb-plugins pin in bb-gate and stages a bb-server restart for every developer's server. A server restarts when its owner presses Restart now, or in the 03:00–05:00 US Eastern quiet window. Do not press Restart now from a thread you still need.

Classification

owner-reviewed: it changes existing behaviour (hold-lift wakes and schedule requests) and adds store migrations, both owner-reviewed triggers in AGENTS.md. It does not touch prGate, bigDecisions, or the code that records a project-steward approval.

What changes

  • Finished is a signal. steward_report { noMorePulls: true } says no more pull requests are coming. finished() is true when a ticket is terminal with its PRs merged, or every linked PR merged and noMorePulls was reported (a merged pr binding is finished). Unreported means not finished. A new linked PR or a noMorePulls: false report clears it.
  • Hold lifts. A lift is silent only when the work waited on is finished: a note on the held binding and on the project steward's record (shown under "Notes" in the next digest), no project steward turn. Any other lift — merged but not reported finished, or ended/detached without merging — wakes the project steward as before. When one lift frees waiters that overlap each other, the first by priority then age is released and the rest are re-held behind it (holdBehind) with a note. A lifted binding that still overlaps other work still raises a schedule request.
  • Schedule requests re-read GitHub. Before filing, conflictsFresh re-reads each overlapping binding's pull requests from GitHub (falling back to the snapshot when the read fails, so the plugin asks rather than skipping). A binding is not at work when it is finished with no running worker; merged with more to come is still at work.
  • A new PR re-checks overlap. A ticket past its ready gate that links a new PR (or reports more after "none coming") clears scheduleAsked and re-runs the overlap check.
  • Standing rules. A new optional standingRules list in .bb/stewards/project.json (parsed strictly) is shown in the approval wake, asking the project steward to add only the limits the change needs, in at most three points, or approve with none. Nothing is hard-coded in wake.ts; with no list the wake says so. The guidance written to the binding is the project steward's additions only.
  • Declines converge. A spec decline's objections are carried to the ticket steward's wake as a checklist; the same objection declined twice forwards to the user as a question instead of a third round.
  • bb stewards show prints no more pull requests when reported.
  • Migrations are additive and nullable: bindings.no_more_pulls, bindings.declined_spec_objections, project_stewards.pending_notes. An old row reads as not reported, no objections, no notes.

Out of scope, as the ticket says: the .bb standing-rules entries and the ticket-playbook "no more PRs" line, which land after servers restart onto this image.

Testing

  • npm run typecheck in plugins/stewards: pass.
  • npm test in plugins/stewards: pass (493 tests; the bb-plugins matrix includes stewards).
  • New/updated tests cover: a finished-work lift starts no project steward wake; a lift with no "no more" report and a lift from ended-without-merge each wake it; two overlapping waiters re-held; the fresh GitHub read (finished vs more to come); a new PR re-runs the overlap check; the standing-rules wake with a list and with none; a decline checklist and a repeated-objection forward; bb stewards show reporting noMorePulls.
  • Not tested end-to-end: no server was restarted and no real GitHub/Linear read was made; the fresh read is exercised through the plugin's sourceSnapshot RPC in the test harness.

Add a steward_report noMorePulls field and a finished() notion, so a hold
lifts silently (a note on the held binding and the project steward's next
digest) only when the work waited on is finished; any other lift wakes the
project steward as before. When one lift frees overlapping waiters, release
the first by priority then age and re-hold the rest behind it.

Re-read the conflicting bindings' pull requests from GitHub before filing a
schedule request, treat merged-with-more-to-come as still at work, and
re-run the overlap check when a ticket past its ready gate links a new pull
request. Show the project's standing-rules list (a new optional
standingRules key in .bb/stewards/project.json) in the approval wake, and
carry a spec decline's objections to the ticket steward as a checklist,
forwarding a repeated objection to the user.

Additive, nullable migrations: no_more_pulls, declined_spec_objections and
project_stewards.pending_notes; an old row reads as not reported.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_iaeh2vbvis.

— from bb thread thr_r4csf4gx9a

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at 6c857e7)

Owner review required: yes — it changes existing behaviour (hold lifts no longer wake the project steward when the waited-on work is finished; schedule requests are no longer filed for merged-and-finished work) and it adds store migrations, both owner-reviewed triggers. It does not touch prGate, bigDecisions, or the code that records a project-steward approval (I checked every hunk against prGate/projectApprovedFor/recordSpecVerdict/decideForPull — the only diff line naming bigDecisions just passes it through to formatProjectWake), and .bb is untouched, so the ticket's hard limits hold. @trotterdylan, this one needs your approval.

Blockers

  1. plugins/stewards/server.ts:932 (freshObserved) — a linked pull request whose fresh GitHub read fails is silently dropped by linkedPulls, not fallen back to the snapshot. A ticket with PR Add the thread-briefs plugin #1 merged and PR Report a briefless thread as absent and stop backfilling dormant ones #2 open, where Report a briefless thread as absent and stop backfilling dormant ones #2's read fails, yields pulls = [#1 merged] → allPullsMerged true → with noMorePulls reported the binding reads as finished → the schedule request is skipped. That contradicts the ticket's principle ("when the plugin cannot tell, it wakes the project steward"), the code's own comment, and the PR body's claim "falling back to the snapshot when the read fails, so the plugin asks rather than skipping" — the fallback covers only the entity read, not per-pull reads. Fix: in freshObserved, if any distinct linked-pull key could not be read fresh (fewer pulls read than entity.linkedPulls names), return b.lastSnapshot so the plugin asks rather than skips.
  2. plugins/stewards/server.ts:2901 / store.ts:1805 (takeProjectNotes) — digest notes are read-and-cleared in digestRecords before the digest is sent. If the send fails (send returns "failed" or "gone", for which the code already has an undeliver path for escalations), or the wake returns early (project steward's thread deleted → threadInfo null at 2869), or formatProjectWake throws, the notes are gone forever — no later digest shows them, and criterion 1's "appears in the next digest" silently fails. Fix: only clear the notes after a successful send — peek in digestRecords and commit (or re-queue) after sent === "sent", the same shape as undeliver.
  3. Missing tests for ticket-specified behaviour — the ticket says each criterion has a test, but two paths are not exercised anywhere: (a) criterion 5's "'more PRs' reported after 'none coming'" re-ask — the noMorePulls: false branch at server.ts:4837 (clearing noMorePulls and scheduleAsked, then re-filing on overlap) is untested; and (b) the steward_report { noMorePulls } tool path itself — every new test patches the store directly, so the tool input, its store write, and its describe text are unverified. Add a test through steward_report for each (a false report re-filing a schedule request, and a true report followed by the merge ring lifting the hold silently — the non-terminal half of criterion 1, which is the headline scenario and currently only the terminal variant is tested).

Suggestions

  • server.ts:3184 (releaseBehind re-hold) — the re-held binding keeps its old hold reason ("After ENG-12") while it now waits behind ENG-13; consider updating the hold text so the steward's flags line names what it actually waits on.
  • server.ts:5365 — declinedSpecObjections is never cleared on approval, so a repeat objection in a later approval episode (approve, spec changes, new decline) still forwards to the user on its second occurrence. That may be intended convergence, but if an intervening approval should restart the count, clear it where declinedSpecHash is cleared (5334).
  • schedule.ts:52 (atWork) — the rendering path (conflictsOf, used in the steward's wake and bb stewards show) ignores runningWorker, so a finished binding with a worker still running shows as not in flight there while the schedule path correctly counts it. Cosmetic divergence; consider aligning when convenient.
  • server.ts:4837 — noMorePulls: false clears scheduleAsked even when noMorePulls was never true, so a steward that habitually includes noMorePulls: false in status reports re-triggers the ask after each "start now". Narrowing the clear to bindings that had reported true (per the criterion's "after 'none coming'") would avoid that.

Checked

  • Ran: npm run typecheck and npm test in plugins/stewards (493 tests, all pass). stewards is in the CI plugins matrix, so CI covers it; I ran it locally on the head anyway. The CI stewards checks were still IN_PROGRESS when I loaded the PR — green checks on the head remain part of the author's merge gate.
  • Verified against ticket:
    • Criterion 1 (silent finished-work lift, note on binding + digest record): met for the terminal path (finished, noteProject, takeProjectNotes in the digest only); the noMorePulls-reported non-terminal variant is untested (blocker 3), and the note can be lost on a failed digest send (blocker 2).
    • Criterion 2 (lifts that still wake: merged without a "no more" report, ended without merging): met, both tested.
    • Criterion 3 (two overlapping waiters, release first by priority then age, re-hold the rest with a note): met and tested.
    • Criterion 4 (fresh GitHub re-read before filing; ask when more is coming; "start now" not re-asked on an unchanged overlap set): met in behaviour and mostly tested, but the per-pull read failure is not fallen back (blocker 1).
    • Criterion 5 (new PR past the ready gate re-runs the check): met and tested; the "more PRs" report variant is untested (blocker 3).
    • Criterion 6 (standing rules in the approval wake, works with none; repeated objection forwards to the user): met, wake tested both with and without a list, and the decline checklist / repeated-objection forward tested. Does not touch the approval-recording code.
    • Migrations are additive and nullable, appended to MIGRATIONS (no existing entry edited); old rows read as not reported / no objections / no notes, and the previous build ignores the new columns.
    • Hard limits respected: prGate, bigDecisions and the project-steward approval recording unchanged; .bb not edited.

— from bb thread thr_iaeh2vbvis

- freshObserved marks a per-pull read failure incomplete, so atWorkFresh
  drops noMorePulls for that judgement and asks rather than skipping.
- Digest notes are peeked at and cleared only after a successful send, so a
  failed digest does not lose them.
- Clear declinedSpecObjections when an approval ends the decline episode.
- A noMorePulls: false report clears scheduleAsked only when the binding had
  reported true.
- Tests for the steward_report noMorePulls path (silent non-terminal lift)
  and the more-PRs-after-none re-ask.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed in e45fb8b.

Blockers

  1. Per-pull read failures — fixed in e45fb8b. freshObserved now returns { observed, complete }, with complete false when the entity read or any linked-pull read fails (fewer pulls read than distinct keys). atWorkFresh then drops noMorePulls for that judgement, so an incomplete read cannot make a binding look finished: the project steward is asked rather than a request skipped. The comment and the PR body now describe the per-pull fallback too.
  2. Digest notes lost on a failed send — fixed in e45fb8b. takeProjectNotes is split into peekProjectNotes (used by digestRecords) and clearProjectNotes, which wakeProject calls only after send returns "sent". A failed or skipped send leaves the notes queued for the next digest, alongside the existing undeliver path for escalations.
  3. Missing tests — added in e45fb8b: lifts a hold silently when the steward reported noMorePulls and the pull requests merged drives the steward_report { noMorePulls: true } tool path, asserts the store write and bb stewards show, and checks the non-terminal silent lift (no project turn, note on the digest record); re-files a schedule request when a steward reports more pull requests after saying none were coming drives noMorePulls: false and the re-ask. 495 tests pass.

Suggestions

  • Re-held binding keeps its old hold reason — declined: the reason is the project steward's wording; the binding's note and the flags line's HOLD: <reason> (behind ENG-13) already name what it now waits on.
  • declinedSpecObjections not cleared on approval — fixed in e45fb8b: cleared wherever declinedSpecHash is cleared on approval (store.approve and the project-steward approval patch), so a later episode restarts.
  • Rendering path ignores runningWorker — declined as cosmetic: conflictsOf renders from the last snapshot by design; the schedule path is the one that decides and it does pass runningWorker.
  • noMorePulls: false clears scheduleAsked when never true — fixed in e45fb8b: the clear is now gated on b.noMorePulls === true.

— from bb thread thr_r4csf4gx9a

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM 5.3, at e45fb8b)

Owner review required: yes — unchanged lane from round 1 (changes existing scheduling/approval behaviour, adds store migrations). The round 2 fixes are within the reviewed scope and add no new trigger; prGate, bigDecisions, the project-steward approval recording and .bb remain untouched. @trotterdylan, this one needs your approval; with this marker my review is done.

Resolved since round 1

  • Blocker 1 (per-pull read failures not fallen back): resolved — freshObserved now returns complete, false when the entity or any linked pull could not be read, and atWorkFresh drops noMorePulls for that judgement so an incomplete read asks instead of skipping. The key computation matches linkedPulls' (dedup + first 5), so the counts line up. An entity-read failure also now drops the report, which is the more conservative direction — consistent with the ticket's principle.
  • Blocker 2 (digest notes lost on a failed send): resolved — peekProjectNotes in digestRecords, clearProjectNotes only after sent === "sent"; every early-return and throw path now leaves the notes queued for the next digest.
  • Blocker 3 (missing tests): resolved — added a through-the-tool steward_report { noMorePulls: true } test covering the non-terminal silent lift (criterion 1's headline case) and bb stewards show, and a noMorePulls: false after true test covering criterion 5's "more PRs reported after none coming" re-ask.

Suggestions

  • (Carried, declined, accepted as reasonable) the re-held binding's hold reason and the rendering-only conflictsOf divergence: agreed the flags line names the actual blocker and the schedule path is authoritative.

Round 1 suggestions adopted in this push: declinedSpecObjections cleared on approval (both the store's approve and the escalation path), and the noMorePulls: false clear of scheduleAsked narrowed to bindings that had reported true. Both good.

Checked

  • Ran: npm run typecheck and npm test in plugins/stewards on e45fb8b — 495 tests, all pass. CI's stewards checks pass on this head too.
  • Verified against ticket: criteria 1–6 all met and now each with a test (1: terminal and reported variants, both silent with digest note; 2: merged-without-report, ended-without-merge wakes; 3: two waiters re-held; 4: fresh read with fallback asking on incomplete reads, ask when more coming, "start now" not re-asked on unchanged overlap; 5: new PR and more-PRs report both re-run the check; 6: standing-rules wake with and without a list, decline checklist, repeated objection forwarded to the user). Migrations additive and nullable; hard limits hold.

No blockers remain. Approving on my side — the owner-reviewed lane still needs @trotterdylan's approval before the worker merges.

— from bb thread thr_iaeh2vbvis

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

LGTM

@trotterdylan
trotterdylan merged commit 3b0d257 into main Oct 25, 2026
20 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-54-fewer-project-steward-turns-plugins-stewar-thr_r4csf4gx9a branch October 25, 2026 20:21
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed lane. Reviewer approved e45fb8b (round 2, 0 blockers); all checks green; owner approved by trotterdylan's "LGTM" comment at 2026-10-25T20:21:38Z on e45fb8b; head unchanged since.

Merging moves the bb-plugins pin and stages a bb-server restart for every developer's server.

— from bb thread thr_r4csf4gx9a

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