Skip to content

stewards: fix escalation shape, resolution, and PR approval churn (BB-51) - #74

Merged
trotterdylan merged 3 commits into
mainfrom
bb/bb-51-stewards-escalation-fixes-thr_a95y4eitpa
Oct 24, 2026
Merged

trotterdylan merged 3 commits into
mainfrom
bb/bb-51-stewards-escalation-fixes-thr_a95y4eitpa

Conversation

@trotterdylan

@trotterdylan trotterdylan commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Implements BB-51. Stewards are told to raise a credential, a step outside the repos or a decision with steward_report { escalate }, and the project steward's wake names the five resolution kinds and how a credential is forwarded as a secret. Closing a forwarded question or need on the page now resolves the escalation it came from in the same write and tells the origin. A declined PR approval is not asked again on the same head, checks going pending never resolves a request as "Approved", and the approve-pr item keeps its identity across a push. prGate now makes a decide: project entry the project steward's whole gate and everything else the owner's.

Merging to bb-plugins main moves the pin, builds a new bb-server image and stages a restart on every developer's server (AGENTS.md, "Shipping a plugin change"). Do not press Restart now from a thread that is still needed.

Classification

owner-reviewed: it changes prGate and the owner-reviewed-lane rule, a big decision the owner decides. The owner approves on GitHub.

What changes

  • wake.ts: STANDING_RULES say a credential, a step outside the repos or a decision is raised with steward_report { escalate }, naming the escalated kinds from one exported list; the project steward's wake names the five resolution kinds and the resolution: "secret" shape (variable, purpose, writeEnv/worker or setting). The Sentry no-token wake now escalates instead of filing a refused provide-secret need, and the skill and default playbooks were aligned with it.
  • store.ts: ESCALATED_NEED_KINDS/STEWARD_NEED_KINDS (one list feeds the rules and the refusal); resolve follows a question's forwarded_from so a page close resolves the escalation it came from; additive, defaulted declined_pr_head_sha/declined_pr_marker columns.
  • server.ts: syncNeeds files the approve-pr item directly for the user lane (no project-steward turn), remembers a declined head and reviewer marker, leaves a request open on pending checks instead of resolving it "Approved.", and keeps the item across a push; the Done, requester-finished, secret-import and CLI close paths wake the project steward; the failed-files refusal gets its own text.
  • decisions.ts: decideForPull (path match, fail closed) and decideForRefusal (null/empty file list separate from self-widening).
  • reconcile.ts: prGate gains needsProjectApproval; a project-steward approval is the gate only for a project entry.
  • .bb AGENTS.md: the owner-reviewed-lane paragraph tightened to the same rule, on the guidance-thr_a95y4eitpa branch in the project's .bb checkout (b3174d5), to merge after this PR.

Testing

  • npm test in plugins/stewards: pass (440 tests; stewards is in the CI matrix, and I ran the suite locally too).
  • npm run typecheck: pass.
  • Not tested: the live Stewards page and GitHub API calls; the suite drives them through the plugin's fake host.

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_tsi9xdqugh.

— from bb thread thr_a95y4eitpa

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at 184a23f)

Owner review required: yes — it changes the prGate code and the code that records a project-steward approval (reconcile.ts, server.ts, store.ts, decisions.ts are all self-widening paths), and the store migration is a bigDecisions-listed kind. @trotterdylan, this one needs your approval.

Blockers

  1. plugins/stewards/wake.ts:738 — formatSentryWake's no-token wake still tells the Sentry ops steward: "File one provide-secret need for it with steward_report" — exactly the call steward_report { needs } refuses (provide-secret is in ESCALATED_NEED_KINDS, refused since BB-30 and by this PR's own one-list refusal). Every wake of a Sentry project without a token now instructs an impossible action — the same wrong-shape churn BB-51 exists to stop, in the very file this ticket names. The same leftover instruction is in skills/stewards/SKILL.md:142 ("file it (configure, provide-secret, decide) instead of only saying it"), skills/stewards/SKILL.md:213 ("file the one provide-secret need it describes"), and the default playbooks templates.ts:12 (SECRET_REQUEST) and templates.ts:265. wake.ts's own STANDING_RULES comment says the rules "mirror the stewards skill and the default playbooks, so a change here belongs there too" — this PR changed the rules and left the mirrors contradicting them. Fix: point all of these at steward_report { escalate } (the project steward forwards it with resolution: "secret", setting sentryToken), or have the plugin file the token need itself, and add a test that the no-token wake text does not instruct a refused needs filing (e.g. assert it does not match /File .* provide-secret need .* steward_report/).

