Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(health): only seats that are around count; no run floods [A6,N2]
Corey Olson372e27d5e853
diff --git a/docs/formats.md b/docs/formats.mdindex eb320cdc..b37b18da 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -113,7 +113,7 @@ The board file is in the repository's Git common directory at `.git/pullboard/bo| `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. || `board schema` | `2` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | Create missing tables and indexes, add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. || `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |-| `move engine` | `60` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |+| `move engine` | `61` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |<!-- format-versions:end -->Pullboard 0.6.1 released engine 1. Engine 2 records a fresh explicit-build claim's skipped-review snapshot. Pullboard 0.8.1 released engine 3, including lane-sensitive graft refusals and authenticated relay senders. Engine 4 adds captured background-baseline completions through `completeCheckBaseline`; released engine-3 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Engine 5 requires a one-line reason when releasing a review and gives that reviewer a one-hour cooldown for the current submission. Each sealed move replays under its recorded engine version: engines 1 through 4 retain the original release event and review-reservation behavior. Engine 5 retains support for older moves, including engine-4 baseline completions. Pullboard 0.8.3 released engine 6, adding board-scoped machine credentials and permitting machine execution only for one exact, earlier authenticated phone request, including its payload digest. Engine 7 adds ordered item holds through `holdItem` and `releaseItemHold`; engine-6 clients stop with `ENGINE_VERSION` before interpreting either operation or advancing their replay cursor. Engine 8, shared by the 0.8.5 move changes, retains merged-item exception notes, selects the next review in roadmap order, and adds coordinator-only `reopen` for a submission returned without a verdict; engine-7 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Recorded engines 1 through 7 retain their original tier-first review selection. Engine 8 also adds durable refusal recovery for blocked relay positions; each explicit skip publishes the readable prefix even when another unsupported record follows. Engine 8 also permits coordinator criterion/check edits on a live claim as pending corrections; the holder cannot renew or submit until a refreeze adopts the correction while preserving the claim. Older request receipts retain their recorded engine semantics. Upgrade every linked device before using the new moves. Each release shares one engine bump across its changed moves. Engine 8 also retains declared model labels on registration and records each registered agent move's model snapshot; engines 1 through 7 retain their original registration and event details without these model fields. Pullboard 0.8.8 released engine 9, which allows resubmitting the same rejected commit after a corrected criterion is refrozen, but only when the rejection names a different frozen digest. Engine 8 retains its HEAD_NOT_NEW refusal and prior submit-event detail. Engine-9 submit events add `criterionDigest`, and engine-8 boards replay with the original refusal and event history.@@ -154,6 +154,8 @@ Engine 56 (`BOARD_SENTINEL_ENGINE`) adds board-owned watch proposals, exact persEngine 60 (`SUBMITTED_CONFLICT_ENGINE`) lets a conflict reopen return a submitted head, not only an accepted one, and lets any joined seat record it. Before it offers a review, `pullboard next --verify` merges every submitted head onto the trunk in memory, as landing does; a head that conflicts goes back to its builder, open and unreviewed, with Git's conflicting files and the trunk commit, and its builder is told which files and that the one step back is to claim it, merge main and submit again. The reopen sets no accept aside and records no verdict; its next review is a whole one. A hand-written `--conflict` on a submission, which names no trunk commit, is still refused. Engines 57 to 59 are allocated to other changes; older engines refuse this move before replay.+Engine 61 (`HEALTH_CAP_ENGINE`, pending the coordinator's allocation) caps what one recorded health run shouts. A run sends at most ten notices one by one, resolved first; when it has more, one more notice to the coordinator says how many it held back, and every finding still records its own health event. An idle seat alone hears that it is idle. A recorded run at an older engine replays with its original notices.+The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 48 after issuing any agent token or machine credential, includingrevoked or expired ones; before engine 48 these minimums were 3 and 6. The minimum survives reopening the auth database;diff --git a/src/board.js b/src/board.jsindex 927af01f..637b5381 100644--- a/src/board.js+++ b/src/board.js@@ -78,8 +78,9 @@ import {} from './trunk-conflict.js';import {HEALTH_SENTINEL_ENGINE,+ deliverHealthNotices,healthFindingIdentity,- healthFindingNotice,+ healthTargets,normalizedHealthFindings,} from './health-receipts.js';import { factReference } from './fact-reference.js';@@ -1964,20 +1965,17 @@ export function recordHealthFindings(board, { agentId, observedRevision, findingif (!added.length && !resolved.length) return { added: [], resolved: [] };const agents = listAgents(board);const lanes = [...new Set(agents.map(agent => agent.agent_lane))];+ const engine = board.executionEngineVersion ?? ENGINE_VERSION;/** Deliver through ordinary feed/inbox records without registering a synthetic worktree seat. */- const notify = (finding, cleared) => {- const owner = finding.owner;- const targets = new Set([COORDINATOR]);- if (owner && (owner === PERSON || lanes.includes(owner) || agents.some(agent => agent.agent_id === owner))) targets.add(owner);- for (const to of targets) insertShout(board, { from: 'sentinel', to, text: healthFindingNotice(finding, cleared), lanes });+ const log = (finding, cleared) => {const item = finding.item === null ? null : itemById(board, finding.item);logEvent(board, 'sentinel', cleared ? 'health-resolved' : 'health-failure', finding.item, {key: finding.key, cause: `refusal:${finding.cause}`, since: finding.since, subject: finding.subject,- owner, commit: item?.item_commit ?? null, engine: HEALTH_SENTINEL_ENGINE,+ owner: finding.owner, commit: item?.item_commit ?? null, engine: HEALTH_SENTINEL_ENGINE,});};- for (const finding of resolved) notify(finding, true);- for (const finding of added) notify(finding, false);+ deliverHealthNotices({ resolved, added, engine, log, coordinator: COORDINATOR, shout: (to, text) => insertShout(board, { from: 'sentinel', to, text, lanes }),+ targets: finding => healthTargets(finding, { engine, coordinator: COORDINATOR, person: PERSON, lanes, agents }) });logEvent(board, agentId, 'health-scan', null, { active, engine: HEALTH_SENTINEL_ENGINE });return { added: added.map(finding => finding.key), resolved: resolved.map(finding => finding.key) };});diff --git a/src/health-receipts.js b/src/health-receipts.jsindex e45758e8..291ae50b 100644--- a/src/health-receipts.js+++ b/src/health-receipts.js@@ -4,6 +4,15 @@ import { Refused } from './refused.js';/** The allocated engine for ordered sentinel observations; earlier moves keep their meaning. */export const HEALTH_SENTINEL_ENGINE = 42;+/**+ * The engine from which one health run shouts at most HEALTH_SHOUT_CAP notices, naming the rest in one more, and an+ * idle seat alone hears that it is idle (#940). Earlier recorded runs replay with their original shouts.+ */+export const HEALTH_CAP_ENGINE = 61;++/** The most stuck or resolved notices one health run shouts one by one (#940). */+export const HEALTH_SHOUT_CAP = 10;+/** Validate and retain only the fields needed to identify and explain a health finding. */export function normalizedHealthFindings(findings) {if (!Array.isArray(findings) || findings.length > 10_000) {@@ -36,3 +45,41 @@ export function healthFindingIdentity(finding) {export function healthFindingNotice(finding, resolved = false) {return `${resolved ? 'Resolved' : 'Stuck'}: ${finding.subject} ${finding.title} [${finding.cause}], since ${finding.since}. ${finding.why}. ${finding.owner ? `Owner: ${finding.owner}. ` : ''}Next: ${finding.next}.`;}++/**+ * Who hears a finding: the coordinator, and its owner when the owner is a known address. From HEALTH_CAP_ENGINE an+ * idle seat alone hears that it is idle, so a board of quiet seats never fills the coordinator's feed (#940).+ *+ * @param {{ cause: string, owner: string|null }} finding+ * @param {{ engine: number, coordinator: string, person: string, lanes: string[], agents: { agent_id: string }[] }} context+ * @returns {string[]}+ */+export function healthTargets(finding, { engine, coordinator, person, lanes, agents }) {+ const known = (who) => who === person || lanes.includes(who) || agents.some((agent) => agent.agent_id === who);+ const owner = finding.owner && known(finding.owner) ? finding.owner : null;+ if (engine >= HEALTH_CAP_ENGINE && finding.cause === 'IDLE_AGENT' && owner) return [owner];+ return [...new Set([coordinator, ...(owner ? [owner] : [])])];+}++/**+ * Deliver one run's notices, resolved first: each finding's shouts, then its event, as earlier engines recorded them.+ * Every finding keeps its event. From HEALTH_CAP_ENGINE the run sends at most HEALTH_SHOUT_CAP shouts and one more to+ * the coordinator saying how many it held back, so a backfill never floods a feed (#940).+ *+ * @param {{ resolved: any[], added: any[], engine: number, coordinator: string, targets: (finding: any) => string[],+ * shout: (to: string, text: string) => void, log: (finding: any, cleared: boolean) => void }} run+ */+export function deliverHealthNotices({ resolved, added, engine, coordinator, targets, shout, log }) {+ const capped = engine >= HEALTH_CAP_ENGINE;+ let sent = 0;+ let held = 0;+ for (const [finding, cleared] of [...resolved.map((entry) => [entry, true]), ...added.map((entry) => [entry, false])]) {+ for (const to of targets(finding)) {+ if (capped && sent >= HEALTH_SHOUT_CAP) { held += 1; continue; }+ shout(to, healthFindingNotice(finding, cleared));+ sent += 1;+ }+ log(finding, cleared);+ }+ if (held) shout(coordinator, `Health: ${held} more notices from this run were held back, so one run never floods a feed; pullboard health lists every finding.`);+}diff --git a/src/health.js b/src/health.jsindex 73a5449a..4e84f241 100644--- a/src/health.js+++ b/src/health.js@@ -6,6 +6,7 @@* It reads the board through a read-only SQLite connection and asks git only questions that leave* every checkout alone: merge-tree writes a tree object and never an index or a working tree.*/+import { execFileSync } from 'node:child_process';import { existsSync } from 'node:fs';import {COORDINATOR,@@ -243,7 +244,8 @@ export function healthReport({ db, root, config, now }) {}));}- for (const fault of queueFaults(board, { items, at })) report.stuck.push(fault);+ report.retired = [];+ for (const fault of queueFaults(board, { items, at, retired: report.retired, gone: goneWorktrees(root) })) report.stuck.push(fault);const overdue = releaseOverdue(db, root, at, limits.ms.release, history);if (overdue) found(report.stuck, overdue);@@ -261,10 +263,11 @@ const QUEUE_ACTIVE_MS = 30 * 60_000;* names the item and the next step; an agent that is idle is named as its own owner.** @param {{ db: any, clock: { now: () => Date } }} board- * @param {{ items: any[], at: number }} context - the board's items and the clock in epoch milliseconds+ * @param {{ items: any[], at: number, retired?: any[], gone?: Set<string> }} context - the board's items, the clock in epoch milliseconds,+ * the list that collects retired seats, and the worktree paths Git reports gone* @returns {Finding[]}*/-function queueFaults(board, { items, at }) {+function queueFaults(board, { items, at, retired = [], gone = new Set() }) {const queue = workQueue(board);const current = (queue.releases.find((release) => release.landed < release.total)?.items ?? queue.unreleased).filter((entry) => entry.status === 'open' && !entry.waits.length);@@ -272,23 +275,31 @@ function queueFaults(board, { items, at }) {.filter((entry) => entry.status === 'open' && !entry.waits.length);const rows = board.db.prepare(`SELECT agent_id AS id, agent_lane AS lane, agent_route AS route, agent_path AS path, agent_created_at AS created,(SELECT MAX(event_at) FROM event WHERE event_by = agent.agent_id) AS event_at,+ (SELECT MAX(event_at) FROM event WHERE event_by = agent.agent_id AND event_kind IN ('claim', 'renew', 'reserve')) AS pulled_at,(SELECT MAX(shout_at) FROM shout WHERE shout_from = agent.agent_id) AS shout_atFROM agent ORDER BY agent_id`).all();+ // Only a seat whose agent is around counts (#940): a live lease, or a move or shout in the last 30 minutes, and not+ // a worktree Git reports gone. Every other seat is retired for these checks: listed once, never a finding.const agents = rows.filter((row) => row.lane !== 'coordinator').map((row) => {const last = Math.max(...[row.created, row.event_at, row.shout_at].filter(Boolean).map((value) => Date.parse(value)));- const holds = items.some((item) => (item.item_status === 'claimed' && item.item_owner === row.id)- || (item.item_status === 'submitted' && item.item_built_by === row.id)+ const lease = items.some((item) => (item.item_status === 'claimed' && item.item_owner === row.id && Date.parse(item.item_lease_until ?? '') > at)|| (item.item_review_by === row.id && Date.parse(item.item_review_until ?? '') > at));- return { ...row, last, active: holds || at - last < QUEUE_ACTIVE_MS };+ const awaitsReview = items.some((item) => item.item_status === 'submitted' && item.item_built_by === row.id);+ const recent = !gone.has(row.path) && (lease || at - last < QUEUE_ACTIVE_MS);+ const pulled = Math.max(...[row.created, row.pulled_at].filter(Boolean).map((value) => Date.parse(value)));+ return { ...row, last, recent, idle: recent && !lease && !awaitsReview && at - pulled >= QUEUE_ACTIVE_MS };});- const active = agents.filter((agent) => agent.active);+ const active = agents.filter((agent) => agent.recent);+ retired.push(...agents.filter((agent) => !agent.recent).map((agent) => ({ agent: agent.id, lane: agent.lane, since: new Date(agent.last).toISOString() })));const raw = new Map(items.map((item) => [item.item_id, item]));+ // An item whose claim lapsed is CLAIM_LAPSED's to report; it never doubles as untakeable work (#940).+ const lapsed = (entry) => raw.get(entry.id)?.item_status === 'claimed';const since = (id) => raw.get(id)?.item_updated_at ?? new Date(at).toISOString();const now = at;const findings = [];for (const route of ROUTES) {- const open = current.filter((entry) => entry.route === route);+ const open = current.filter((entry) => entry.route === route && !lapsed(entry));if (!open.length || active.some((agent) => canTake(agent.route, route))) continue;const first = open[0];findings.push(finding('ROUTE_UNSERVED', null, {@@ -301,7 +312,7 @@ function queueFaults(board, { items, at }) {}));}- for (const entry of waiting) {+ for (const entry of waiting.filter((candidate) => !lapsed(candidate))) {if (active.some((agent) => agent.lane === entry.lane && canTake(agent.route, entry.route))) continue;findings.push(finding('ITEM_UNTAKEABLE', raw.get(entry.id) ?? null, {subject: `#${entry.id}`, key: `ITEM_UNTAKEABLE:item:${entry.id}`, since: since(entry.id), now,@@ -313,7 +324,7 @@ function queueFaults(board, { items, at }) {}));}- for (const agent of agents.filter((candidate) => !candidate.active)) {+ for (const agent of agents.filter((candidate) => candidate.idle)) {const work = waiting.find((entry) => entry.lane === agent.lane && canTake(agent.route, entry.route));if (!work) continue;findings.push(finding('IDLE_AGENT', null, {@@ -567,9 +578,25 @@ export function healthLines(report) {if (!report.stuck.length) lines.push('nothing is stuck');else lines.push(`${report.stuck.length} stuck:`, ...report.stuck.map((entry) => ` ${line(entry)}`));if (report.waiting.length) lines.push('waiting for a later release:', ...report.waiting.map((entry) => ` ${line(entry)}`));+ // Seats with nobody behind them get one line, never a finding or a shout (#940).+ if (report.retired?.length) lines.push(`retired seats, not counted as agents (quiet for 30 minutes or more, or their worktree is gone): ${report.retired.map((seat) => seat.agent).join(', ')}`);return lines;}+/**+ * The worktrees of this repository whose folders are gone, as Git reports them (prunable). A path Git never+ * registered here, such as a seat on another computer, is not judged gone by this (#940).+ *+ * @param {string} root+ * @returns {Set<string>}+ */+function goneWorktrees(root) {+ try {+ const listing = execFileSync('git', ['worktree', 'list', '--porcelain'], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });+ return new Set(listing.split('\n\n').filter((block) => /^prunable\b/mu.test(block)).map((block) => /^worktree (.+)$/mu.exec(block)?.[1]).filter(Boolean));+ } catch { return new Set(); }+}+/** End a reason with one full stop, keeping a clipped reason's ellipsis. */function sentence(text) {const trimmed = text.replace(/[.\s]+$/u, '');diff --git a/src/machine.js b/src/machine.jsindex 96cde24f..a5b885ff 100644--- a/src/machine.js+++ b/src/machine.js@@ -10,6 +10,7 @@*/import { RIGOR_NOTICE_ENGINE } from './rigor-source.js';+import { HEALTH_CAP_ENGINE } from './health-receipts.js';/** First writer for withdraw-and-remove milestone behavior; shipment remains engine 45. */export const WITHDRAW_MILESTONE_ENGINE = 51;@@ -31,6 +32,7 @@ export const STRONG_REJECTION_NOTICE_ENGINE = 54;export const SUBMITTED_CONFLICT_ENGINE = 60;export const ENGINE_VERSION = Math.max(+ HEALTH_CAP_ENGINE,SUBMITTED_CONFLICT_ENGINE,ROW_DRAFT_ENGINE,AUTO_ESCALATE_ENGINE,diff --git a/test/health-sentinel.test.js b/test/health-sentinel.test.jsindex d7915ec2..014f1fdd 100644--- a/test/health-sentinel.test.js+++ b/test/health-sentinel.test.js@@ -111,10 +111,12 @@ test('an idle seat beside work it could take is noticed once and resolves when iconst id = box.claimed(0);const idle = box.seat(1);box.clock.offset += 2 * HOUR;+ // The idle seat's agent is around (it shouted just now) but holds and pulls nothing (#940).+ store.shout(box.board, { from: idle, to: 'coordinator', text: 'still here', lanes: ['core'] });const idleKey = `IDLE_AGENT:agent:${idle}`;assert.deepEqual(box.scan().added.sort(), [`CLAIM_LAPSED:item:${id}`, idleKey].sort());const idleNotices = store.allShouts(box.board).filter(notice => notice.shout_text.includes('IDLE_AGENT'));- assert.deepEqual(idleNotices.map(notice => notice.shout_to).sort(), ['coordinator', idle].sort(), 'the idle seat and the coordinator each hear it once');+ assert.deepEqual(idleNotices.map(notice => notice.shout_to), [idle], 'the idle seat alone hears it, once (#940); the coordinator sees it in pullboard health');const before = exportBoard(box.board);for (let index = 0; index < 3; index += 1) assert.equal(box.scan(), null);assert.deepEqual(exportBoard(box.board), before, 'a persisting idle seat creates no repeated events or shouts');diff --git a/test/health.test.js b/test/health.test.jsindex 3365df20..db698b0e 100644--- a/test/health.test.js+++ b/test/health.test.js@@ -14,6 +14,8 @@ import { pathToFileURL } from 'node:url';import * as store from '../src/board.js';import { main } from '../src/cli.js';import { boardHealth } from '../src/health.js';+import { scanHealthSentinel } from '../src/health-sentinel.js';+import { loadConfig } from '../src/config.js';import { gateRuns } from '../src/gate-control.js';import { JSON_SHAPES } from '../src/json.js';import { runFixtureChild, runFixtureGit } from './fixture-child.js';@@ -276,7 +278,9 @@ test('health on a healthy board says nothing is stuck [A6]', async (t) => {assert.equal(healthy.code, 0, healthy.stdout);const report = JSON.parse(healthy.stdout);assert.deepEqual(report.stuck, [], `a moving board has nothing stuck: ${report.stuck.map((entry) => entry.key).join(', ')}`);- assert.equal((await cli(box.root, ['health'])).stdout, 'nothing is stuck\n');+ // Seats with no worktree or recent activity are listed once as retired, never as stuck (#940).+ const retired = report.retired.map((seat) => seat.agent).join(', ');+ assert.equal((await cli(box.root, ['health'])).stdout, `nothing is stuck\n${retired ? `retired seats, not counted as agents (quiet for 30 minutes or more, or their worktree is gone): ${retired}\n` : ''}`);assert.deepEqual(boardDigest(box.file), before, 'health changes nothing on a healthy board');});@@ -391,8 +395,11 @@ test('every printed next step runs as pasted through main() [N2,B13]', async (t)store.register(board, { lane: 'coordinator', path: box.root });const idlePath = join(box.dir, 'core-idle');box.git(['worktree', 'add', '-q', idlePath, '-b', 'core-idle']);- const idle = store.register(board, { lane: 'core', route: 'strong', path: idlePath });+ // A mid seat that is around can serve mid work but not the strong item, so every kind of finding appears (#940).+ const idle = store.register(board, { lane: 'core', route: 'mid', path: idlePath });at(HOUR / 12);+ // The idle seat's agent is around (it shouted five minutes ago) but has pulled nothing for 40 hours (#940).+ store.shout(board, { from: idle, to: 'coordinator', text: 'still here', lanes: ['core'] });const holderPath = join(box.dir, 'core-holder');box.git(['worktree', 'add', '-q', holderPath, '-b', 'core-holder']);const holder = store.register(board, { lane: 'core', route: 'mid', path: holderPath });@@ -486,3 +493,49 @@ test('a positive control inherits the gate slot it runs under [C7,D1]', async (tassert.ok(run.controlLog && existsSync(run.controlLog), 'the control keeps its raw output in the gate evidence');assert.ok(run.controlProfile && existsSync(run.controlProfile), 'the control keeps its timing profile in the gate evidence');});++/** A board with `gone` seats quiet for three days and `live` seats that shouted five minutes ago beside open core work. */+function seatedBoard(t, { gone, live }) {+ const box = repo(t);+ const { board, at } = boardAt(box);+ at(72 * HOUR);+ store.register(board, { lane: 'coordinator', path: box.root });+ for (let n = 0; n < gone; n += 1) store.register(board, { lane: 'core', path: join(box.dir, `gone-${n}`) });+ const seats = Array.from({ length: live }, (_, n) => {+ const path = join(box.dir, `live-${n}`);+ mkdirSync(path);+ return store.register(board, { lane: 'core', path });+ });+ store.addItem(board, { by: 'coordinator', lane: 'core', title: 'Open core work', criterion: 'The work is done when its test passes.' });+ at(5 * 60_000);+ for (const seat of seats) store.shout(board, { from: seat, to: 'coordinator', text: 'still here', lanes: ['core'] });+ at(0);+ /** Run one real sentinel scan and record it, returning the sentinel's shouts. */+ const scan = () => {+ store.recordHealthFindings(board, { agentId: 'coordinator', ...scanHealthSentinel(box.file, { root: box.root, config: loadConfig(box.root), now: new Date(NOW) }) });+ return store.allShouts(board).filter((notice) => notice.shout_from === 'sentinel');+ };+ t.after(() => store.closeBoard(board));+ return { box, board, seats, scan };+}++test('health never reports a long-gone seat as an idle agent [A6,N2]', async (t) => {+ const { box, seats: [active], scan } = seatedBoard(t, { gone: 500, live: 1 });+ const shouts = scan();+ assert.ok(shouts.length <= 1, `at most one shout, for the active seat: ${shouts.map((notice) => notice.shout_text.slice(0, 80)).join(' | ')}`);+ assert.ok(shouts.every((notice) => notice.shout_to === active && notice.shout_text.includes(`${active} idle beside work it could take`)), 'the one shout is the active seat hearing it is idle');+ const report = JSON.parse((await cli(box.root, ['health', '--json'])).stdout);+ assert.deepEqual(report.stuck.filter((entry) => entry.cause === 'IDLE_AGENT').map((entry) => entry.subject), [active], 'only the active seat is an idle agent');+ assert.equal(report.retired.length, 500, 'the quiet seats are listed once as retired');+ const text = await cli(box.root, ['health']);+ assert.equal(text.stdout.split('\n').filter((line) => line.startsWith('retired seats')).length, 1, 'retired seats get one line');+});++test('one health run sends at most ten stuck shouts and names how many it held back [A6,N2]', (t) => {+ const { seats, scan } = seatedBoard(t, { gone: 0, live: 12 });+ const shouts = scan();+ assert.equal(shouts.length, 11, 'ten notices and one that names the rest');+ assert.match(shouts.at(-1).shout_text, /^Health: 2 more notices from this run were held back/u);+ assert.equal(shouts.at(-1).shout_to, 'coordinator');+ assert.equal(seats.length, 12);+});