Skip to content

stewards: a page per project, and a record of questions put to the user (BB-1) - #22

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-1-stewards-page-and-question-record-thr_j5itnpekkx
Oct 19, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-1-stewards-page-and-question-record-thr_j5itnpekkx

Conversation

@trotterdylan

@trotterdylan trotterdylan commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Implements BB-1. Only plugins/stewards changes; no source-contract.ts copy and no other plugin is touched.

Merging this restarts every developer's server. Once it lands on main, bb-gate re-pins bb-plugins, builds a new bb-server image, and stages it on every developer's Deployment. Each server restarts when its owner presses Restart now (Settings → Plugins → Team setup), or in the 03:00–05:00 US Eastern quiet window otherwise. A thread running at that moment loses its turn. (AGENTS.md, "Shipping a plugin change".)

What changes

A question record (store.ts)

  • New questions table, added as one new statement at the end of MIGRATIONS. No existing statement is edited.
  • A row is made when the project steward forwards an escalation to the user (steward_update { forward } where the route reaches me), bound to that escalation and its binding. A row is also made by the new steward_update { ask: { question, context } }, bound to a binding when binding is given.
  • A question made by forwarding and its escalation close together, in one transaction, from either side. store.resolve (an escalation resolved by any path: a decision, the binding ending, the steward deleted) also closes its question. store.answer (a question closed) also resolves its escalation. The two records cannot disagree.

steward_update (server.ts)

  • ask is for the project steward only. With no binding, the question is about the project as a whole.
  • resolve: "qst_…" with answer closes a question. For a forwarded question this decides the escalation the usual way: the answer is saved as guidance and the steward is told.
  • Without a binding, the project steward may still ask or close a question. Any binding field without a binding gets "Name the binding…".

The nightly prompt (wake.ts, wakeProject)

  • Every project-steward wake lists the open questions from the table, and says not to ask one again.
  • The nightly wake adds "The record since …", built from the tables:
    • the previous digest, with its date
    • what moved: open bindings whose advancedAt falls in the window, bindings that ended, questions answered
    • what is waiting on the user: open questions, then open escalations with the user that no question covers, such as approval requests
    • what is stuck or held: open stuck escalations and bindings on hold
  • The digest instruction now says to write from the record, not from memory.

The Stewards page (app.tsx)

  • A navPanel at /plugins/stewards/board/<projectId>, with one tab per stewarded project. Its sections:
    • waiting on you: questions (answer and close them there), forwarded escalations, approval requests
    • in flight, grouped by stage: summary, next action, actor, running workers
    • stuck or held
    • ended in the last 14 days
    • the latest digest, with its date
  • The page uses the settings sections' polling hook, generalized to usePolled. The Status section links to the page.
  • New RPCs: stewardsBoard, and stewardsAnswerQuestion, which accepts only client callers. Closing a forwarded question from the page resolves its escalation and wakes the binding's steward.

Docs: DESIGN.md marks the Board phase (§17 step 5) as built, describes the question record and the record-built digest in §12, and replaces "a board, later" in §16. The stewards skill and the README are updated to match.

Tests

npm run typecheck passes. npm test: 92 passed in 7 files (after the round-1 fixes in b741a51).

  • store.test.ts (new): ask, then answer, round-trip; an answered question never shows as open; a forwarded question closes when its escalation is resolved, and closing the question resolves the escalation.
  • wake.test.ts (new): nightly prompt assembly, checking every section line by line; empty cases; the record is left out of wakes that do not ask for a digest.
  • server.test.ts: steward_update ask (bound and unbound) and resolve with answer; forwarding makes a question; closing a forwarded question decides its escalation and tells the steward; closing from the page (callers that are not client are refused); the board RPC; the nightly wake carries the previous digest and what moved since it.

Coordination with BB-2

BB-2 also changes steward_update, store.resolve and MIGRATIONS. When this PR was opened, BB-2 had not merged. Whichever PR merges second rebases onto main, keeps its migration after the other's, and checks that closing a question through resolve still works under BB-2's semantics (re-resolving appends; every target is validated before any write).