Suggestions

  • PR body, Testing section: "the plugin is not in the CI matrix" — stewards is in the matrix (.github/workflows/plugins.yaml line 20). Correct the body so the merge comment does not carry a wrong claim.
  • The .bb guidance branch (ba2573e, "one rule for the owner-reviewed lane") says the lane "is decided by decideFor" — the new auto-placement is decideForPull; decideFor is the entry-named check the approve path uses. Since that .bb PR merges after this one, consider aligning the wording there (not this PR's diff).
  • steward_update's decline recording (server.ts, the approve-decline resolve branch) treats any non-approving resolve as a decline — ambiguous words included — and suppresses re-asking until the head or reviewer marker changes. That is deliberate per criterion 3 (no churn), but the project steward should know a "wait" answer also silences the request; a line in the tool's response text naming what was recorded would help. Optional.

Checked

  • Ran: npm run typecheck (pass) and npm test in plugins/stewards — 440/440 pass (37.9s). The plugin is in the CI matrix; ran it locally anyway, and the two in-progress CI checks at review time are the same suite.
  • Verified against ticket:
    • Criterion 1 met: STANDING_RULES raise a credential, a step outside the repos and a decision with steward_report { escalate }, kinds named from the one exported list; the project steward's wake names the five RESOLUTION_KINDS and the resolution: "secret" shape (variable, purpose, writeEnv/worker or setting); wake.test.ts checks both.
    • Criterion 2 met: store.resolve follows forwarded_from up inside the same transaction, so a page close resolves the pair in one write; the Done, requester-finished, choice, secret-import and question-answer paths all wake the project steward and deliver the answer to the origin; tests cover the Done and requester-finished paths as required.
    • Criterion 3 met: decline records declinedPrHeadSha/declinedPrMarker, only a new head or new marker re-asks; pending checks leave the request open with a note and the bare "Approved." resolution is gone; fileApprovePrNeed dedupes by (binding, kind, url) so the item keeps its id across a push; tests for all three.
    • Criterion 4 met: prGate routes the gate by the decide mark, fail closed (null/empty/unreadable files, unknown or missing marks, self-widening → user, and a project approval never satisfies the user lane); the page item is filed directly in the user lane with no project-steward turn; decideForRefusal gives the failed files fetch its own text; tests cover the failed fetch and the lane split.
    • Criterion 5 met: ESCALATED_NEED_KINDS + STEWARD_NEED_KINDS must equal NEEDS_KINDS (tested), and the refusal is derived from the same list the rules name.
  • Hard limits respected: no stewards/project.json or config.ts change, no entry moved to project, nothing loosened about when a project-steward approval counts — I traced every prGate call site (syncNeeds, the needs holdable path, the page actions) and each fails closed. DECLINED_PR_MIGRATIONS is appended to MIGRATIONS (existing entries untouched), additive, nullable columns an old build ignores.
  • The .bb AGENTS.md edit is where the limits put it: its own branch guidance-thr_a95y4eitpa (commit ba2573e), not in this PR, to merge after.

— from bb thread thr_tsi9xdqugh

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed, pushed 6dc7830.

Blocker 1 (Sentry no-token wake and its mirrors): fixed. The no-token wake now raises one steward_report { escalate: { kind: "decision", … } } naming the variable, setting, page and scopes; skills/stewards/SKILL.md (the blockedOn line and the no-token bullet) and templates.ts (SECRET_REQUEST and the Sentry paragraph) point at escalate too, and sentry.ts's comments are aligned. Added an assertion in the Sentry no-token test that the wake does not instruct a needs filing.

Suggestion (PR body CI claim): fixed — the body now says stewards is in the CI matrix and that I ran the suite locally as well.

Suggestion (.bb wording): fixed on the guidance branch (b3174d5); it now names decideForPull for the auto-placement and decideFor is left to the entry-named approve check.

Suggestion (decline response): taken — the steward_update response now says the decline of the head was remembered, so the same head and reviewer marker are not asked again.

npm run typecheck and npm test (440/440) pass.

— from bb thread thr_a95y4eitpa

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM 5.3, at 6dc7830)

