diff --git a/plugins/stewards/DESIGN.md b/plugins/stewards/DESIGN.md index be8d3bbf..f4ac7a3b 100644 --- a/plugins/stewards/DESIGN.md +++ b/plugins/stewards/DESIGN.md @@ -422,7 +422,7 @@ which writes the status record: | Field | Holds | |---|---| | phase, summary | Where the entity is, in a sentence. | -| next action, actor | What happens next, and who does it: `me`, `steward`, `other`. | +| next action, actor | What happens next, and who does it: `user` (the server's owner has to act), `steward` (the steward itself, including its own next step such as re-checking on the next deployment wake) or `other` (someone else). The actor is a party, not a pronoun: BB-95 misread `me` as the steward and filed its own re-check as needing the user. | | blocked on | Who or what outside the thread it waits for. | | requeue after | When to wake it if nothing else does. Defaults to the playbook's `requeue-default`. | | conditions | Open escalations, `stuck`. | diff --git a/plugins/stewards/README.md b/plugins/stewards/README.md index 62108995..17676547 100644 --- a/plugins/stewards/README.md +++ b/plugins/stewards/README.md @@ -109,7 +109,10 @@ bb. [DESIGN.md](DESIGN.md) is the design; this is how it is built and run. - **Two tools.** `steward_report` ends a turn with the status record and, when needed, an escalation; `steward_update` steers a binding (guidance, deciding or forwarding escalations, priority, holds, models, approving a - spec). + spec). The report's `actor` names who acts next: `user` (the server's + owner has to act), `steward` (the steward itself, including its own next + step such as re-checking on the next deployment wake) or `other` + (someone else). - **Scheduling.** Two tickets changing the same files at once end in a rebase for whichever merges second, so the project steward sequences them. Each steward reports the repo-relative paths its work changes diff --git a/plugins/stewards/app.test.tsx b/plugins/stewards/app.test.tsx index ff1c95e6..a081dc73 100644 --- a/plugins/stewards/app.test.tsx +++ b/plugins/stewards/app.test.tsx @@ -704,6 +704,16 @@ describe("the Stewards page's project view and detail views (BB-85)", () => { slot.lifecycle.unmount(); }); + it("labels the `user` actor as you in an effort's status (BB-97)", async () => { + const slot = await renderBoardWith({ + subPath: "p1/ENG-1", + stewards: [boardSteward({ key: "ENG-1", title: "Fix login", needsUser: true, phase: "In Review", summary: "In review", nextAction: "On the next deployment wake, re-run the carries check", actor: "user", statusAt: 1_000, createdAt: 2_000, stage: "build" })], + }); + await waitFor(() => expect(slot.getByText("Fix login")).toBeTruthy()); + expect(slot.getByText(/Next: On the next deployment wake, re-run the carries check \(you\)/u)).toBeTruthy(); + slot.lifecycle.unmount(); + }); + it("keeps the page-only controls on the detail's needs-you items: the secret form and the approve-spec note", async () => { const slot = await renderBoardWith({ subPath: "p1/ENG-1", diff --git a/plugins/stewards/app.tsx b/plugins/stewards/app.tsx index 6f11f071..d9ad245d 100644 --- a/plugins/stewards/app.tsx +++ b/plugins/stewards/app.tsx @@ -308,7 +308,7 @@ function ProjectStatus({ project: p, now }: { project: Project; now: number }) { // ---- Stewards ------------------------------------------------------------------------------------- -const ACTOR_LABEL: Record = { me: "you", steward: "the steward", other: "someone else" }; +const ACTOR_LABEL: Record = { user: "you", steward: "the steward", other: "someone else" }; /** * The BB-76 effort row (BB-78): the glyph, the shortened key and the title on diff --git a/plugins/stewards/reconcile.test.ts b/plugins/stewards/reconcile.test.ts index 4f703f4e..94e74f8c 100644 --- a/plugins/stewards/reconcile.test.ts +++ b/plugins/stewards/reconcile.test.ts @@ -270,7 +270,7 @@ describe("approval words", () => { }); it("flags a report that asks for an approval already open, and only that", () => { - const status = (summary: string, nextAction: string) => ({ phase: "Todo", summary, nextAction, actor: "me" as const, blockedOn: null, requeueAfterMs: null, conditions: [], resources: { workers: [], pullRequests: [], children: [] }, at: 1 }); + const status = (summary: string, nextAction: string) => ({ phase: "Todo", summary, nextAction, actor: "user" as const, blockedOn: null, requeueAfterMs: null, conditions: [], resources: { workers: [], pullRequests: [], children: [] }, at: 1 }); const open = [{ kind: "approval" } as never]; expect(asksForOpenApproval(status("Spec posted.", "Ask the user to approve the spec"), open)).toMatch(/already open/u); // Waiting on the request, or on the project steward, is not asking again. diff --git a/plugins/stewards/server.test.ts b/plugins/stewards/server.test.ts index 133a20af..c95c392b 100644 --- a/plugins/stewards/server.test.ts +++ b/plugins/stewards/server.test.ts @@ -893,7 +893,7 @@ describe("a Linear ticket steward", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const [project, steward] = t.spawns.map((x) => x.id); - const reported = await t.tool("steward_report", { phase: "Todo", summary: "Spec posted.", nextAction: "Ask the user", actor: "me", ready: { checklist: [1, 2, 3, 4].map((item) => ({ item, met: true })), substantial: true } }, steward!); + const reported = await t.tool("steward_report", { phase: "Todo", summary: "Spec posted.", nextAction: "Ask the user", actor: "user", ready: { checklist: [1, 2, 3, 4].map((item) => ({ item, met: true })), substantial: true } }, steward!); expect(reported.text).toMatch(/requested from the user, on the Stewards page \(need_[\w-]+\): they press Approve or Decline there/u); expect(t.sends.filter((s) => s.threadId === project)).toHaveLength(0); t.userTurns.push({ threadId: steward!, text: "Approved, go ahead." }); @@ -2388,7 +2388,7 @@ describe("stewards waiting on others", () => { await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...waiting, actor: "me" }, steward); + await t.tool("steward_report", { ...waiting, actor: "user" }, steward); await t.idle(steward); expect(t.threads.get(steward)!.visibility).toBe("visible"); @@ -2570,6 +2570,57 @@ describe("stewards waiting on others", () => { }); }); +describe("the status report actor (BB-97)", () => { + async function bound() { + const t = await setup(); + t.entities.set("uuid-12", issue()); + await t.ring("linear", "uuid-12"); + const [project, steward] = t.spawns.map((x) => x.id) as [string, string]; + return { ...t, project, steward }; + } + const status = (t: Awaited>) => t.hooks.store.find("ENG-12")!.status; + const needsUser = async (t: Awaited>) => { + const sidebar = (await t.harness.callRpc("stewardsSidebar", null)) as { projects: Array<{ bindings: Array<{ key: string; needsUser: boolean }> }> }; + return sidebar.projects[0]!.bindings.find((b) => b.key === "ENG-12")!.needsUser; + }; + + it("records `user` as the server's owner, so the row needs you; `steward` and `other` do not", async () => { + const t = await bound(); + await t.tool("steward_report", { phase: "In Progress", summary: "Building.", nextAction: "Wait for the worker", actor: "steward" }, t.steward); + expect(status(t)!.actor).toBe("steward"); + expect(await needsUser(t)).toBe(false); + + await t.tool("steward_report", { phase: "In Progress", summary: "Building.", nextAction: "Wait", actor: "other" }, t.steward); + expect(status(t)!.actor).toBe("other"); + expect(await needsUser(t)).toBe(false); + + await t.tool("steward_report", { phase: "In Review", summary: "Waiting.", nextAction: "On the next deployment wake, re-run the carries check", actor: "user", blockedOn: "a bb-gate deployment" }, t.steward); + expect(status(t)!.actor).toBe("user"); + expect(await needsUser(t)).toBe(true); + }); + + it("accepts `me` for one release: stored as `user`, needs you, and one log line", async () => { + const t = await bound(); + const before = t.harness.logEntries.length; + const report = await t.tool("steward_report", { phase: "In Review", summary: "Waiting.", nextAction: "On the next deployment wake, re-run the carries check", actor: "me" }, t.steward); + expect(report.error).toBe(false); + expect(status(t)!.actor).toBe("user"); + expect(await needsUser(t)).toBe(true); + expect(t.harness.logEntries.slice(before).filter((entry) => entry.message.includes('actor "me" is renamed to "user"'))).toHaveLength(1); + }); + + it("describes `user` as the server's owner and `steward` as the steward's own next step (BB-95)", async () => { + const t = await bound(); + const config = await t.harness.behavior.resolveAgentConfiguration(makePluginAgentConfigurationContext({ thread: { id: t.steward, title: null, parentThreadId: null, sourceThreadId: null } })); + const report = config.tools.find((x) => x.name === "steward_report")!; + const description = (report.inputSchema as { properties: { actor: { description: string } } }).properties.actor.description; + expect(description).toMatch(/`user` means the server's owner has to act/u); + expect(description).toMatch(/`steward` is you/u); + expect(description).toMatch(/next deployment wake/u); + expect(description).toMatch(/BB-95/u); + }); +}); + describe("the one-time unhide (BB-93)", () => { it("shows every live, unarchived hidden thread of an open binding, and does nothing on a second start", async () => { const t = await setup(); @@ -3264,7 +3315,7 @@ describe("questions to the user", () => { t.entities.set("uuid-12", issue({ comments: [comment({ createdAt: "2026-10-14T16:00:00Z" })] })); await t.ring("linear", "uuid-12"); expect(t.sends.filter((s) => s.threadId === t.steward).at(-1)!.text).toMatch(/Do not ask the user again; it is listed on the Stewards page/u); - const bad = await t.tool("steward_report", { ...base, nextAction: "Ask the user to approve the spec", actor: "me", ready: met }, t.steward); + const bad = await t.tool("steward_report", { ...base, nextAction: "Ask the user to approve the spec", actor: "user", ready: met }, t.steward); expect(bad.text).toMatch(/playbook violation/u); expect((await t.harness.behavior.runCli(["show", "ENG-12"])).stdout).toMatch(/asks for an approval that is already open/u); }); @@ -3815,7 +3866,7 @@ describe("needs you items", () => { const b = t.binding(); const report = await t.tool( "steward_report", - { ...base, actor: "me", needs: [{ kind: "approve-pr", url: "https://github.com/acme/web/pull/7", what: "Approve acme/web#7 on GitHub" }] }, + { ...base, actor: "user", needs: [{ kind: "approve-pr", url: "https://github.com/acme/web/pull/7", what: "Approve acme/web#7 on GitHub" }] }, t.steward, ); expect(report.error).toBe(false); @@ -3830,7 +3881,7 @@ describe("needs you items", () => { const b = t.binding(); const report = await t.tool( "steward_report", - { ...base, actor: "me", needs: [{ kind: "merge", url: "https://github.com/acme/web/pull/7", what: "Merge acme/web#7" }] }, + { ...base, actor: "user", needs: [{ kind: "merge", url: "https://github.com/acme/web/pull/7", what: "Merge acme/web#7" }] }, t.steward, ); expect(report.error).toBe(false); @@ -4017,7 +4068,7 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", escalate: { kind: "decision", question: "Provide API_TOKEN.", meanwhile: "Wait." } }, steward); + await t.tool("steward_report", { ...base, actor: "user", escalate: { kind: "decision", question: "Provide API_TOKEN.", meanwhile: "Wait." } }, steward); const b = t.hooks.store.find("ENG-12")!; const esc = t.hooks.store.openEscalations(b.id).find((x) => x.kind === "decision")!; const out = await t.tool("steward_update", { binding: "ENG-12", forward: esc.id, resolution: "secret", variable: "API_TOKEN", purpose: "deploys" }, t.spawns[0]!.id); @@ -4054,7 +4105,7 @@ describe("needs you items", () => { // A forward to the user without a resolution is refused too (the test shim // injects one elsewhere, so this calls the tool directly). const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", escalate: { kind: "decision", question: "Include SSO?", meanwhile: "Wait." } }, steward); + await t.tool("steward_report", { ...base, actor: "user", escalate: { kind: "decision", question: "Include SSO?", meanwhile: "Wait." } }, steward); const esc = t.hooks.store.openEscalations(t.hooks.store.find("ENG-12")!.id).find((x) => x.kind === "decision")!; const forward = (await t.harness.behavior.callAgentTool("steward_update", { binding: "ENG-12", forward: esc.id }, { threadId: project, projectId: "p1" })) as { isError?: boolean }; expect(forward.isError).toBe(true); @@ -4111,7 +4162,7 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "LINEAR_CLIENT_SECRET", variable: "LINEAR_CLIENT_SECRET", purpose: "Token exchange", worker: "thr_w1" }] }, steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "LINEAR_CLIENT_SECRET", variable: "LINEAR_CLIENT_SECRET", purpose: "Token exchange", worker: "thr_w1" }] }, steward); const b = t.hooks.store.find("ENG-12")!; const need = t.hooks.store.openNeeds(b.id).find((n) => n.kind === "provide-secret")!; const spawned = t.spawns.length; @@ -4146,7 +4197,7 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "SOME_TOKEN", variable: "SOME_TOKEN", purpose: "Auth" }] }, steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "SOME_TOKEN", variable: "SOME_TOKEN", purpose: "Auth" }] }, steward); const b = t.hooks.store.find("ENG-12")!; const need = t.hooks.store.openNeeds(b.id).find((n) => n.kind === "provide-secret")!; const res = (await t.harness.callRpc("stewardsNeedAction", { needId: need.id, action: "provide" }, client)) as { ok: boolean; threadId: string }; @@ -4160,13 +4211,13 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - const bad = await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "Bad", variable: "X", purpose: "Y", setting: "paused" }] }, steward); + const bad = await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "Bad", variable: "X", purpose: "Y", setting: "paused" }] }, steward); expect(bad.error).toBe(false); expect(bad.text).toMatch(/is not a secret setting/u); - const missing = await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "No variable" }] }, steward); + const missing = await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "No variable" }] }, steward); expect(missing.error).toBe(false); expect(missing.text).toMatch(/name the env var with `variable`/u); - const good = await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "Good", variable: "SENTRY_TOKEN", purpose: "Y", setting: "sentryToken" }] }, steward); + const good = await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "Good", variable: "SENTRY_TOKEN", purpose: "Y", setting: "sentryToken" }] }, steward); expect(good.error).toBe(false); const b = t.hooks.store.find("ENG-12")!; expect(t.hooks.store.openNeeds(b.id).some((n) => n.data.setting === "sentryToken")).toBe(true); @@ -4178,7 +4229,7 @@ describe("needs you items", () => { await t.ring("linear", "uuid-12"); t.harness.sdk.stub("threads.storageLocation", async ({ threadId }: { threadId: string }) => ({ hostId: "host_off", storageRootPath: `/storage/${threadId}` })); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "X", variable: "X", purpose: "Auth", worker: "thr_w1" }] }, steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "X", variable: "X", purpose: "Auth", worker: "thr_w1" }] }, steward); const b = t.hooks.store.find("ENG-12")!; const need = t.hooks.store.openNeeds(b.id).find((n) => n.kind === "provide-secret")!; await t.harness.callRpc("stewardsNeedAction", { needId: need.id, action: "provide" }, client); @@ -4190,7 +4241,7 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "X", variable: "X", purpose: "Auth" }] }, steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "X", variable: "X", purpose: "Auth" }] }, steward); const b = t.hooks.store.find("ENG-12")!; const need = t.hooks.store.openNeeds(b.id).find((n) => n.kind === "provide-secret")!; const first = (await t.harness.callRpc("stewardsNeedAction", { needId: need.id, action: "provide" }, client)) as { threadId: string }; @@ -4206,7 +4257,7 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "Enter the Sentry token", variable: "SENTRY_TOKEN", purpose: "Read Sentry", setting: "sentryToken" }] }, steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "Enter the Sentry token", variable: "SENTRY_TOKEN", purpose: "Read Sentry", setting: "sentryToken" }] }, steward); const b = t.hooks.store.find("ENG-12")!; const need = t.hooks.store.openNeeds(b.id).find((n) => n.kind === "provide-secret")!; const res = (await t.harness.callRpc("stewardsNeedAction", { needId: need.id, action: "provide" }, client)) as { ok: boolean; threadId: string }; @@ -4235,7 +4286,7 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "provide-secret", what: "Enter the Sentry token", variable: "SENTRY_TOKEN", purpose: "Read Sentry", setting: "sentryToken" }] }, steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "provide-secret", what: "Enter the Sentry token", variable: "SENTRY_TOKEN", purpose: "Read Sentry", setting: "sentryToken" }] }, steward); const b = t.hooks.store.find("ENG-12")!; const need = t.hooks.store.openNeeds(b.id).find((n) => n.kind === "provide-secret")!; const res = (await t.harness.callRpc("stewardsNeedAction", { needId: need.id, action: "provide" }, client)) as { ok: boolean; threadId: string }; @@ -4278,10 +4329,10 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const steward = t.spawns[1]!.id; - const bad = await t.tool("steward_report", { ...base, actor: "me", blockedOn: "the user's answer" }, steward); + const bad = await t.tool("steward_report", { ...base, actor: "user", blockedOn: "the user's answer" }, steward); expect(bad.error).toBe(true); expect(bad.text).toMatch(/File it as a needs item/u); - const ok = await t.tool("steward_report", { ...base, actor: "me", blockedOn: "the user's answer", needs: [{ kind: "decide", what: "Answer the scope question", url: "https://linear.app/acme/issue/ENG-12" }] }, steward); + const ok = await t.tool("steward_report", { ...base, actor: "user", blockedOn: "the user's answer", needs: [{ kind: "decide", what: "Answer the scope question", url: "https://linear.app/acme/issue/ENG-12" }] }, steward); expect(ok.error).toBe(false); }); @@ -4307,7 +4358,7 @@ describe("needs you items", () => { t.entities.set("uuid-12", issue()); await t.ring("linear", "uuid-12"); const [project, steward] = t.spawns.map((x) => x.id) as [string, string]; - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "configure", url: "https://linear.app/settings/api", what: "Add the client secret" }] }, steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "configure", url: "https://linear.app/settings/api", what: "Add the client secret" }] }, steward); await t.hooks.nightlyPass("p1", "manual"); await t.flush(); const wake = t.sends.filter((s) => s.threadId === project).at(-1)!.text; @@ -4328,7 +4379,7 @@ describe("needs you items", () => { "steward_report", { ...base, - actor: "me", + actor: "user", ready: met, needs: [ { kind: "configure", url: "https://linear.app/settings/api", what: "Add the client secret", how: "Settings → API" }, @@ -4657,7 +4708,7 @@ describe("fixed choices on decide items and questions", () => { const t = await adopted(); const reported = await t.tool( "steward_report", - { ...base, actor: "me", needs: [{ kind: "decide", what: "Merge, close, or verify the workflow first?", choices: ["Merge", "Close", "Verify first"] }] }, + { ...base, actor: "user", needs: [{ kind: "decide", what: "Merge, close, or verify the workflow first?", choices: ["Merge", "Close", "Verify first"] }] }, t.steward, ); expect(reported.error).toBe(false); @@ -4715,7 +4766,7 @@ describe("fixed choices on decide items and questions", () => { it("criterion 4: bb stewards done --choice records a choice for a need and a question, and refuses a label not among them", async () => { const t = await adopted(); - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "decide", what: "Merge or close?", choices: ["Merge", "Close"] }] }, t.steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "decide", what: "Merge or close?", choices: ["Merge", "Close"] }] }, t.steward); const need = t.hooks.store.openNeeds(t.binding().id).find((n) => n.kind === "decide")!; const refused = await t.harness.behavior.runCli(["done", need.id, "--choice", "Ship it", "--project", "p1"]); expect(refused).toMatchObject({ exitCode: 1, stderr: expect.stringMatching(/not one of .* choices: Merge, Close/u) }); @@ -4739,7 +4790,7 @@ describe("fixed choices on decide items and questions", () => { it("criterion 5: needs, show and the digest print the choices", async () => { const t = await adopted(); - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "decide", url: "https://linear.app/acme/issue/ENG-12", what: "Merge or close?", choices: ["Merge", "Close"] }] }, t.steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "decide", url: "https://linear.app/acme/issue/ENG-12", what: "Merge or close?", choices: ["Merge", "Close"] }] }, t.steward); expect((await t.harness.behavior.runCli(["needs", "--project", "p1"])).stdout).toMatch(/Merge or close\? \[choices: Merge, Close\]/u); expect((await t.harness.behavior.runCli(["show", "ENG-12", "--project", "p1"])).stdout).toMatch(/Escalation esc_\S+ decision \(open, me\): Merge or close\? \[choices: Merge, Close\]/u); await t.hooks.nightlyPass("p1", "manual"); @@ -4751,9 +4802,9 @@ describe("fixed choices on decide items and questions", () => { it("rejects choices outside two to six labels", async () => { const t = await adopted(); - await expect(t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "decide", what: "One option?", choices: ["Only"] }] }, t.steward)).rejects.toThrow(/expected array to have >=2/u); - await expect(t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "decide", what: "Too many?", choices: ["a", "b", "c", "d", "e", "f", "g"] }] }, t.steward)).rejects.toThrow(/expected array to have <=6/u); - const wrongKind = await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "configure", what: "Set it", choices: ["Yes", "No"] }] }, t.steward); + await expect(t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "decide", what: "One option?", choices: ["Only"] }] }, t.steward)).rejects.toThrow(/expected array to have >=2/u); + await expect(t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "decide", what: "Too many?", choices: ["a", "b", "c", "d", "e", "f", "g"] }] }, t.steward)).rejects.toThrow(/expected array to have <=6/u); + const wrongKind = await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "configure", what: "Set it", choices: ["Yes", "No"] }] }, t.steward); expect(wrongKind.error).toBe(false); expect(wrongKind.text).toMatch(/choices are for a decide item/u); expect(t.hooks.store.openNeeds(t.binding().id).some((n) => n.kind === "configure")).toBe(false); @@ -4766,7 +4817,7 @@ describe("fixed choices on decide items and questions", () => { it("bb stewards done --note without --choice keeps the note as the answer and guidance", async () => { const t = await adopted(); - await t.tool("steward_report", { ...base, actor: "me", needs: [{ kind: "decide", what: "Which way?" }] }, t.steward); + await t.tool("steward_report", { ...base, actor: "user", needs: [{ kind: "decide", what: "Which way?" }] }, t.steward); const need = t.hooks.store.openNeeds(t.binding().id).find((n) => n.kind === "decide")!; const out = await t.harness.behavior.runCli(["done", need.id, "--note", "The second way", "--project", "p1"]); expect(out).toMatchObject({ exitCode: 0, stdout: expect.stringMatching(/Closed/u) }); @@ -6955,7 +7006,7 @@ describe("steward-spawned threads and the sidebar (BB-39)", () => { // The user is next: left unread. const before = marks().length; - await t.tool("steward_report", { phase: "open", summary: "Reviewed.", nextAction: "You decide", actor: "me" }, steward); + await t.tool("steward_report", { phase: "open", summary: "Reviewed.", nextAction: "You decide", actor: "user" }, steward); expect(marks()).toHaveLength(before); // An escalation is open: left unread. diff --git a/plugins/stewards/server.ts b/plugins/stewards/server.ts index 9c0c0bfb..43d8ddf8 100644 --- a/plugins/stewards/server.ts +++ b/plugins/stewards/server.ts @@ -1509,7 +1509,7 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P */ function needsUser(b: Binding): boolean { return ( - b.status?.actor === "me" || + b.status?.actor === "user" || store.openEscalations(b.id).length > 0 || store.openNeeds(b.id).length > 0 || store.openQuestions(b.projectId).some((q) => q.bindingId === b.id) @@ -5440,7 +5440,7 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P phase: z.string().trim().min(1).max(100).describe("The entity's phase as you understand it, usually its state."), summary: z.string().trim().min(1).max(600).describe("Where the entity is, in a sentence."), nextAction: z.string().trim().min(1).max(600).describe("What happens next."), - actor: z.enum(ACTORS).describe("Who does the next action: me (the user), steward (you or your workers), other (someone else)."), + actor: z.enum([...ACTORS, "me"]).describe("Who does the next action. `user` means the server's owner has to act — a decision, a credential, a step outside the repos — and leaves the row needing them (unread and ringing). `steward` is you: your own next step, including re-checking on the next deployment wake, is `steward`, not `user`. On BB-95 a steward filed \"On the next deployment wake, re-run the carries check and report deployed or not-yet\" as `me` and the row wrongly read \"needs you\"; that next step is `steward`. `other` is someone else."), blockedOn: z.string().trim().max(300).optional().describe("Who or what outside this thread it waits for."), requeueAfter: durationSchema.optional().describe('When to wake you if nothing else does, such as "4h" or "2d". The playbook\'s default when left out.'), conditions: z.array(z.string().trim().min(1).max(200)).max(10).optional().describe("Anything else a reader of the status should know at a glance."), @@ -5535,6 +5535,11 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P }), execute: store.coalescingTool(async (input, { threadId }) => { try { + // BB-97: `me` is the old name for `user`. Accept it for one release + // so a steward whose prompt predates the rename is not wedged: it is + // normalised here and the stored value is always `user`. + const actor: (typeof ACTORS)[number] = input.actor === "me" ? "user" : input.actor; + if (input.actor === "me") bb.log.info(`stewards: steward_report actor "me" is renamed to "user"; recording this report as user (thread ${threadId}).`); let b = ownBinding(threadId); // Validate the input that does not depend on which pull request the // binding is on before a replacement moves it: a wrap-up report that @@ -5655,7 +5660,7 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P phase: input.phase, summary: input.summary, nextAction: input.nextAction, - actor: input.actor, + actor, blockedOn: input.blockedOn ?? null, requeueAfterMs: requeueMs, conditions: [...(input.conditions ?? []), ...open.map((x) => `${x.kind} escalation with ${x.route}`)], diff --git a/plugins/stewards/skills/stewards/SKILL.md b/plugins/stewards/skills/stewards/SKILL.md index e2d8bf77..adc53058 100644 --- a/plugins/stewards/skills/stewards/SKILL.md +++ b/plugins/stewards/skills/stewards/SKILL.md @@ -42,7 +42,9 @@ copy the command. Two tools are yours; everything else you do with the tools every thread has. - **`steward_report` ends every woken turn**: phase, a one-sentence summary, - the next action and who does it (`me` = the user, `steward`, `other`), what + the next action and who does it (`user` = the server's owner has to act, + `steward` = you, including your own next step such as re-checking on the + next deployment wake, `other` = someone else), what you are blocked on, and `requeueAfter`. On a ticket, report the ready checklist too, each item by its number in the wake (`{ item: 1, met: true }`); a paraphrase is refused. Three turns in a row @@ -245,7 +247,7 @@ is the plugin's, so diagnose from the wake and the code in your workspace. `actor: other` and end the turn. - **No Sentry token** (the wake says so): raise the escalation it describes (variable `SENTRY_TOKEN`, setting `sentryToken`, the Sentry auth-tokens - page, the scopes), report with `actor: me`, and end the turn. + page, the scopes), report with `actor: user`, and end the turn. - **No logs** (the wake says so): diagnose from status and events, and say in the ticket that logs were not available. diff --git a/plugins/stewards/store.test.ts b/plugins/stewards/store.test.ts index 5cba0d07..0f7e55f0 100644 --- a/plugins/stewards/store.test.ts +++ b/plugins/stewards/store.test.ts @@ -1,6 +1,10 @@ import Database from "better-sqlite3"; import { describe, expect, it } from "vitest"; -import { APPROVAL_MARKER_MIGRATIONS, BASE_MIGRATIONS, CHAIN_MIGRATIONS, GUIDANCE_MIGRATIONS, IDLE_MIGRATIONS, LESSON_COUNTER_MIGRATIONS, LESSON_TIER_MIGRATIONS, MIGRATIONS, RATIONALE_MIGRATIONS, VALIDATION_MIGRATIONS, WORKER_CHECK_MIGRATIONS, createStore, lessonScope } from "./store.js"; +import { z } from "zod"; +import { ACTOR_MIGRATIONS, APPROVAL_MARKER_MIGRATIONS, BASE_MIGRATIONS, CHAIN_MIGRATIONS, GUIDANCE_MIGRATIONS, IDLE_MIGRATIONS, LESSON_COUNTER_MIGRATIONS, LESSON_TIER_MIGRATIONS, MIGRATIONS, RATIONALE_MIGRATIONS, VALIDATION_MIGRATIONS, WORKER_CHECK_MIGRATIONS, createStore, lessonScope, statusRecordSchema } from "./store.js"; + +/** MIGRATIONS without the groups appended after the ones these order tests assert. */ +const beforeActorMigrations = MIGRATIONS.slice(0, MIGRATIONS.length - ACTOR_MIGRATIONS.length); function store() { const db = new Database(":memory:"); @@ -311,14 +315,88 @@ describe("the lesson tier migration (BB-35 step 3)", () => { // `bb.storage.migrate` records each statement by index and refuses a changed // one; a group spliced in mid-array would fail every live database on load. // BB-35 step 4 appended the rationale group, step 5 the validation group, - // step 6 the guidance group, BB-83 the idle group, and BB-77 the approval - // marker group, after this one. - expect(MIGRATIONS.slice(-APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...APPROVAL_MARKER_MIGRATIONS]); - expect(MIGRATIONS.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length), -APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...IDLE_MIGRATIONS]); - expect(MIGRATIONS.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length))).toEqual([...GUIDANCE_MIGRATIONS]); - expect(MIGRATIONS.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length + VALIDATION_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length))).toEqual([...VALIDATION_MIGRATIONS]); + // step 6 the guidance group, BB-83 the idle group, BB-77 the approval + // marker group, and BB-97 the actor rename group, after this one. The + // slices stop at the actor group so this test still checks its own order. + expect(beforeActorMigrations.slice(-APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...APPROVAL_MARKER_MIGRATIONS]); + expect(beforeActorMigrations.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length), -APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...IDLE_MIGRATIONS]); + expect(beforeActorMigrations.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length))).toEqual([...GUIDANCE_MIGRATIONS]); + expect(beforeActorMigrations.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length + VALIDATION_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length))).toEqual([...VALIDATION_MIGRATIONS]); const afterTier = APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length + VALIDATION_MIGRATIONS.length + RATIONALE_MIGRATIONS.length; - expect(MIGRATIONS.slice(-(afterTier + LESSON_TIER_MIGRATIONS.length), -afterTier)).toEqual([...LESSON_TIER_MIGRATIONS]); + expect(beforeActorMigrations.slice(-(afterTier + LESSON_TIER_MIGRATIONS.length), -afterTier)).toEqual([...LESSON_TIER_MIGRATIONS]); + }); +}); + +describe("the actor rename migration (BB-97)", () => { + // The pre-rename build parsed `status` with this schema through the same + // `json()` helper (a safeParse inside try/catch, falling back to null). A + // migrated `user` row must read back as no status there, never throw. + const preRenameStatusSchema = statusRecordSchema.extend({ actor: z.enum(["me", "steward", "other"]) }); + const readAsOldBuild = (raw: string | null) => { + if (raw === null) return null; + try { + const parsed = preRenameStatusSchema.safeParse(JSON.parse(raw)); + return parsed.success ? parsed.data : null; + } catch { + return null; + } + }; + + /** A database as the pre-rename build left it, with the actor migration not yet applied. */ + const legacy = () => { + const db = new Database(":memory:"); + for (const sql of MIGRATIONS.slice(0, MIGRATIONS.indexOf(ACTOR_MIGRATIONS[0]!))) db.exec(sql); + return db; + }; + const insert = (db: ReturnType, id: string, key: string, status: string | null) => + db.prepare(`INSERT INTO bindings (id, project_id, source, entity_id, entity_key, kind, playbook, playbook_version, status, created_at) + VALUES (?, 'p1', 'linear', ?, ?, 'ticket', 'linear-tickets', 'v1', ?, 1000)`).run(id, `uuid-${id}`, key, status); + const actor = (s: ReturnType, key: string) => s.find(key, "p1")!.status!.actor; + + it("rewrites `me` to `user` in the stored status, leaving the rest of the record alone", () => { + const db = legacy(); + insert(db, "bnd_1", "ENG-12", JSON.stringify({ phase: "In Review", summary: "Waiting.", nextAction: "On the next deployment wake, re-run the carries check", actor: "me", blockedOn: "a bb-gate deployment", requeueAfterMs: null, conditions: ["a condition"], resources: { workers: ["thr_w1"], pullRequests: [], children: [] }, at: 1_000 })); + for (const sql of ACTOR_MIGRATIONS) db.exec(sql); + const s = createStore(db, () => 2_000); + expect(s.find("ENG-12", "p1")!.status).toEqual({ phase: "In Review", summary: "Waiting.", nextAction: "On the next deployment wake, re-run the carries check", actor: "user", blockedOn: "a bb-gate deployment", requeueAfterMs: null, conditions: ["a condition"], resources: { workers: ["thr_w1"], pullRequests: [], children: [] }, at: 1_000 }); + }); + + it("is idempotent, and leaves `steward` and `other` untouched", () => { + const db = legacy(); + insert(db, "bnd_me", "ENG-12", JSON.stringify({ phase: "x", summary: "y", nextAction: "z", actor: "me", blockedOn: null, requeueAfterMs: null, conditions: [], resources: { workers: [], pullRequests: [], children: [] }, at: 1 })); + insert(db, "bnd_steward", "ENG-13", JSON.stringify({ phase: "x", summary: "y", nextAction: "z", actor: "steward", blockedOn: null, requeueAfterMs: null, conditions: [], resources: { workers: [], pullRequests: [], children: [] }, at: 2 })); + insert(db, "bnd_other", "ENG-14", JSON.stringify({ phase: "x", summary: "y", nextAction: "z", actor: "other", blockedOn: null, requeueAfterMs: null, conditions: [], resources: { workers: [], pullRequests: [], children: [] }, at: 3 })); + for (const sql of ACTOR_MIGRATIONS) db.exec(sql); + // A second run matches nothing and changes nothing. + for (const sql of ACTOR_MIGRATIONS) db.exec(sql); + const s = createStore(db, () => 2_000); + expect(actor(s, "ENG-12")).toBe("user"); + expect(actor(s, "ENG-13")).toBe("steward"); + expect(actor(s, "ENG-14")).toBe("other"); + }); + + it("a pre-rename build reads a migrated row as no status, never throwing (rollback)", () => { + const db = legacy(); + insert(db, "bnd_1", "ENG-12", JSON.stringify({ phase: "x", summary: "y", nextAction: "z", actor: "me", blockedOn: null, requeueAfterMs: null, conditions: [], resources: { workers: [], pullRequests: [], children: [] }, at: 1 })); + for (const sql of ACTOR_MIGRATIONS) db.exec(sql); + const raw = (db.prepare("SELECT status FROM bindings WHERE id = 'bnd_1'").get() as { status: string }).status; + expect(JSON.parse(raw).actor).toBe("user"); + expect(() => readAsOldBuild(raw)).not.toThrow(); + expect(readAsOldBuild(raw)).toBeNull(); + }); + + it("leaves a malformed status alone rather than making the migration throw", () => { + const db = legacy(); + insert(db, "bnd_1", "ENG-12", "not json"); + expect(() => { + for (const sql of ACTOR_MIGRATIONS) db.exec(sql); + }).not.toThrow(); + expect((db.prepare("SELECT status FROM bindings WHERE id = 'bnd_1'").get() as { status: string }).status).toBe("not json"); + }); + + it("is appended at the end of MIGRATIONS, so a shipped statement index is never reused", () => { + expect(MIGRATIONS.slice(-ACTOR_MIGRATIONS.length)).toEqual([...ACTOR_MIGRATIONS]); + expect(MIGRATIONS.slice(-(ACTOR_MIGRATIONS.length + APPROVAL_MARKER_MIGRATIONS.length), -ACTOR_MIGRATIONS.length)).toEqual([...APPROVAL_MARKER_MIGRATIONS]); }); }); @@ -504,10 +582,10 @@ describe("the guidance-citation migration (BB-35 step 6)", () => { }); it("is appended at the end of MIGRATIONS, so a shipped statement index is never reused", () => { - expect(MIGRATIONS.slice(-APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...APPROVAL_MARKER_MIGRATIONS]); - expect(MIGRATIONS.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length), -APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...IDLE_MIGRATIONS]); - expect(MIGRATIONS.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length))).toEqual([...GUIDANCE_MIGRATIONS]); - expect(MIGRATIONS.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length + VALIDATION_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length))).toEqual([...VALIDATION_MIGRATIONS]); + expect(beforeActorMigrations.slice(-APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...APPROVAL_MARKER_MIGRATIONS]); + expect(beforeActorMigrations.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length), -APPROVAL_MARKER_MIGRATIONS.length)).toEqual([...IDLE_MIGRATIONS]); + expect(beforeActorMigrations.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length))).toEqual([...GUIDANCE_MIGRATIONS]); + expect(beforeActorMigrations.slice(-(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length + VALIDATION_MIGRATIONS.length), -(APPROVAL_MARKER_MIGRATIONS.length + IDLE_MIGRATIONS.length + GUIDANCE_MIGRATIONS.length))).toEqual([...VALIDATION_MIGRATIONS]); }); }); diff --git a/plugins/stewards/store.ts b/plugins/stewards/store.ts index e73ce9de..cb441aaa 100644 --- a/plugins/stewards/store.ts +++ b/plugins/stewards/store.ts @@ -455,7 +455,21 @@ export const APPROVAL_MARKER_MIGRATIONS = [ `ALTER TABLE project_approvals ADD COLUMN verdict TEXT NOT NULL DEFAULT 'approved'`, ]; -export const MIGRATIONS = [...BASE_MIGRATIONS, ...CHAIN_MIGRATIONS, ...LESSON_COUNTER_MIGRATIONS, ...WORKER_CHECK_MIGRATIONS, ...DECLINED_PR_MIGRATIONS, ...DEPLOYMENT_MIGRATIONS, ...FINISHED_AND_DIGEST_MIGRATIONS, ...LESSON_TIER_MIGRATIONS, ...RATIONALE_MIGRATIONS, ...VALIDATION_MIGRATIONS, ...GUIDANCE_MIGRATIONS, ...IDLE_MIGRATIONS, ...APPROVAL_MARKER_MIGRATIONS]; +// BB-97: the status report's actor `me` is renamed `user`, so all three values +// name a party rather than a pronoun. A stored row keeps its meaning: this +// rewrites `status.actor` from `me` to `user` in place, leaving every other +// field alone. It is idempotent (a second run matches nothing) and guarded with +// `json_valid`/`CASE`, so a malformed status is left untouched rather than +// making the whole migration throw. The previous build parsed `status` with +// `z.enum(["me", "steward", "other"])`, so a migrated `user` row reads back as +// no status there (null), never as an error. +export const ACTOR_MIGRATIONS = [ + `UPDATE bindings + SET status = json_set(status, '$.actor', 'user') + WHERE CASE WHEN json_valid(status) THEN json_extract(status, '$.actor') END = 'me'`, +]; + +export const MIGRATIONS = [...BASE_MIGRATIONS, ...CHAIN_MIGRATIONS, ...LESSON_COUNTER_MIGRATIONS, ...WORKER_CHECK_MIGRATIONS, ...DECLINED_PR_MIGRATIONS, ...DEPLOYMENT_MIGRATIONS, ...FINISHED_AND_DIGEST_MIGRATIONS, ...LESSON_TIER_MIGRATIONS, ...RATIONALE_MIGRATIONS, ...VALIDATION_MIGRATIONS, ...GUIDANCE_MIGRATIONS, ...IDLE_MIGRATIONS, ...APPROVAL_MARKER_MIGRATIONS, ...ACTOR_MIGRATIONS]; // ---- values kept as JSON ------------------------------------------------------------ @@ -480,7 +494,7 @@ export const readyStateSchema = z.object({ }); export type ReadyState = z.infer; -export const ACTORS = ["me", "steward", "other"] as const; +export const ACTORS = ["user", "steward", "other"] as const; export const statusRecordSchema = z.object({ phase: z.string(), @@ -1350,7 +1364,7 @@ export function createStore(db: Database.Database, now: () => number, options: S */ function needsUserFor(b: Binding): boolean { return ( - b.status?.actor === "me" || + b.status?.actor === "user" || openEscalations.all(b.id).length > 0 || needsFor.all(b.id, 0).length > 0 || openQuestions.all(b.projectId).some((q) => q.binding_id === b.id) diff --git a/plugins/stewards/wake.ts b/plugins/stewards/wake.ts index c7887a19..bc1edf1d 100644 --- a/plugins/stewards/wake.ts +++ b/plugins/stewards/wake.ts @@ -37,6 +37,7 @@ const OPEN_REQUESTS_NOTE = "These are listed for the user on the Stewards page. */ export const STANDING_RULES = [ "- **One ask per reply.** Ask the user at most one thing, and only what the playbook, the project's guidance or the `stewards` skill leaves open. Anything they settle — models, flags, lanes, who merges — is never asked.", + "- **`steward_report`'s `actor` names who acts next.** `user` is the server's owner and means they have to act; `steward` is you, including your own next step such as re-checking on the next deployment wake (BB-95 filed that re-check as `me` and the row wrongly read \"needs you\"); `other` is someone else.", `- **What only the user can do is an escalation, not a need.** A credential, a step outside the repos, or a decision — ${ESCALATED_NEED_KINDS.map((k) => `\`${k}\``).join(", ")} — is raised with \`steward_report { escalate: { kind, question, context, meanwhile } }\`: the question is one line, as the sidebar row shows it, and the evidence and reasoning go in \`context\` (a longer question is refused). The project steward decides it or forwards it to the user. Since BB-30 \`steward_report { needs }\` refuses exactly those ("that is an escalation now"); it still takes the plugin's gate items (${STEWARD_NEED_KINDS.map((k) => `\`${k}\``).join(", ")}). A decision that is really a pick between fixed options carries \`choices\` (2-6 short labels, e.g. \`choices: ["Merge", "Close", "Verify first"]\`), and the page shows one button each; never write "reply with your choice" in prose.`, "- **A credential is a decision escalation, and the project steward forwards it as a secret.** Raise it with `steward_report { escalate: { kind: \"decision\", question, context, meanwhile } }`, naming the variable and what it is for in `context`. The project steward forwards it with `resolution: \"secret\"` and either `writeEnv`/`worker` (the dotenv a worker reads) or `setting` (a declared secret setting of the stewards plugin); the plugin then spawns a requester thread and opens bb's secure form there. Never paste a secret, and never route the user to a script to run.", "- **A finding that would stop the feature working once it ships**, or that changes what the ticket needs (a credential, an access, a contract), is escalated as a `decision` in the same turn, quoting the worker's words — never relayed as a follow-up. An escalation that asks the user to pick between fixed options carries `choices` (2-6 short labels) so the page shows one button each.", @@ -855,7 +856,7 @@ export function formatSentryWake(input: SentryWakeInput): string { out.push( `**The plugin has no Sentry token, so it cannot read this project.** The token is the \`${TOKEN_SETTING}\` setting of the stewards plugin on this bb server (Settings → Plugins → Stewards), entered by the user, never pasted into a thread. ` + `Raise one escalation for it with steward_report { escalate: { kind: "decision", question: "Provide a Sentry auth token for ${look.target}", context: "variable SENTRY_TOKEN, setting ${TOKEN_SETTING}, url ${TOKEN_PAGE}; create it with the scopes ${TOKEN_SCOPES.join(" and ")} and enter it as the stewards plugin's Sentry token setting.", meanwhile: "Wait: this project cannot be read until the token is provided." } }. The project steward forwards it with resolution "secret", variable "SENTRY_TOKEN" and setting "${TOKEN_SETTING}", and the plugin opens bb's secure form. ` + - "Then report with actor me and end the turn; the first look that reads the project wakes you.", + "Then report with actor user and end the turn; the first look that reads the project wakes you.", ); } else if (look.error !== null) out.push(`The project could not be read: ${look.error}. Nothing to do until it can; \`bb stewards check\` says why.`); else {