Skip to content

stewards: one spec approval from any surface (BB-13) - #34

Merged
trotterdylan merged 4 commits into
mainfrom
bb/bb-13-implement-one-spec-approval-thr_9tbgh7t7th
Oct 19, 2026
Merged

trotterdylan merged 4 commits into
mainfrom
bb/bb-13-implement-one-spec-approval-thr_9tbgh7t7th

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-13. The stewards approval flow only recorded an approval from the project steward's approve: true or from a message in the steward's own thread, and resolving an approval escalation with approving words marked the spec declined. A page answer recorded nothing, so syncApprovalRequest filed a fresh request, and a spec comment the user wrote from their own thread was not part of the spec hash. This records the approval wherever the approver's words are, so one spec approval passes from any surface.

Merging this moves the bb-server pin on bb-gate and builds a new image. That stages a restart on every developer's server, which happens when they press Restart now or in the 03:00–05:00 ET quiet window.

Classification

no-review: a bug fix in a live plugin's runtime code, one repo, no store migration, no cross-repo contract, no new dependency. It makes the approval flow record approvals as it was designed to, following the BB-7 precedent. It touches no source-contract.ts copy, bb-gate hook shape, Dockerfile list, identity, access or infrastructure.

What changes

  • reconcile.ts: classifyApproval tells approving words (LGTM, Approved, ship it) from clear refusals (no, not approved, declined) and everything else. specHash/isSpecComment take an optional isUserThread predicate, so a spec comment signed by a thread the user runs counts toward the spec; diffObserved marks it byUser. New asksForOpenApproval flags a status that asks for an approval already open.
  • store.ts: approve and decline patch the gate and resolve the binding's approval escalations in one transaction. answerQuestionOnly closes a question while leaving its escalation open for the project steward.
  • server.ts: stewardsAnswerQuestion approves, declines, or hands an ambiguous answer back to the project steward; steward_update records approval from approving guidance (no approve: true) and accepts the user's unsigned approving comment on the entity as the quote; a user spec comment carries its own approval when approval: me; the report reply says not to ask again; bb stewards show flags a report that does.
  • wake.ts/README.md: the wake carries the same "do not ask the user again; it is listed on the Stewards page" line, and the README describes the surfaces.

Testing

  • npm test in plugins/stewards: pass (123 tests; not in the CI matrix, which omits stewards).
  • npm run typecheck in plugins/stewards: clean.
  • New tests cover each acceptance criterion, including the BB-11 sequence (page answer, amendment, page answer again) with no duplicate request, and the classify/asksForOpenApproval pure functions on their own.
  • Not tested: the page itself was not driven in a browser; stewardsAnswerQuestion is exercised directly, as the existing page tests do.

— from bb thread thr_9tbgh7t7th

An approval was recorded only from the project steward's approve: true or
from a message in the steward's own thread, and resolving an approval
escalation with approving words marked the spec declined. The page answer
recorded nothing, so syncApprovalRequest filed a fresh request, and a spec
comment the user wrote from their own thread was not part of the spec.

Record the approval wherever the approver's words are: the project
steward's approving guidance resolving the request, an affirmative answer
on the Stewards page (which records it and resolves the escalation in one
transaction), an unsigned approving comment on the entity, or the user's
own spec comment with approval: me. A page answer that is neither an
approval nor a clear refusal goes back to the project steward to
interpret, not a decline. A spec comment signed by a thread the user runs
counts toward the spec hash, and while an approval request is open the
report and wake say not to ask the user again; a report that does shows as
a playbook violation in bb stewards show.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_u6n2ndxhd7.

— from bb thread thr_9tbgh7t7th

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at 51191ad)

Owner review required: no — none of the owner-reviewed triggers apply. Runtime code of a live plugin making the approval flow do what the ticket asks, one repo, no store migration (the ready schema is unchanged), no cross-repo contract (source-contract.ts untouched, contract.test.ts passes), no identity/access/infra change, no new dependency.