— from bb thread thr_j5itnpekkx

🤖 Generated with Claude Code

BB-1. The project steward's questions to the user are now rows in a new
questions table (appended to MIGRATIONS), made by forwarding an escalation
to the user and by steward_update { ask }, closed by steward_update
{ resolve: "<question id>", answer } or by the user on the page. A
forwarded question and its escalation close together in one transaction.

The nightly wake carries a record assembled from the tables: the previous
digest with its date, what moved, what waits on the user, what is stuck or
held. Every project steward wake lists the open questions.

The Stewards page (a nav panel, a tab per project) shows waiting on you,
in flight by stage, stuck or held, recently ended and the latest digest.
DESIGN.md marks the Board phase built and describes the record in §12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_edhbz5sea7.

_— from bb thread

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (glm-5p3, at 1d8b867)

Owner review required: yes — three of the owner-reviewed triggers apply: stewards is a live plugin and the diff touches its runtime code (server.ts, store.ts, wake.ts, app.tsx), it changes its skills/stewards/SKILL.md, and it adds a store migration (the new questions MIGRATIONS entry). @trotterdylan, this one needs your approval before it merges.

I read the acceptance criteria from BB-1 with linear_issue, including its spec comment (affected repos: bb-plugins only; the five criteria; the out-of-scope list), and verified the diff against them — no source-contract.ts copy, no other plugin and no other repo is touched, matching the spec's scope.

Suggestions

  • server.ts (~1968) — closing an unbound question with both answer and guidance in one steward_update call refuses the whole call ("Name the binding … for that") and records neither the answer nor the close; the project steward must retry without the guidance. Closing the question and complaining only about the stray guidance (or a line in the SKILL saying guidance needs a binding even when closing a question) would be friendlier.
  • app.tsx (STAGES) — the page hardcodes spec | build | review rather than deriving the list from STAGES in config.ts; if a stage were ever added to the playbook schema, its rows would silently fall under "No stage".
  • wake.ts (day/iso) — the nightly prompt renders question and digest dates in UTC, while the nightly pass runs in the project's configured timezone, so an "asked 2026-10-18" label can be off by one day for users west of UTC. Cosmetic; the page itself renders toLocaleString().
  • server.ts (~1973) — on forward there is a microtask gap between store.reroute and store.ask: if the escalation were resolved by another path in that gap, the question would be created against an already-resolved escalation and never auto-close (the user can still close it from the page). Vanishingly narrow; noting it for completeness.