Owner review required: yes — it changes the prGate code and the code that records a project-steward approval (self-widening paths), plus a store migration. @trotterdylan, this one needs your approval.

Blockers

None.

Suggestions

  • server.ts:4424 — the choices-on-a-non-decision-escalation error still says "escalate a decision, or file a decide need"; filing a decide need is refused since BB-30. A refused call's own error points back at escalate, so it self-corrects in one step — not worth holding the merge, but worth a one-line reword whenever this file is next touched.

Resolved since round 1

  • Blocker 1 (Sentry no-token wake and the skill/playbooks instructing a refused provide-secret filing): resolved by 6dc7830 — formatSentryWake now raises it as steward_report { escalate: { kind: "decision", … } } with the variable, setting, url and scopes in the question; skills/stewards/SKILL.md (both spots) and templates.ts (SECRET_REQUEST, the ops playbook) teach the same; config.test.ts pins the new playbook shape and server.test.ts asserts the wake no longer instructs a needs filing. I grepped the plugin for any remaining "file a … need" instruction with a refused kind: only the one error string above is left.
  • CI-matrix claim in the PR body: resolved — the Testing section now says stewards is in the matrix.
  • .bb guidance wording: resolved — branch guidance-thr_a95y4eitpa (now b3174d5) says decideForPull; I diffed ba2573e..b3174d5, wording only, nothing loosened.
  • Naming the remembered decline: resolved — the steward_update response now says the head and reviewer marker were remembered.

Checked

  • Ran at 6dc7830: npm run typecheck (pass) and npm test in plugins/stewards — 440/440 pass.
  • The new changes are guidance text, tests, comments and one done.push line; no behaviour beyond the blocker fix, and the suggested escalation question fits the tool's 1500-char limit comfortably.
  • Verdict from round 1 stands on everything else: all five acceptance criteria met, the store migration stays additive and append-only, and every prGate path still fails closed (no self-widening, no loosened project-approval counting).

— from bb thread thr_tsi9xdqugh

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Non-blocking note taken: the choices error no longer says "file a decide need" (pushed 9f09417). The round-2 approval at 6dc7830 covers this small follow-up; checks are re-running.

— from bb thread thr_a95y4eitpa

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 3 (GLM 5.3, at 9f09417)

Owner review required: yes — unchanged lane (see round 1). @trotterdylan, this one needs your approval.

Blockers

None.

Resolved since round 2

  • The round-2 suggestion (stale "file a decide need" in the choices error, server.ts:4424): resolved by 9f09417 — one-line wording change, nothing else in the diff; typecheck passes. No scope or behaviour change, so the round-2 approval stands; this marker repeats it on the current head so the gate does not have to read past it.

Checked

  • Diff 6dc7830..9f09417 is that single line; npm run typecheck pass. The 440-test suite result from round 2 is unaffected by an error-string reword.

— from bb thread thr_tsi9xdqugh

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

LGTM

@trotterdylan
trotterdylan merged commit aaba2ec into main Oct 24, 2026
20 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-51-stewards-escalation-fixes-thr_a95y4eitpa branch October 24, 2026 21:23
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed, approved by trotterdylan on 9f09417 (unsigned "LGTM" comment, 2026-10-24T21:22:49Z), reviewer approved 9f09417, checks green.

Merging to bb-plugins main moves the pin, builds a new bb-server image and stages a restart on every developer's server; do not press Restart now.

— from bb thread thr_a95y4eitpa

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