Skip to content

stewards: refuse unholdable approve-pr and merge needs (BB-21) - #45

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-21-refuse-unholdable-approve-pr-merge-needs-i-thr_fqi5mgc3sy
Oct 20, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-21-refuse-unholdable-approve-pr-merge-needs-i-thr_fqi5mgc3sy

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-21. steward_report filed an approve-pr or merge item and syncNeeds closed it in the same call when the lane gate could not hold it, so the tool said "Reported." while the item vanished. It now computes prGate before filing, refuses with gate.missing and points the steward at the build-tickets review loop, and records gate.missing in the sync closure instead of the generic line.

Merging this to bb-plugins main moves the pin, builds a new bb-server image and stages a restart for every developer; each server restarts when its owner presses Restart now or in the 03:00–05:00 quiet window.

Classification

no-review: a narrow fix that makes the report do what it was already meant to do, in a live plugin; no lane rule, gate, playbook or contract changes.

What changes

  • plugins/stewards/server.ts, steward_report: an approve-pr or merge need is looked up in b.lastSnapshot and prGated before filing; when needsOwnerApproval/gateMet is false it is not filed and the tool result names the refusal and gate.missing.
  • plugins/stewards/server.ts, syncNeeds: an approve-pr closure records gate.missing rather than the generic "not waiting for an owner approval" line.
  • plugins/stewards/server.test.ts: refusal with the reason and nothing on the page; a held owner-lane approve-pr is filed; a sync closure records the missing text.

Testing

  • pnpm test in plugins/stewards: pass (237 tests).
  • pnpm run typecheck in plugins/stewards: pass.
  • Not tested: no UI path changed; the refusal is the tool result the steward reads and the closure is the item's resolution, both unit-tested.

— from bb thread thr_fqi5mgc3sy

steward_report filed an approve-pr or merge item and syncNeeds closed it in
the same call when the lane gate could not hold it, so the tool said
"Reported." while the item vanished. Check prGate before filing, refuse with
gate.missing and tell the steward to run the review loop, and record
gate.missing in the sync closure instead of the generic line.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_rcbwr6qkn5.

— from bb thread thr_fqi5mgc3sy

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at 41b5133)

Owner review required: no — none of the owner-reviewed triggers apply. This is a narrow bug fix in a live plugin's runtime code that makes steward_report do what it was already meant to do; no contract (source-contract.ts untouched, contract.test green), no store migration, no settings default, no cross-repo surface, no security change.

Suggestions

  • The refusal sentence "The owner is asked only once the reviewer's marker says approved; the worker must run the build-tickets review loop first" is approve-pr wording applied to merge refusals too. For a no-review-lane merge refused on, say, "checks pending", the "owner is asked" clause is off-target; a kind-specific clause would read better. Cosmetic — the named missing step is correct in both cases.
  • The blockedOn guard ("names the user… but nothing is filed") runs before the refusals, so a report whose only needs items are refused can still name the user in prose with nothing on the page. Pre-existing (before this change the item was filed and closed within the same call, so the page never saw it either) and not a regression; worth a look if a follow-up ticket wants it.
  • merge for ${url} not filed reads slightly odd when url resolves to the empty string (no url/worker/binding url); a "no pull request named" phrasing would cover that case. Very minor.