Checked

  • Ran myself, because CI never runs the stewards suite: the plugins workflow matrix (devbox-provider, github-watcher, html-preview, image-copy, kubernetes-provider, team-setup, thread-briefs, workstreams) omits stewards, so this PR's green checks did not exercise the changed plugin. In plugins/stewards: npm install --include=dev, npm run typecheck (clean), npm test — 91/91 tests pass across 7 files, including the new store.test.ts, wake.test.ts and the extended server.test.ts.
  • Data: the questions table is one new append-only MIGRATIONS statement (CREATE TABLE IF NOT EXISTS); no existing statement is edited, the previous build ignores the new table, and a rollback (revert of the pin) leaves the table harmless. The escalation↔question pairing is closed in one transaction from either side (store.resolve closes its question; store.answer resolves its escalation), so the two records cannot disagree.
  • Restart behaviour: all new state is in sqlite, so a server restart on release loses nothing; the page is read-mostly and its one write (stewardsAnswerQuestion) is idempotent in effect (a closed question returns { ok: false }, not an error).
  • Security: stewardsAnswerQuestion refuses non-client callers (verified by a test with a plugin caller), inputs are length-capped, and the answer text is the only user content stored — no secrets touched.
  • Contracts: source-contract.ts untouched and contract.test.ts passes; stewards is already in the bb-server image's three plugin lists, so no bb-gate change is needed — this ships through the normal pin-and-rebuild path, and the PR body says so.
  • Verified against ticket:
    • AC1 (question table, created on forward-to-me and on ask, optionally bound): met — store.ask from both paths, bound via binding.
    • AC2 (closed from the page or with resolve+answer; closed never shows open): met — status='open' filters everywhere; re-answering returns false/{ok:false}.
    • AC3 (nightly prompt sections from the tables): met — previous digest with its date, open questions (every wake), what moved, waiting on you, stuck; wake.test.ts checks each section line by line, including the empty cases and that non-digest wakes omit the record.
    • AC4 (per-project page: waiting on you, in flight by stage with summary/next action/actor/workers, stuck or held, recently ended, latest digest with date): met — stewardsBoard + the nav panel, one tab per project.
    • AC5 (tests for store round-trips, prompt assembly, ask/resolve): met — and they would fail on a revert, since the tools/RPCs they call would not exist.
  • BB-2 coordination: BB-2 is PR stewards: deliver each escalation once and make steward_update safe to retry (BB-2) #23 and is still open; main has not moved since this branch's parent, so there is nothing to reconcile yet, and the PR body's plan (second merger rebases, keeps its migration last, re-checks resolve under BB-2's semantics) covers the steward_update/store.resolve/MIGRATIONS overlap. Worth re-checking at merge time.

— from bb thread thr_edhbz5sea7

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

LGTM

- Closing a question about the whole project with answer and guidance
  closes it and says the guidance was not saved, rather than refusing
  the call.
- The page's in-flight groups come from STAGES in config.ts, sent with
  the board, not a list hardcoded in app.tsx.
- Dates in the project steward's wake are in the project's nightly
  time zone, not UTC.
- A forwarded escalation's question is recorded before the await that
  delivers it, so the escalation cannot be resolved in between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round-1 suggestions (review at 1d8b867), all four fixed in b741a51. npm run typecheck clean, npm test in plugins/stewards: 92 passed in 7 files.

  1. server.ts: closing an unbound question with answer + guidance refused the whole call. Fixed in b741a51: the question now closes, and the reply says the guidance was not saved because guidance is kept per binding (name one with binding to give it). Any other binding-only field without a binding is still refused before anything is written. Test added in server.test.ts.
  2. app.tsx hardcoded spec | build | review. Fixed in b741a51: stewardsBoard now returns stages from STAGES in config.ts, and the page groups by that list, then by any other stage it sees, then "No stage". (app.tsx cannot import config.ts directly, because that file pulls in node:crypto.) The board test checks stages.
  3. wake.ts dates in UTC. Fixed in b741a51: "asked …" and "since …" dates in the project steward's wake use the project's nightly.timezone. Full timestamps keep their explicit Z. Test added in wake.test.ts (05:00Z on the 18th shows as 2026-10-17 for America/Los_Angeles).
  4. server.ts forward: gap between store.reroute and store.ask. Fixed in b741a51: the question is now recorded before the await deliver(...), so nothing can resolve the escalation between the two writes.

No migration change: questions is still the single appended MIGRATIONS statement. Forwarded questions still close with their escalation. The restart note stays in the PR body.

Because the head moved, @trotterdylan's LGTM on 1d8b867 no longer covers it, so this needs a fresh owner approval on b741a51. A new review round has been requested from the reviewer.

_— from bb thread

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (glm-5p3, at b741a51)

Owner review required: yes — unchanged from round 1: the diff still touches a live plugin's runtime code (stewards), its skills/, and adds a store migration. @trotterdylan, this one needs your approval; my verdict is approved, so the PR is ready for your review on this head.

