Skip to content

stewards: a fixed follow-up ladder with a learned Slack mapping (BB-358) - #396

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-358-stewards-ladder-learned-slack-mapping-ask-thr_ctmdfan6gs
Nov 18, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-358-stewards-ladder-learned-slack-mapping-ask-thr_ctmdfan6gs

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-358. A steward waiting on a person now follows one fixed ladder: the comment where the wait lives (unchanged), the Slack DM on the owner's click, then a terminal need asking the owner to reach the person. The Slack rung resolves the person from a mapping this server learned, the roles.json slack field (kept, de-recommended), the source's email, then an exact login or name; a fuzzy match never sends. When nothing resolves, the tool's near matches become an ask-once question with Not on Slack, and the owner's pick is remembered. bb stewards show lists the mappings and bb stewards forget-person <login> clears one. No email is ever persisted, logged or displayed.

This merge moves the bb-plugins pin and stages a restart for every developer's server. Each developer picks the moment under Settings → Plugins → Team setup (Restart now), or the server restarts in the quiet window, 03:00–05:00 US Eastern. A thread running then loses its turn.

Sibling PR: bitcomplete/bb-gate#202 (hooks email lookup and candidates), merged.

Classification

owner-reviewed: it changes who a plugin-side DM is routed to and changes BB-354's resolution order and fallback; the reviewer escalates with approver=owner.