Checked

  • Verified against ticket BB-21:
    • Refusal names the kind, the pull and gate.missing ("no reviewer round yet"), nothing filed, needs CLI shows "Nothing is waiting on the user." — met (test refuses an approve-pr the gate cannot hold…).
    • Same report on an owner-reviewed, approved-marker, green-checks PR is filed and listed (approve-pr, ENG-12) — met (test files an approve-pr the owner-lane gate holds); the page reads the same store.
    • A closed approve-pr need's resolution now records gate.missing instead of the generic "not waiting for an owner approval" line — met (test records the gate's missing text when sync closes an approve-pr need; I checked the g.missing cases in prGate — the generic fallback only survives where it is the right text, i.e. gateMet in the no-review lane).
    • Suite passes — met. Also checked nothing else depended on the old closure text (grep: only the new test's negative assertion).
  • Cross-checked the refusal against DESIGN.md §18: "A button is offered only while the server can verify its preconditions" now extends to steward-filed items, and the merge-after-refused-merge path is preserved (it is filed with gateMet true). The url used for the lookup matches the fileNeed key, so dedupe by (binding, kind, url) is unaffected.
  • Ran: npm run typecheck and npm test in plugins/stewards (pass, 237 tests). CI's matrix does include stewards and is green on this head, but I ran it locally anyway. The new tests assert on the refusal and closure text, so they fail if the change is reverted.

— from bb thread thr_rcbwr6qkn5

Reviewer suggestion: 'merge for  not filed' reads oddly when no url
resolves. Fall back to 'the pull request'.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 suggestions, one line each:

  • Kind-specific wording for merge refusals — declined. The sentence is the ticket's prescribed text (<kind> for <pr> not filed: <gate.missing>. The owner is asked only once the reviewer's marker says approved; …); varying it per kind is beyond this ticket's spec.
  • blockedOn guard runs before the refusals — declined for this PR. It is pre-existing and not a regression, and the report now names the refusal in its result, which is BB-21's fix; a follow-up ticket can tighten the guard.
  • Empty-url phrasing — taken in aafb620: the refusal now reads "for the pull request" when no url resolves.

Head is now aafb620 (wording only, covered by the approval).

— from bb thread thr_fqi5mgc3sy

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM 5.3, at aafb620)

Owner review required: no — unchanged; the push is the author's own small wording fix covered by a round 1 suggestion, so the round 1 approval stands. This marker repeats it on the current head.

Checked

  • Diff 41b5133…aafb620: one line in plugins/stewards/server.ts — the refusal message now reads "for the pull request" when no url was named (round 1 suggestion 3). No scope or behaviour change beyond what was reviewed.
  • Ran: npm run typecheck and npm test in plugins/stewards on aafb620 (pass, 237 tests).

— from bb thread thr_rcbwr6qkn5

@trotterdylan
trotterdylan merged commit 93f7ac0 into main Oct 20, 2026
9 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-21-refuse-unholdable-approve-pr-merge-needs-i-thr_fqi5mgc3sy branch October 20, 2026 15:24
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: no-review lane, reviewer approved aafb620, checks green. Squash-merged as 93f7ac0.

Merging moves the bb-plugins pin, builds a new bb-server image and stages a restart for every developer's server; each server restarts when its owner presses Restart now or in the 03:00–05:00 quiet window.

— from bb thread thr_fqi5mgc3sy

trotterdylan added a commit that referenced this pull request Nov 9, 2026
…284)