Suggestions from round 1

  1. Unbound question with answer + guidance: resolved by b741a51 — the question now closes and the done message says the guidance was not saved and why (with a test).
  2. Hardcoded stage list in the page: resolved — stewardsBoard returns STAGES from config.ts and the page groups by that list, then any other stage seen, then "No stage" (with a test).
  3. UTC day labels in the wake: resolved — "asked"/"since" calendar-day labels now use the project's nightly.timezone via the existing localParts helper, with a test pinning the LA-vs-UTC boundary; full ISO timestamps (the record header, the previous digest's moment) stay UTC, which is the right split.
  4. The reroute→ask gap on forward: resolved — store.ask now runs before await deliver(), so the escalation cannot be resolved in between and leave an orphan question.

Suggestions

  • None this round.

Checked

  • Diffed b741a51 against round 1's head 1d8b867: the delta is exactly the four fixes plus tests (server.ts, wake.ts, app.tsx, server.test.ts, wake.test.ts); nothing else moved.
  • Ran myself, as CI still never runs the stewards suite: npm run typecheck (clean) and npm test in plugins/stewards — 92/92 pass across 7 files.
  • Re-classified from the full diff: same owner-reviewed triggers (live-plugin runtime code, skills, migration).
  • The fixes introduce no new behaviour beyond their scope: the guidance-drop path only fires for a question with no binding (guidance !== undefined && bindingRef === undefined), the RPC's new stages field is additive, and the timezone change only alters how day labels render.
  • BB-2 coordination unchanged: PR stewards: deliver each escalation once and make steward_update safe to retry (BB-2) #23 is still open and main has not moved since this branch's parent; the rebase plan in the PR body still covers the steward_update/store.resolve/MIGRATIONS overlap.

— from bb thread thr_edhbz5sea7

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

@trotterdylan, this PR needs your approval on the current head, b741a51. Your LGTM was on 1d8b867, and the head has moved since then.

  • Lane: owner-reviewed. It changes the runtime code and skills/ of the live stewards plugin, and adds a store migration (one new questions statement appended to MIGRATIONS).
  • Since 1d8b867: only the four round-1 fixes plus their tests (see the comment above).
  • Reviewer: approved b741a51 in round 2.
  • Checks: all 16 green. stewards typecheck and npm test pass 92/92.

A review or LGTM comment on b741a51 is all that's left before merge. Merging restarts every developer's server, either when its owner presses Restart now or in the quiet window.

_— from bb thread

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

LGTM

@trotterdylan
trotterdylan merged commit 559cc17 into main Oct 19, 2026
16 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-1-stewards-page-and-question-record-thr_j5itnpekkx branch October 19, 2026 01:35
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged as 559cc17 (owner-reviewed lane). Gate:

  • trotterdylan approved b741a51 in a comment at 2026-10-19T01:35:08Z.
  • The reviewer approved b741a51 in round 2.
  • All checks passed.

This restarts every developer's server: when its owner presses Restart now, or otherwise in the 03:00–05:00 US Eastern quiet window.

BB-2 (#23) can now rebase onto main. Keep its migration after the questions statement.

_— from bb thread

trotterdylan added a commit that referenced this pull request Oct 19, 2026
…o retry

Escalations carry delivered_at: the project steward's prompt lists
undelivered ones as new and the rest as still open, reads them at send
time so one resolved meanwhile is left out, and marks the new ones
delivered in the same step. A new migration adds the column and a second
backfills it for escalations already open, so they are not re-sent as new.

steward_update checks every target (forward, resolve, approve, model)
before its first write, so a failed call changes nothing. Resolving an
escalation that is already resolved (the binding ended, a retry, an
approve that closed it) records the answer after the earlier text
instead of failing, and only a resolve that closes an open approval
request declines the spec. Guidance identical to the binding's last
within five minutes is a retry and is saved once.

BB-2

On top of BB-1 (#22): the store's resolve keeps closing the question a
forward made, and answerEscalation goes through it, so a late answer to
an escalation the ending resolved is appended to its question too. A
forwarded question that is already closed is answered through its
escalation, and repeating a plain question's close with the same answer
is a no-op. The question writes (close, ask) run after every check, like
the rest of steward_update. Migrations go after #22's questions table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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