diff --git a/plugins/stewards/DESIGN.md b/plugins/stewards/DESIGN.md index ec95f117..145ab947 100644 --- a/plugins/stewards/DESIGN.md +++ b/plugins/stewards/DESIGN.md @@ -695,8 +695,8 @@ evidence it is safe, in shadow: decide-list mark and the recorded project approvals the `approvals.ts` path omits), the worker state (an explicit `parked`, distinct from `running`) and the liveness (wake source, idle, stall from the observable rows, not the -stored `noWakeSource` flag, which only a reconcile writes for a ticket or -pull request; an ops binding's report still writes it, BB-375). `compare` +stored `noWakeSource` flag, which only a reconcile writes, for every binding +kind, an ops binding included (BB-375). `compare` runs the predicates the assessment will replace and returns every disagreement. - `reconcile.ts` calls it on every binding inside a try/catch that can never diff --git a/plugins/stewards/README.md b/plugins/stewards/README.md index acde5dcc..6917660a 100644 --- a/plugins/stewards/README.md +++ b/plugins/stewards/README.md @@ -514,13 +514,11 @@ install on a stock bb: one repository, no Linear, no hooks service. row reads `waiting, no wake source`, `bb stewards list`/`show` say so, and the next wake carries one paragraph telling the steward to name what will deliver the wait (a binding to hold behind, a pull request, a deployment - target, a worker) or re-examine it. For a ticket or a pull request the - reconcile is the column's only writer (BB-375): a `steward_report` derives - the same sentence for its reply in the turn the wait is set, so the steward - can act then, but stores nothing. An ops binding is the one carve-out: it - does not run the assessment, so the report still writes the column for it - (the last report-time write; BB-379 removes it once the ops read cost is - settled). The mark clears when a source appears or the wait is cleared. + target, a worker) or re-examine it. The reconcile is the column's only + writer (BB-375), for every binding kind including ops: a `steward_report` + derives the same sentence for its reply in the turn the wait is set, so the + steward can act then, but stores nothing. The mark clears when a source + appears or the wait is cleared. Separately, the plugin counts consecutive wakes whose reason was `requeue` and whose report ended with the same trimmed `waitingOn`; at two (one plugin constant, not a `project.json` key) it diff --git a/plugins/stewards/assessment.ts b/plugins/stewards/assessment.ts index 93d11008..1756b807 100644 --- a/plugins/stewards/assessment.ts +++ b/plugins/stewards/assessment.ts @@ -77,7 +77,7 @@ export type AssessedLiveness = { stuck: boolean; /** A free-text wait with no tracked source and no dated wait ahead, recomputed from the rows. */ stalled: boolean; - /** The stored flag the assessment replaces; a reconcile is its only writer for a ticket or pull request (BB-375; an ops binding's report still writes it). */ + /** The stored flag the assessment replaces; a reconcile is its only writer (BB-375). */ reportedNoWakeSource: boolean; /** BB-351: the stored wait is live and past its kind's budget. */ overdue: boolean; diff --git a/plugins/stewards/server.test.ts b/plugins/stewards/server.test.ts index 8708a332..0ca7fc72 100644 --- a/plugins/stewards/server.test.ts +++ b/plugins/stewards/server.test.ts @@ -10327,20 +10327,23 @@ describe("ops stewards", () => { return { t, c, steward, wakes }; } - // BB-375: an ops binding does not run `assessBinding`, so the report keeps - // writing its `noWakeSource` (the one remaining report-time write); a - // ticket or pull-request report leaves the column to the reconcile. - it("writes the no-wake-source mark at report time for an ops binding (BB-375)", async () => { + // The ops reconcile derives the `noWakeSource` column for an ops binding, + // like every other kind; the report derives the sentence for its reply and + // stores nothing. + it("derives the no-wake-source mark on the ops reconcile, not the report", async () => { const { t, steward } = await watched(); const ops = steward()!; const report = await t.tool("steward_report", { phase: "watching", summary: "Waiting.", nextAction: "Wait", actor: "other", waitingOn: "the vendor's reply" }, ops.id); expect(report.error).toBe(false); expect(report.text).toContain("Nothing the plugin tracks will deliver this wait"); - // The ops carve-out: the report writes the column, since no ops reconcile does. + // The report stores nothing; the ops reconcile is the column's writer. + expect(t.hooks.store.find(TARGET)!.noWakeSource).toBe(false); + await t.hooks.reconcilePass("p1"); expect(t.hooks.store.find(TARGET)!.noWakeSource).toBe(true); - // Clearing the wait clears the mark on the next report. + // Clearing the wait clears the mark on the next reconcile. const cleared = await t.tool("steward_report", { phase: "watching", summary: "Nothing waiting.", nextAction: "Watch", actor: "steward", waitingOn: "" }, ops.id); expect(cleared.error).toBe(false); + await t.hooks.reconcilePass("p1"); expect(t.hooks.store.find(TARGET)!.noWakeSource).toBe(false); }); diff --git a/plugins/stewards/server.ts b/plugins/stewards/server.ts index 3c62d43a..7dd52582 100644 --- a/plugins/stewards/server.ts +++ b/plugins/stewards/server.ts @@ -5426,10 +5426,10 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P /** * BB-293/BB-322/BB-333/BB-375: the binding's one assessment, from the rows * the look already holds. BB-333 made the typed-wait derivation - * authoritative; BB-375 made the reconcile its only writer for a ticket or - * pull request: the stored `noWakeSource` is written from the assessment - * here, and `steward_report` derives the same answer for its reply without - * storing it (an ops binding's report still writes it). The shadow's + * authoritative; BB-375 made the reconcile its only writer: the stored + * `noWakeSource` is written from the assessment here for a ticket or pull + * request and from `observedStall` on the ops path, and `steward_report` + * derives the same answer for its reply without storing it. The shadow's * `noWakeSource` divergence is retired because the flag and the derivation * now agree by construction. The column and every surface that reads it are * unchanged. @@ -6618,6 +6618,12 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P const target = parseOpsTargetKey(b.entityId); // A target no longer listed is ended by the sweep. if (target === null || !allOpsTargets(config).some((t) => opsTargetKey(t) === b.entityId)) return; + // The no-wake-source mark is derived on every ops reconcile, from the + // same free-text wait rule a ticket or pull request uses. It runs before + // the per-target dispatch so every ops target kind gets it, including a + // look that cannot read the target and one that finds nothing actionable. + const noWakeSource = observedStall(b, liveWakeSourceFor(b, new Set()), now()); + if (b.noWakeSource !== noWakeSource) b = store.patch(b.id, { noWakeSource }); if (target.kind === "dependabot") { await reconcileDeps(b, config, playbook, target, force); return; @@ -13968,12 +13974,9 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P // by the one assessment on every reconcile. The report derives the // same answer here for its reply, so the reply is current in the turn // the wait is set. A no-kind report falls to `observedStall`, the - // derivation `assess` itself uses for it. For a ticket or a pull - // request the report stores nothing: the reconcile's own patch is the - // column's sole writer. An ops binding is the one carve-out (BB-375): - // it does not run `assessBinding`, so the report keeps writing the - // column for it. This is the last report-time `noWakeSource` write; - // BB-379 removes it once the ops read cost is settled. + // derivation `assess` itself uses for it. The report stores nothing: + // every reconcile, ticket, pull request or ops, is the column's sole + // writer. let derivedStalled: boolean | null = null; if (current.wait !== null && current.lastSnapshot !== null && playbook !== null && config !== null) { try { @@ -14004,10 +14007,6 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P { reason: wakeReason, waitingOn, liveSource: derivedStalled !== null ? !derivedStalled : liveSource, now: now(), until: current.requeueUntil }, ); b = store.patch(b.id, { - // BB-375: the ops carve-out, the one remaining report-time write of - // the flag; a ticket or pull-request report leaves it to the - // reconcile (see the comment above; BB-379 removes it). - ...(b.source === "ops" ? { noWakeSource } : {}), requeueWakeCount: stall.state.count, requeueWaitText: stall.state.waitText, requeueFirstAt: stall.state.firstAt, @@ -16447,7 +16446,7 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P "wait-divergences": cliCommand({ summary: "The typed wait's shadow state, derived vs noWakeSource (BB-333), read-only", - description: "One row per binding that has reported a typed wait: the stall derived from the wait kind on the last reconcile, the stored noWakeSource flag (a reconcile is its only writer for a ticket or pull request since BB-375; an ops binding's report still writes it), and the wait kind, first/last seen time and count from the noWakeSource divergence row behind that state. --binding filters by binding id or entity key. --json emits the rows. Read-only: nothing reads the state to decide or render.", + description: "One row per binding that has reported a typed wait: the stall derived from the wait kind on the last reconcile, the stored noWakeSource flag (a reconcile is its only writer since BB-375), and the wait kind, first/last seen time and count from the noWakeSource divergence row behind that state. --binding filters by binding id or entity key. --json emits the rows. Read-only: nothing reads the state to decide or render.", options: { binding: { type: "string", description: "Only this binding's wait divergences (binding id or entity key)" }, project: PROJECT_OPTION, diff --git a/plugins/stewards/store.ts b/plugins/stewards/store.ts index 5ac9e9a3..e825330f 100644 --- a/plugins/stewards/store.ts +++ b/plugins/stewards/store.ts @@ -4328,8 +4328,7 @@ export function createStore(db: Database.Database, now: () => number, options: S }, /** * Record a typed-wait divergence from the stored `noWakeSource` flag - * (BB-333; the reconcile is its only writer for a ticket or pull request - * since BB-375, an ops binding's report still writes it). A `noWakeSource` + * (BB-333; the reconcile is its only writer since BB-375). A `noWakeSource` * row is written only when the disagreement * starts; while it stands the open row's `last_seen_at` is refreshed so the * age prune cannot drop it, and when it stops the row is noted and the