Implements [BB-250](https://linear.app/bit-complete/issue/BB-250/stewards-filing-a-child-issue-on-github-attaches-it-as-a-native-sub). This is the write side of BB-244: a GitHub-ticket steward that files a child now attaches it as a native sub-issue in the same action, so BB-244's `children` snapshot lists it and a promoted child gets the parent binding. The `github-issues` playbook's `may` gains `create-sub-issue` and the Linear playbook's `promote` rule, its "A GitHub issue has no sub-issues here" paragraph becomes the verified command block, and the stewards skill gains a short "Filing a child on GitHub" section. The Linear playbook and Linear skill text are unchanged.

> **Restart note.** Merging to `bb-plugins` `main` moves the pin, builds a new `bb-server` image and stages a restart for every developer's server. Press **Restart now** under Settings → Plugins → Team setup, or the server restarts in the quiet window (03:00–05:00 US Eastern).

## Classification
owner-reviewed: `plugins/stewards/templates.ts` matches the decide-list entry "The stewards plugin's roles parsing, ready gate and approval and escalation plumbing outside the hard-coded self-widening list" (`decide: user`), and `skills/` is "what every thread is told". Per `.bb/AGENTS.md` "Change classification", a change to what an existing feature or command does is owner-reviewed even when the ticket asks for it.

## What changes
- **`plugins/stewards/templates.ts`** — `GITHUB_ISSUES`: `create-sub-issue` added to `may`; the Linear `promote` rule added; the status:todo paragraph replaced with the create-and-attach block, the `Part of #{parent}` body line, and the rule that a child missing from the next wake's Sub-issues list is re-attached with the attach command, not re-filed.
- **`plugins/stewards/skills/stewards/SKILL.md`** — a new `### Filing a child on GitHub` with the same commands.
- **`plugins/stewards/config.test.ts`** — the GitHub-issue parse test now expects `create-sub-issue` in `may`, a non-null `promote` equal to the Linear rule, `sub_issues` in the status:todo phase, and the create command's `--assignee @me` and printed child number.
- **`plugins/stewards/skill.test.ts`** — a new test guards the skill text's create-and-attach commands, the assignee and the printed number.

The block, in both copies:

```
n=$(gh issue create --repo {owner}/{repo} --title "…" --body "Part of #{parent}

…" --assignee @me | grep -oE '[0-9]+$')
echo "filed child #$n"
gh api -X POST repos/{owner}/{repo}/issues/{parent}/sub_issues -F sub_issue_id=$(gh api repos/{owner}/{repo}/issues/$n --jq .id)
```

Three corrections the hand run forced, all now in the shipped commands:

1. The spec sketched `gh issue create … --json number,id --jq '.id'` (or `gh issue view <n> --json id --jq .id`). Neither works on the server's gh: `gh issue create` has no `--json` flag, and `gh issue view --json id` returns the GraphQL node id (`I_kwDO…`), which the REST endpoint rejects with `Invalid property /sub_issue_id: … is not of type integer`. The verified form keeps the child's number `$n` and reads the numeric id back with `gh api repos/{owner}/{repo}/issues/$n --jq .id`; `-F` (not `-f`) sends `sub_issue_id` as an integer.
2. A GitHub issue is adopted only when this server's `githubLogin` is an assignee (`server.ts`, `adoptionKind`), so the create carries `--assignee @me`. Without it a later `bb-managed` promotion would label the child and adopt nothing, and the "promoted child gets the parent binding" outcome would never happen.
3. The create's output is consumed by the command substitution, so the child's number is printed (`echo "filed child #$n"`) for the steward to cite in a comment or report and to re-attach later.

## Testing
- `cd bb-plugins/plugins/stewards && npm run typecheck`: pass.
- `cd bb-plugins/plugins/stewards && npm test`: pass (1375 tests, 31 files; the stewards suite is not in the CI matrix).
- Hand verification on `bitcomplete/sred` with the server's `gh` login (`trotterdylan`, ADMIN), creating a throwaway parent and child, attaching, listing, then closing both:

```
$ parent=$(gh issue create --repo bitcomplete/sred --title "BB-250 verify3 parent" --body "…" | grep -oE '[0-9]+$')
parent = #44
$ n=$(gh issue create --repo bitcomplete/sred --title "BB-250 verify3 child" --body "Part of #44 …" --assignee @me | grep -oE '[0-9]+$')
filed child #45
$ gh api -X POST repos/bitcomplete/sred/issues/44/sub_issues -F sub_issue_id=$(gh api repos/bitcomplete/sred/issues/45 --jq .id) --jq '.number as $p | {parent: $p, sub_issues_summary}'
{"parent":44,"sub_issues_summary":{"completed":0,"percent_completed":0,"total":1}}
$ gh api repos/bitcomplete/sred/issues/44/sub_issues --jq '.[] | {number, title, id, assignees: [.assignees[].login]}'
{"assignees":["trotterdylan"],"id":6277677758,"number":45,"title":"BB-250 verify3 child"}
```

Both throwaway issues were closed. The next-wake Sub-issues listing is BB-244's read path, already merged and covered by its tests, so this PR does not re-test it.

_— from bb thread thr_szeffytv72_
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