Public: anyone can read this; the crew can change it.
Sentinel: The lane has stopped: nothing has merged and nothing said so #14298
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14263-sentinel-the-lane-has-stopped-nothing-ha → main 1 commit fork 1 thread · 1 unresolved
3 files
changed +89
−5
docs/features/lane-stopped.md +1 −1
| @@ -5,6 +5,6 @@ On 2026-11-12 nothing merged for 12 h 51 min and nothing said so: every check wa | ||
| 5 | 5 | - **The lane has stopped:** pulls are open (or work is ready), the crew is not at its ceiling, and no pull has merged for 90 minutes. Change the limit with the `flow.lane_minutes` row of `forge_setting` (a whole number, 1 to 10080; anything else is 90). It names how long, how many checks failed since the last merge and the commonest failure line verbatim. |
| 6 | 6 | - **One cause failing many pulls:** the same failure line (numbers masked) failed checks on five different pulls within an hour and since the last merge. The line is the first line of a check's summary, for a check that named no failing test; a named test is `src/checks/shared_red.ts`'s. /flow says it is the forge's failure; `check_failed` is not sent to builders for it (`waitOnMain` in `src/crew/dispatch.ts`) and the stale-red sweep neither parks nor reworks its pulls, only checks them again. |
| 7 | 7 | |
| 8 | It is an ask for the owner and one Sentinel issue (`src/crew/sentinel_lane.ts`), closed at the next hunt after a pull merges and the cause is gone, unless a person commented on it. `land_past_gate` does not open for it: the break-glass rests on red gates only (`landingStopped` in `src/checks/gate_stopped.ts`), since a merge drought with pulls waiting on review is not a red gate. | |
| 8 | It is an ask for the owner and one Sentinel issue (`src/crew/sentinel_lane.ts`), closed at the next hunt after a pull merges and the cause is gone, unless a person commented on it. The forge's own notes under the owner's name (a park note, live triage, first look) are no one's word and do not hold it open (`src/crew/person_spoke.ts`, #14263). `land_past_gate` does not open for it: the break-glass rests on red gates only (`landingStopped` in `src/checks/gate_stopped.ts`), since a merge drought with pulls waiting on review is not a red gate. | |
| 9 | 9 | |
| 10 | 10 | Left out: the Sentinel issue's evidence carries the failure count, so it is commented again as that count moves. |
src/crew/person_spoke.ts +15 −4
| @@ -1,13 +1,24 @@ | ||
| 1 | /** Whether a person, not an agent, has commented on an issue: then they decide, not the sentinel. */ | |
| 1 | /** | |
| 2 | * Whether a person, not an agent, has commented on an issue: then they decide, | |
| 3 | * not the sentinel. The forge's own notes carry the owner's name but are no | |
| 4 | * one's word (#14263): a park note, or a note that says it is automatic (live | |
| 5 | * triage, first look). Counting them kept a Sentinel issue open after the lane | |
| 6 | * had moved, since the crew parks and triages under the owner's account. | |
| 7 | */ | |
| 2 | 8 | |
| 3 | 9 | import type { Database } from "bun:sqlite"; |
| 10 | import { PARK_LIKE } from "../core/done_on_main.ts"; | |
| 11 | ||
| 12 | /** What every automatic note says after its lead (`crew/livetriage.ts`, `crew/first_look.ts`). */ | |
| 13 | export const AUTOMATIC_MARK = " (automatic, not written by a person):"; | |
| 4 | 14 | |
| 5 | 15 | export function personSpoke(db: Database, issueId: string): boolean { |
| 6 | 16 | const spoke = db |
| 7 | .query<{ n: number }, [string]>( | |
| 17 | .query<{ n: number }, [string, string, string]>( | |
| 8 | 18 | `SELECT COUNT(*) AS n FROM comment c JOIN user u ON u.id = c.author_id |
| 9 | WHERE c.issue_id = ?1 AND u.is_agent = 0 AND u.kind = 'user'`, | |
| 19 | WHERE c.issue_id = ?1 AND u.is_agent = 0 AND u.kind = 'user' | |
| 20 | AND c.body NOT LIKE ?2 AND instr(c.body, ?3) = 0`, | |
| 10 | 21 | ) |
| 11 | .get(issueId); | |
| 22 | .get(issueId, PARK_LIKE, AUTOMATIC_MARK); | |
| 12 | 23 | return spoke !== null && spoke.n > 0; |
| 13 | 24 | } |
test/person-spoke.test.ts added +73
| @@ -0,0 +1,73 @@ | ||
| 1 | // The forge's own notes under the owner's name are no one's word (#14263): a | |
| 2 | // Sentinel issue the crew parked or triaged still closes when the lane moves. | |
| 3 | ||
| 4 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; | |
| 5 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 6 | import { tmpdir } from "node:os"; | |
| 7 | import { join } from "node:path"; | |
| 8 | import { createApp, type App } from "../src/app.ts"; | |
| 9 | import { createRepo } from "../src/actions/repos.ts"; | |
| 10 | import { addComment, createIssue } from "../src/core/issues.ts"; | |
| 11 | import { createUser, type User } from "../src/core/users.ts"; | |
| 12 | import { FILED_NOTE } from "../src/crew/livetriage.ts"; | |
| 13 | import { LOOK_NOTE } from "../src/crew/first_look.ts"; | |
| 14 | import { PARK_NOTE } from "../src/crew/parks.ts"; | |
| 15 | import { personSpoke } from "../src/crew/person_spoke.ts"; | |
| 16 | ||
| 17 | let dataDir: string; | |
| 18 | let app: App; | |
| 19 | let owner: User; | |
| 20 | let repoId: string; | |
| 21 | ||
| 22 | beforeAll(async () => { | |
| 23 | dataDir = await mkdtemp(join(tmpdir(), "forge-person-spoke-")); | |
| 24 | app = createApp({ dataDir, port: 0 }); | |
| 25 | const u = await createUser(app.db, { | |
| 26 | origin: "seed", | |
| 27 | trusted: true, | |
| 28 | username: "alice", | |
| 29 | email: "[email protected]", | |
| 30 | password: "a-good-passphrase", | |
| 31 | adminIfFirst: true, | |
| 32 | }); | |
| 33 | if (!u.ok) throw new Error(u.error); | |
| 34 | owner = u.value; | |
| 35 | const made = await createRepo(app, owner, { name: "forge", visibility: "private" }); | |
| 36 | if (!made.ok) throw new Error(String(made.error)); | |
| 37 | repoId = made.value.id; | |
| 38 | }); | |
| 39 | ||
| 40 | afterAll(async () => { | |
| 41 | app.db.close(); | |
| 42 | await rm(dataDir, { recursive: true, force: true }); | |
| 43 | }); | |
| 44 | ||
| 45 | function issueWith(...bodies: string[]): string { | |
| 46 | const made = createIssue(app.db, { repoId, authorId: owner.id, title: "Sentinel: the lane has stopped" }); | |
| 47 | if (!made.ok) throw new Error(made.error); | |
| 48 | for (const body of bodies) { | |
| 49 | const c = addComment(app.db, { issueId: made.value.id, authorId: owner.id, body }); | |
| 50 | if (!c.ok) throw new Error(c.error); | |
| 51 | } | |
| 52 | return made.value.id; | |
| 53 | } | |
| 54 | ||
| 55 | describe("personSpoke", () => { | |
| 56 | test("no comment is no word", () => { | |
| 57 | expect(personSpoke(app.db, issueWith())).toBe(false); | |
| 58 | }); | |
| 59 | ||
| 60 | test("park notes and automatic notes under the owner's name are no one's word", () => { | |
| 61 | const id = issueWith( | |
| 62 | `${FILED_NOTE} filed under P0 Trust, which it names.`, | |
| 63 | `${PARK_NOTE}the run ended without a pull: declined: nothing to fix.`, | |
| 64 | `${LOOK_NOTE} looks like a duplicate of #12.`, | |
| 65 | ); | |
| 66 | expect(personSpoke(app.db, id)).toBe(false); | |
| 67 | }); | |
| 68 | ||
| 69 | test("the owner's own words still hold the issue for them", () => { | |
| 70 | const id = issueWith(`${FILED_NOTE} filed under P0 Trust.`, "Leave this open, I want to look at the checks."); | |
| 71 | expect(personSpoke(app.db, id)).toBe(true); | |
| 72 | }); | |
| 73 | }); |
new above
offline
instr(c.body, mark) = 0skips any comment containing the mark anywhere, including a person quoting a note. Other park queries pair the lead withBY_CREW; consider the same here, or match the lead notes as prefixes.