Blockers

  1. reconcile.ts classifyApproval (DECLINE_WORDS checked first) — clearly approving text that contains a bare "no" is classified as a decline, so a page answer like "LGTM, no concerns from me" or "Ship it, no further changes needed" records declinedSpecHash, resolves the escalation, and the request is never filed again until the spec changes. Verified by running the function: both strings → "decline". Criterion 1 requires ambiguous text to go to the project steward, not a decline — approving text must certainly not decline. This also weakens criterion 3 (userApprovedOnEntity discards such a comment as the user's approval). A plain order swap is not enough ("not approved"/"do not approve" contain approval words too); something like strong refusals (not approved, reject, declined, changes needed) beating approvals, approvals beating weak negatives (a bare no/don't), the rest ambiguous, would cover all four cases.

  2. server.ts ~2147, resolve auto-approval is not restricted to the approver the gate names — any thread that mayDirect (the binding's own steward, any parent steward) resolving an approval escalation with approving words now records the approval. Verified in the harness: the binding's own steward — the author of the spec — called steward_update { binding, guidance: "Approved, the spec is complete.", resolve } and got "ENG-12: spec approved", ready.approval set by its own thread id. Before this PR that path declined, so the change converts a safe refusal into self-approval of the steward's own spec. It also fires with mode me, where the approver is the user and approve: true requires their quoted words: the project steward's own words now approve a user-approved spec with no user words at all. Criterion 2 names the project steward. Suggest mirroring the approve: true authority: mode === "project" && isProjectSteward(...) (parent stewards only if you deliberately want them — approve: true refuses them today); never the binding's own steward; with mode me, keep requiring the user's quote.

  3. server.ts ~990, the user's own spec comment carries approval only when ready.approval === null — with a prior approval that has gone stale, the user's amendment does not carry its own approval. Verified in the harness (mode me): approval recorded via the user's LGTM, steward amends the spec, then the user amends from their own thread → the old approval stayed pinned to the old hash, and a fresh me-routed escalation was filed, asking the user to approve the spec they had just written themselves. Criterion 4 says the user's spec comment "changes the spec hash but carries its own approval when approval is me". Fire when the existing approval is stale as well (ready.approval === null || ready.approval.specHash !== currentSpec), not only when there never was one. The new test covers only the no-prior-approval case; please add the stale-approval sequence.

Suggestions

  • asksForOpenApproval flags reports that merely relay the request: a status of "Approval requested from the user; waiting." with next action "Wait for the user to approve the spec" is reported as a playbook violation (verified), though the steward is waiting, not asking. Since the flag is shown to the steward as a violation, consider anchoring it to an imperative in nextAction (e.g. it starts with ask/request/…) rather than any ask-word anywhere in the status.
  • The resolution message labels any non-project-steward approver "your parent steward" (by: isProjectSteward ? "the project steward" : "your parent steward"), which mislabels the own-steward case in blocker 2. Moot once that path is restricted, but worth a look.
  • wake.ts line 279 still tells the project steward to "Approve it with steward_update { binding, approve: true }"; with criterion 2, approving words in guidance + resolve now work too. One clause there would save a failed call.

Checked

  • Ran npm run typecheck and npm test in plugins/stewards myself: clean, 123/123 pass. The CI matrix omits stewards (.github/workflows/plugins.yaml lists 8 plugins, stewards not among them), so the green checks on this PR never tested it.
  • Verified against the ticket: criterion 1 met except for the false declines in blocker 1 (approve/decline/ambiguous paths and the one-transaction store.approve are otherwise right, tested); criterion 2 met for the project steward but over-broad per blocker 2; criterion 3 met (unsigned approving comment after the latest spec comment, quote matched, before-latest-spec rejected) except as weakened by blocker 1; criterion 4 met only when no prior approval exists (blocker 3), the approval: project wake naming the user as author is right; criterion 5 met (report reply, wake, and the bb stewards show violation flag, all tested), modulo the suggestion's false positive; criterion 6 met (the BB-11 sequence test covers page answer → amendment → page answer, no duplicate request).
  • Blockers 1–3 were each reproduced with a temporary test in the plugin's own harness, since the shipped tests don't cover them; the temp file was removed afterwards.

— from bb thread thr_u6n2ndxhd7

- classifyApproval: a clear refusal ("not approved", "don't ship it",
  reject, declined) declines first, then approval words win over a bare
  "no", so "LGTM, no concerns" and "ship it, no further changes needed"
  approve instead of declining.
- steward_update: approving words in the guidance only approve when the
  gate names the project steward and the caller is it, mirroring
  approve: true; a steward cannot approve its own spec, and mode me still
  needs the user's quote.
- reconcileOnce: the user's own spec comment carries its approval when the
  prior approval is stale, not only when there never was one.
- asksForOpenApproval: only an imperative next action ("Ask the user to
  approve") counts, so a status that waits on the request is not flagged.
- wake: the project steward is told approving words in guidance work too.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed in d6feadb:

  • Blocker 1 (classifier false-declines): classifyApproval now checks clear refusals first (not approved, don't ship it, reject, declined), then approval words, then a bare no/changes needed. "LGTM, no concerns from me" and "Ship it, no further changes needed" now approve; "not approved" and "don't ship it" decline. Tests cover all four cases.
  • Blocker 2 (over-broad auto-approval): approving words in steward_update guidance only approve when the gate names project and the caller is the project steward, exactly like approve: true. The binding's own steward no longer approves its own spec, and mode me still needs the user's quote. Two new tests.
  • Blocker 3 (stale approval): the user's own spec comment now carries its approval when the prior approval is stale (ready.approval.specHash !== currentSpec), not only when there is none. New test: LGTM approval → steward amendment → user amendment re-approves the new hash.
  • Suggestion (false violation): asksForOpenApproval now only flags an imperative nextAction starting with ask/request/remind/tell/prompt; "Wait for the user to approve the spec" is no longer a violation. Test added.
  • Suggestion (mislabelled approver): moot after blocker 2; the by field is gone and the message is "by the project steward" again.
  • Suggestion (project wake): the project steward's wake now says approving words in the guidance that resolves the request also work, not only approve: true.

npm test in plugins/stewards: 126 pass; npm run typecheck: clean.

— from bb thread thr_9tbgh7t7th

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM 5.3, at d6feadb)

Owner review required: no — none of the owner-reviewed triggers apply, unchanged from round 1.

Blockers

  1. reconcile.ts classifyApproval, negation prefixes — NEGATED_APPROVE only knows not | do not | don't, so every other negated refusal is now a false approval: verified by running the function — "won't approve until the migration is named", "can't approve without SSO", "cannot approve this spec yet", "shouldn't approve until naming is fixed", "never approve this as-is" all return "approve". That is the mirror of round 1's false decline, and worse: the user's refusal records an approval, resolves the request, and workers start — the opposite of what criterion 1's ambiguity fallback exists for. A generic prefix such as (?:not|never|cannot|do\s+not|[a-z]+n['’]?t)\s+ instead of enumerating don't would catch won't/can't/shouldn't/wouldn't and the curly-apostrophe form in one go. The three new approve-cases and all decline/ambiguous cases from rounds 1–2 otherwise behave correctly.

Suggestions

  • None this round.

Resolved since round 1

  • Blocker 1 (false declines): partly resolved by d6feadb — "LGTM, no concerns from me", "Ship it, no further changes needed" and the strong refusals all classify correctly now; the negated-refusal family above keeps it open.
  • Blocker 2 (unrestricted resolve auto-approval): resolved — now approval === "project" && isProjectSteward, mirroring approve: true; the own-steward and mode-me paths are both tested and stay unapproved, and the mislabeled approver text is gone.
  • Blocker 3 (stale approval vs the user's amendment): resolved — re-approves when ready.approval.specHash !== currentSpec, and the new test walks the exact sequence (approve → steward amendment → user amendment → approval re-pinned to the new hash).
  • Suggestions (waiting-relaying reports flagged; wake wording; approver label): all resolved — asksForOpenApproval now requires an imperative next action and the relaying status is tested as clean; the project wake names approving words in guidance, tested.

Checked

  • Ran npm run typecheck and npm test in plugins/stewards myself: clean, 126/126 pass. The CI matrix still omits stewards, so the green checks on this PR do not test it.
  • Verified against the ticket: criteria 1–6 as round 1, except criterion 1's approve/decline/ambiguous split for negated refusals (blocker above); criterion 2's restriction is exactly the approve: true authority; criterion 4's stale-approval sequence is now tested.
  • The classifier cases above were run directly against classifyApproval; no temp files were left in the tree.

— from bb thread thr_u6n2ndxhd7

Review round 2: "won't approve", "can't approve", "cannot approve",
"shouldn't approve" and "never approve" matched the approval word inside
them. The negation prefix now covers not, never, cannot, do not and any
n't contraction (with a straight or curly apostrophe), while a word merely
ending in "nt" ("want to approve") still approves.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 2 addressed in acdd3ba:

  • Blocker 1 (negated refusals): the negation prefix is now generic — not, never, cannot, do not, and any n't contraction (straight or curly apostrophe). "won't approve until the migration is named", "can't approve without SSO", "cannot approve this spec yet", "shouldn't approve until naming is fixed" and "never approve this as-is" all decline. Tests added. A word merely ending in "nt" is not a contraction, so "I want to approve" still approves (also tested).

npm test in plugins/stewards: 126 pass; npm run typecheck: clean.

— from bb thread thr_9tbgh7t7th

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 3 (GLM 5.3, at acdd3ba)

Owner review required: no — none of the owner-reviewed triggers apply, unchanged from rounds 1–2. Runtime code of a live plugin, no store migration, no cross-repo contract, no identity/access/infra change, no new dependency.

Suggestions

  • A mixed sentence where the negation and a standalone approval word both appear — "I don't just approve anything, but this one: LGTM" — declines (the lazy don't … approve wins over the trailing LGTM). Contrived enough that I would not hold the merge for it, but if you ever touch this again: a negated phrase and a separate standalone approval word could be treated as ambiguous for the project steward to interpret.

Resolved since round 2

  • Blocker 1 (negated refusals falsely approving): resolved by acdd3ba — won't/can't/cannot/shouldn't/never + approve all decline now, curly-apostrophe form included, and "I want to approve"/"want to go ahead" still approve (an "nt" word is not a contraction). All verified by running classifyApproval directly, alongside every case from rounds 1 and 2 — no regressions.

Checked

  • Ran npm run typecheck and npm test in plugins/stewards myself: clean, 126/126 pass (three new classifier assertions included). The CI matrix still omits stewards, so the green checks on this PR do not test it.
  • Verified against the ticket, final: criterion 1 — page answer approves (pinned to the current spec hash, escalation resolved in one transaction), clear refusals decline, ambiguous goes to the project steward, and the classifier handles all realistic approve/decline/negation families; criterion 2 — the project steward's approving words record the approval, restricted to approval: project and the project steward exactly as approve: true is, own-steward and mode-me bypasses tested and closed; criterion 3 — the user's unsigned approving comment on the entity after the latest spec comment counts, with the quote matched against it and before-latest-spec rejected; criterion 4 — the user's spec comment changes the hash and carries its own approval under approval: me whether or not a prior approval went stale (both tested), and under approval: project the wake names the user as the author; criterion 5 — the report reply and wake say "Do not ask the user again; it is listed on the Stewards page" while a request is open, and a report whose next action is an ask shows as a playbook violation in bb stewards show (relaying/waiting reports do not); criterion 6 — the BB-11 sequence (page answer, amendment, page answer again) is tested with no duplicate request, plus the pure-function tests.
  • No blockers remain. Approved: merge when checks are green.

— from bb thread thr_u6n2ndxhd7

…e-spec-approval-thr_9tbgh7t7th

# Conflicts:
#	plugins/stewards/reconcile.test.ts
#	plugins/stewards/reconcile.ts
#	plugins/stewards/server.ts
#	plugins/stewards/wake.ts
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged origin/main (BB-16 #32, BB-17 #35) into the branch at 0c108e8; main had moved and the PR was conflicting. Conflict resolutions:

  • reconcile.ts: kept BB-17's workerInFlight/anyWorkerInFlight, review-marker and compactDue additions alongside my byUser change and classifyApproval/asksForOpenApproval; DiffContext and diffObserved carry both workerInFlight and userThread.
  • server.ts: BB-17's workerInFlight computation plus my userThread predicate.
  • wake.ts: kept BB-17's OPEN_REQUESTS_NOTE in the approval-request lines and added the ticket's "Do not ask the user again; it is listed on the Stewards page" beside it, so both the standing note and the criterion-5 wording are present.
  • Tests: merged the import lists; all of BB-17's tests and mine pass.

npm test in plugins/stewards: 138 pass; npm run typecheck: clean.

— from bb thread thr_9tbgh7t7th

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 4 (GLM 5.3, at 0c108e8)

Owner review required: no — none of the owner-reviewed triggers apply. The merge brings in main's BB-16/BB-17 changes (already merged there after their own reviews); the PR diff against main is still only the BB-13 change.

Suggestions

  • Round 3's suggestion (a negated phrase and a separate standalone approval word, e.g. "I don't just approve anything, but this one: LGTM", could be ambiguous) remains open and non-blocking; fine to decline.

Resolved since round 3

  • The merge of origin/main (BB-16 stewards: default wake and playbook guidance for credentials and build-time blockers (BB-16) #32, BB-17 stewards: treat a worker as in flight between its turns (BB-17) #35): resolved — reviewed the conflict resolutions and the full acdd3ba..0c108e8 diff. All hunks outside the four conflicted files are main's own changes; in the conflicted files the resolution is mechanical: DiffContext/diffObserved/the reconcile call now carry both workerInFlight and userThread, the criterion-4 block, the approval === "project" && isProjectSteward resolve restriction, userApprovedOnEntity, the stewardsAnswerQuestion paths, asksForOpenApproval, the classifier (generic negation prefix intact), and store.ts are all unchanged from acdd3ba — verified positively on the merged head, and no removal in the diff touches any of them.
  • The one interplay worth checking: BB-17 makes a worker "in flight" while finished, but a finished worker is still store.worker(...), so isUserThread keeps excluding it — a worker's spec comments still do not count as the user's own words. Correct.

Checked

  • Ran npm run typecheck and npm test in plugins/stewards myself on 0c108e8: clean, 138/138 pass. The CI matrix still omits stewards, so the green checks on this PR do not test it.
  • Re-ran the classifier probes from rounds 1–3 against the merged head: won't/can't/never approve decline, "I want to approve" and "LGTM, no concerns" approve, "No, not yet" declines, questions stay ambiguous — all correct.
  • No blockers remain. Approved: merge when checks are green.

— from bb thread thr_u6n2ndxhd7

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

On the round-3/round-4 suggestion (a negated phrase plus a standalone approval word, "I don't just approve anything, but this one: LGTM"): declining. Treating a sentence that contains both a negated refusal and a separate approval as ambiguous would need a clause-level parse; the current order (clear refusal, then approval, then a bare no) keeps every realistic approval and refusal right, and the contrived mixed sentence falls to decline, the safe side for an approval gate. Not worth the extra heuristics.

— from bb thread thr_9tbgh7t7th

@trotterdylan
trotterdylan merged commit 2b30044 into main Oct 19, 2026
16 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-13-implement-one-spec-approval-thr_9tbgh7t7th branch October 19, 2026 22:00
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: no-review lane, reviewer approved 0c108e8, checks green. Merge commit 2b30044.

— from bb thread thr_9tbgh7t7th

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