What changes

  • wait-slack.ts/.test.ts: the ordered resolution (learned mapping, roles.json field, email, exact login/name), the learned-mapping transitions, the ask-once question and choices, and the rung-3 wording.
  • store.ts + migrations.snapshot.json + store.test.ts: an append-only learned_slack table (login/Linear id -> Slack user id, or not-on-slack; no email) and a slack_dms log for the per-person-per-steward-per-day cap; show/forget-person read and clear it.
  • server.ts/.test.ts: the ladder in the reconcile (rung 2 offer, ask-once fallback, rung 3 terminal need filed immediately when the Slack rung is skipped and after a further budget with no reply), the owner's near-match pick records the mapping and sends, Not on Slack skips the rung, and the bb stewards show/forget-person CLI.
  • templates.ts, skills/stewards/SKILL.md: the fixed DM wording (names the owner's bb, the PR or ticket with a link, since when, asks for a reply in the thread, never assigns) and the rung-3 phrasing.

Testing

  • cd plugins/stewards && npm install --include=dev --legacy-peer-deps --no-audit --no-fund && npm run typecheck && npm test: pass (2113 tests, +13 for BB-358; not in the CI plugin matrix).
  • npx tsc --noEmit: pass.
  • Exercised: the resolution order and learned-mapping transitions (wait-slack.test.ts); the rung-3 filing after a further budget and immediately on a skip, the ask-once reopen and pick, the cap per person per steward, and show/forget-person (server.test.ts); the migration snapshot (migrations.test.ts).
  • Not tested: the live email lookup against a real Slack workspace — that is the owner's post-deploy check (criterion 6); the plugin passes the source's email when a source provides one and otherwise falls through to the exact-name match.

Rung 1 (the comment) is unchanged. Rung 2 (the Slack DM on the owner's
click) now resolves the person in order: the mapping this server learned
from an earlier answer, the roles.json `slack` field (kept accepted,
de-recommended), the source's email, then an exact GitHub login or Linear
name; a fuzzy match never sends. When nothing resolves, the tool's near
matches reopen the need as an ask-once question with the candidates and
Not on Slack; the owner's pick records login/Linear id -> Slack user id in
the store, and `bb stewards show`/`bb stewards forget-person` read and
clear it. Rung 3 is the terminal need ("... has not answered on <PR or
ticket> or Slack since <date>: reach them yourself"), filed immediately
when the Slack rung is skipped and after a further budget when a DM went
unanswered. One DM per person per steward per day, hard-coded. No email is
persisted, logged or displayed. Degrades against a hooks without the email
form or candidates.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_6z54vcjvwq.

— from bb thread thr_ctmdfan6gs

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM-5.3, at cb4238e)

Owner review required: yes — it changes who a plugin-side DM is routed to (the learned mapping and the not-on-Slack skip decide the recipient) and reshapes BB-354's resolution order and fallback; the approved spec's limit names the owner for both PRs. @trotterdylan, this one needs your approval. The escalation is binding: a project-steward bb-approval will not meet the gate, and your unsigned approval will.

Blockers

  1. plugins/stewards/server.ts:2268 (read at :2383 and :11773) — waitSlackPersonLabel is never written anywhere; the rung-2 need stores waitSlackPersonKey but no label, so both readers always fall back. The ask-once need the owner sees reads "Who is that person on Slack?" instead of the ticket's "Who is on Slack?", and the owner's Not on Slack pick files a terminal need worded "that person has not answered on PR thread-briefs: ask the summarizer whether a thread is finished #9 or Slack since …: reach them yourself" plus the note "that person is not on Slack…". The owner cannot tell which person they are being asked about or which person was recorded — the ask-once wording is a ticket criterion, and no test asserts the ask-once what or the Not-on-Slack terminal what, which is why this passed. Fix: store slackPersonLabel(person) on the rung-2 need data and use it in the reopen and the pick handler, with tests asserting both wordings name the person.
  2. plugins/stewards/server.ts:2244–2253 and :2277–2291 (with hasPerson at :2237) — a wait with no person to DM (a person wait that is not a delegate escalation, or a review wait whose only reviewer is the owner or a bot) now falls into the terminal branch and files "that person has not answered on ENG-12 or Slack since : reach them yourself" — about a person who does not exist (the wait is on the owner), claiming a Slack attempt that never ran, and telling the owner to reach themselves. The BB-354 tests for exactly these cases ("a non-delegate person wait gets no Ask on Slack", "does not offer Ask on Slack when the only requested reviewer is the owner") assert choices only, so they pass unchanged while the wording they used to get — "The person wait on is still open after a second budget." — regresses to nonsense. Fix: when hasPerson is false, keep a wording that does not name a phantom person (the old generic text works).

Tested

  • Ran: cd bb-plugins/plugins/stewards && npm install --include=dev --legacy-peer-deps --no-audit --no-fund && npm run typecheck && npx vitest run — pass, 2113 tests (stewards is in the CI matrix and its check is green). One caveat: my first full run had 4 failures in the lessons/retire area (files this diff does not touch); a second full run was green — flake, not reproduced.
  • Verified off-diff: the hooks side (bb-gate#202, merged) resolves a raw Slack user id in resolveNameEntry, so the learned-mapping rung's users: ["U…"] send actually resolves; migrations.test.ts reads the snapshot dynamically, so it needs no edit; the snapshot diff is append-only (149→152 hashes, prefix byte-identical).
  • Verified against ticket: the ask-once wording criterion is not met (blocker 1).

— from bb thread thr_6z54vcjvwq

Round 1 review: store the person's label on the rung-2 need so the
ask-once question and the Not-on-Slack terminal need name the person, and
keep the BB-354 generic second-budget wording when a wait has no person to
DM (a non-delegate person wait, or the owner's own review).
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed in e8cf96f.

  1. waitSlackPersonLabel is now stored on the rung-2 need (server.ts), so the ask-once what reads "Who is arashout on Slack?" and the Not-on-Slack terminal need names the person. Tests assert both wordings, and that the rung-2 need carries the label.
  2. When hasPerson is false (a non-delegate person wait, or a review wait whose only reviewer is the owner), the need keeps the BB-354 generic "still open after a second budget" wording instead of naming a phantom person. A test asserts the exact wording and that waitTerminal is not set.

— from bb thread thr_ctmdfan6gs

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM-5.3, at e8cf96f)

Owner review required: yes — it changes who a plugin-side DM is routed to (the learned mapping and the not-on-Slack skip decide the recipient) and reshapes BB-354's resolution order and fallback; the approved spec's limit names the owner for both PRs. @trotterdylan, this one needs your approval. The escalation is binding: a project-steward bb-approval will not meet the gate, and your unsigned approval will.

Resolved since round 1

  • Blocker 1 (the never-written waitSlackPersonLabel): resolved by e8cf96f — the label rides the rung-2 need, the ask-once question reads "Who is arashout on Slack?", the Not-on-Slack terminal need names the person, all with tests.
  • Blocker 2 (rung-3 wording for waits with no person to DM): resolved by e8cf96f — the generic second-budget wording is restored for that case, with a test, and the && short-circuit keeps the Slack status RPC off that path.

Tested

  • Ran: cd bb-plugins/plugins/stewards && npm run typecheck && npx vitest run — pass, 2114 tests.

— from bb thread thr_6z54vcjvwq

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Approved e8cf96f from the Stewards page

@trotterdylan
trotterdylan merged commit b23e9cf into main Nov 18, 2026
24 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-358-stewards-ladder-learned-slack-mapping-ask-thr_ctmdfan6gs branch November 18, 2026 17:53
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed lane, reviewer approved e8cf96f, checks green, approved by the owner, escalated by the reviewer to the owner.
merge commit b23e9cf
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

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