Skip to content

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.

feat(health): a recurring job's missed cadence is a finding [D1,C7]

Corey Olsonf942b8227872
diff --git a/docs/api.md b/docs/api.md
index 58583429..71ea6606 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -175,6 +175,9 @@ For example: `flow: review wait average 61 min (1 measured; > 60 min); bottlenec
| `sentinel approve` | `version:number`, `sentinel:object` |
| `sentinel decline` | `version:number`, `sentinel:object` |
| `sentinels` | `version:number`, `sentinels:array` |
+| `loop` | `version:number`, `jobs:array` |
+| `loop declare` | `version:number`, `job:object` |
+| `loop ran` | `version:number`, `job:object` |
<!-- api-command-shapes:end -->
`spec draft "<rule>" --doctrine --source "chat, 2026-10-16"` proposes a sourced doctrine row and returns a qualified `id`, such as `doctrine:DR1`, for the existing person approval commands. Resume adds `doctrineNotes`, an array of newly seen approved rules with `id`, `text` and `gate`; each checkout consumes its own notices. Drafts and pending applications are excluded. The shared approved doctrine also supplies frozen citations and stale-item comparisons in older checkouts.
diff --git a/src/board.js b/src/board.js
index 31a46e2b..99b7ca6f 100644
--- a/src/board.js
+++ b/src/board.js
@@ -111,6 +111,7 @@ import { submissionProof } from './submit-invariants.js';
import { SUBMISSION_PROOF_ENGINE } from './submit-invariants.js';
export { landingFlakes, landingWaiverCovers, landingWaiverKind };
export { acceptCheck } from './check-accept.js';
+export { declareJob, recordJobRun } from './recurring-jobs.js';
export { proposeSentinel, decideSentinel, beginSentinelRun, finishSentinelRun } from './sentinels.js';
export { flakeLedger, recordFlakeObservation } from './flakes.js';
diff --git a/src/cli.js b/src/cli.js
index a3cf7436..314fb119 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -363,6 +363,7 @@ import { watchCommand } from './watch.js';
import { serveMcp } from './mcp.js';
import { scanHealthSentinel } from './health-sentinel.js';
import { SENTINEL_OPTIONS } from './sentinel-command.js';
+import { loopCommand } from './loop-command.js';
import { resumeSentinels } from './sentinel-command.js';
import { sentinelCommand } from './sentinel-command.js';
import { sentinelListCommand } from './sentinel-command.js';
@@ -4353,6 +4354,7 @@ async function runCommand(argv, io) {
throw new Refused('USAGE', '--as person works only with pullboard answer, decisions, or fact --never-again');
}
if (command === 'sentinel') return await sentinelCommand({ ctx: context(io), words: [first, second, ...rest].filter(value => value !== undefined), values, withBoard, whoAmI, ordered });
+ if (command === 'loop') return await loopCommand({ ctx: context(io), words: [first, second, ...rest].filter(value => value !== undefined), values, withBoard, whoAmI, ordered });
if (command === 'sentinels') return sentinelListCommand(first, () => context(io), withBoard);
if (command === 'tour') return tour(io);
if (command === 'lifecycle') {
@@ -4668,7 +4670,7 @@ export function resultCommands() {
...Object.keys(setupCommands({}, args)),
...Object.keys(readCommands({}, args)),
...Object.keys(workCommands({}, args)),
- 'help', 'version', 'tour', 'lifecycle', 'view', 'serve', 'watch', 'forget', 'spec', 'prompt', 'hook', 'gate', 'settings', 'runner', 'relay', 'sentinel', 'sentinels',
+ 'help', 'version', 'tour', 'lifecycle', 'view', 'serve', 'watch', 'forget', 'spec', 'prompt', 'hook', 'gate', 'settings', 'runner', 'relay', 'sentinel', 'sentinels', 'loop',
])].sort();
}
diff --git a/src/engine.js b/src/engine.js
index 2f44adab..2749d7d9 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -21,6 +21,7 @@ import {
import { CHECK_ACCEPT_ENGINE } from './check-accept.js';
import { HEALTH_SENTINEL_ENGINE } from './health-receipts.js';
import { BOARD_SENTINEL_ENGINE } from './sentinels.js';
+import { RECURRING_JOB_ENGINE } from './job-engine.js';
import {
CAUSE_ENGINE,
ENGINE_VERSION,
@@ -64,7 +65,7 @@ export const ENGINE_OPERATIONS = Object.freeze([
'recordRowDecisions', 'applyRowDecisions', 'draftSpecRow', 'appendFact',
'recordLandingBatch', 'recordLandingWaiver', 'recordLandingFlake', 'finishLandingBatch', 'acceptCheck',
'recordHealthFindings', 'proposeSentinel', 'decideSentinel', 'beginSentinelRun', 'finishSentinelRun',
- 'recordFlakeObservation',
+ 'recordFlakeObservation', 'declareJob', 'recordJobRun',
]);
/** Engine version at which each ordered operation first has stable replay semantics. */
@@ -76,6 +77,7 @@ function minimumOperationEngine(operation, args, board) {
if (operation === 'recordFlakeObservation') return NATIVE_FLAKE_ENGINE;
if (operation === 'recordLandingBatch' && carriesFlakeDiagnostics(args[0]?.batch)) return NATIVE_FLAKE_ENGINE;
if (['proposeSentinel', 'decideSentinel', 'beginSentinelRun', 'finishSentinelRun'].includes(operation) || typeof args[1]?.cause === 'string' && args[1].cause.startsWith('sentinel:')) return BOARD_SENTINEL_ENGINE;
+ if (['declareJob', 'recordJobRun'].includes(operation)) return RECURRING_JOB_ENGINE;
if (operation === 'recordHealthFindings') return HEALTH_SENTINEL_ENGINE;
const options = args[1];
if (carriesConflict(operation, args)) return board && store.itemById(board, args[0])?.item_status === 'submitted' ? SUBMITTED_CONFLICT_ENGINE : CONFLICT_ENGINE;
diff --git a/src/health.js b/src/health.js
index 4e84f241..9b6d76f8 100644
--- a/src/health.js
+++ b/src/health.js
@@ -8,6 +8,7 @@
*/
import { execFileSync } from 'node:child_process';
import { existsSync } from 'node:fs';
+import { missedJobFindings } from './recurring-jobs.js';
import {
COORDINATOR,
durationMs,
@@ -90,6 +91,7 @@ export function healthReport({ db, root, config, now }) {
const at = now.getTime();
const age = (iso) => at - Date.parse(iso);
const board = { db, clock: { now: () => now } };
+ report.stuck.push(...missedJobFindings(board, at));
for (const stale of staleRowDecisions(rowDecisions(board), root, config)) {
report.stuck.push(finding('STALE_ROW_DECISION', null, {
subject: `${stale.kind}:${stale.id}`, key: `STALE_ROW_DECISION:${stale.kind}:${stale.id}`,
diff --git a/src/help.js b/src/help.js
index 33979cc4..a225e53f 100644
--- a/src/help.js
+++ b/src/help.js
@@ -93,6 +93,9 @@ Work
pullboard sentinel approve <name> person: approve this command, directory and schedule
pullboard sentinel decline <name> --reason "<why>" person: prevent future runs
pullboard sentinels approvals, owners and the last result; does not run checks
+ pullboard loop declare <name> --every 10m --owner <seat or lane> coordinator: declare a recurring job's cadence
+ pullboard loop ran <name> record that a recurring job just ran; health flags one silent for 1.5 cadences
+ pullboard loop list the recurring jobs and their last runs
reads the board and changes nothing; exits 1 when something is stuck
pullboard.json health.stuck (default 1h), health.holds (1d), health.release (1d)
pullboard skills --update refresh unchanged Claude Code skills from shipped versions
diff --git a/src/job-engine.js b/src/job-engine.js
new file mode 100644
index 00000000..353ebc6c
--- /dev/null
+++ b/src/job-engine.js
@@ -0,0 +1,2 @@
+/** First engine for declared recurring jobs and their run receipts (#815); a leaf, so machine.js and engine.js both reach it [D1,C7,H16]. */
+export const RECURRING_JOB_ENGINE = 61;
diff --git a/src/json.js b/src/json.js
index d07c566c..143cfad1 100644
--- a/src/json.js
+++ b/src/json.js
@@ -47,6 +47,9 @@ export const JSON_SHAPES = {
'sentinel approve': shape({ sentinel: 'object' }),
'sentinel decline': shape({ sentinel: 'object' }),
sentinels: shape({ sentinels: 'array' }),
+ loop: shape({ jobs: 'array' }),
+ 'loop declare': shape({ job: 'object' }),
+ 'loop ran': shape({ job: 'object' }),
skills: shape({ updated: 'array', current: 'array', customized: 'array' }),
inbox: shape({ shouts: 'array' }),
decisions: shape({ decisions: 'array' }),
diff --git a/src/loop-command.js b/src/loop-command.js
new file mode 100644
index 00000000..e68a0d67
--- /dev/null
+++ b/src/loop-command.js
@@ -0,0 +1,34 @@
+/** pullboard loop: declare a recurring job's cadence, record each run, and list the jobs [D1,C7]. */
+import { COORDINATOR } from './config.js';
+import { Refused } from './refused.js';
+import { recurringJobs } from './recurring-jobs.js';
+
+/**
+ * Run pullboard loop declare <name> --every 10m --owner <seat or lane>, loop ran <name>, or loop to list.
+ * Declaring is the coordinator's or the person's from the main checkout; ran is any joined seat's.
+ *
+ * @param {{ ctx: any, words: string[], values: any, withBoard: Function, whoAmI: Function, ordered: Function }} cli
+ * @returns {Promise<number>}
+ */
+export async function loopCommand({ ctx, words, values, withBoard, whoAmI, ordered }) {
+ const [verb, name, ...extra] = words;
+ if (verb && (!['declare', 'ran'].includes(verb) || !name || extra.length)) {
+ throw new Refused('USAGE', 'use pullboard loop declare <name> --every 10m --owner <seat or lane>, pullboard loop ran <name>, or pullboard loop');
+ }
+ return withBoard(ctx, async (board) => {
+ if (!verb) {
+ const jobs = recurringJobs(board);
+ ctx.io.result?.({ jobs });
+ for (const job of jobs) ctx.io.say(`${job.name}: ${job.every}; owner ${job.owner}; last run ${job.lastRun?.at ?? 'never'}`);
+ if (!jobs.length) ctx.io.say('no recurring jobs; the coordinator declares one with pullboard loop declare <name> --every 10m --owner <seat or lane>');
+ return 0;
+ }
+ const me = whoAmI(ctx, board);
+ if (verb === 'declare' && (!ctx.info.isMain || me.id !== COORDINATOR)) throw new Refused('JOB_CADENCE_COORDINATOR_ONLY', 'only the coordinator or the person declares a job’s cadence, from the main checkout');
+ const job = await ordered(ctx, board, verb === 'declare' ? 'declareJob' : 'recordJobRun',
+ [verb === 'declare' ? { agentId: me.id, name, every: values.every, owner: values.owner } : { agentId: me.id, name }]);
+ ctx.io.result?.({ job });
+ ctx.io.say(verb === 'declare' ? `${job.name}: ${job.every}; owner ${job.owner}` : `${job.name}: run recorded (${job.runs} so far)`);
+ return 0;
+ });
+}
diff --git a/src/machine.js b/src/machine.js
index a0243f19..b2009f67 100644
--- a/src/machine.js
+++ b/src/machine.js
@@ -12,6 +12,7 @@
import { RIGOR_NOTICE_ENGINE } from './rigor-source.js';
import { HEALTH_CAP_ENGINE } from './health-receipts.js';
import { NATIVE_FLAKE_ENGINE } from './flake-engine.js';
+import { RECURRING_JOB_ENGINE } from './job-engine.js';
/** First writer for withdraw-and-remove milestone behavior; shipment remains engine 45. */
export const WITHDRAW_MILESTONE_ENGINE = 51;
@@ -43,6 +44,7 @@ export const ENGINE_VERSION = Math.max(
STRONG_REJECTION_NOTICE_ENGINE,
52,
56,
+ RECURRING_JOB_ENGINE,
);
/**
diff --git a/src/next-steps.js b/src/next-steps.js
index 71bad03b..7049347c 100644
--- a/src/next-steps.js
+++ b/src/next-steps.js
@@ -549,6 +549,9 @@ export const NEXT_STEPS = Object.freeze({
TOKENS_NOT_AVAILABLE: 'manage agent tokens in pullboard view or the signed-in relay account',
TOKEN_NOT_OWNED: 'name a token id from pullboard relay tokens',
BAD_SENTINEL: 'read pullboard sentinel --help and propose an exact command, project directory, owner and schedule',
+ BAD_JOB: 'name the job and a cadence like 10m, 2h or daily: pullboard loop declare <name> --every 10m --owner <seat or lane>',
+ UNKNOWN_JOB: 'ask the coordinator to declare it: pullboard shout coordinator "declare job <name>"; read the declared jobs with pullboard loop',
+ JOB_CADENCE_COORDINATOR_ONLY: 'ask the coordinator to change the cadence: pullboard shout coordinator "<job> needs cadence <every>" --decision',
STALE_SENTINEL: 'read pullboard sentinels and ask the person to approve the current exact proposal',
SENTINEL_ABORTED: 'resume this board again when the background view is running',
SENTINEL_DRAIN: 'inspect the latest watch outcome with pullboard sentinels; report the shutdown failure to its owner before retrying',
diff --git a/src/recurring-jobs.js b/src/recurring-jobs.js
new file mode 100644
index 00000000..0ef12962
--- /dev/null
+++ b/src/recurring-jobs.js
@@ -0,0 +1,137 @@
+/**
+ * A recurring job declares its cadence and owner, records each run, and a job that has not run within one
+ * and a half cadences is a health finding that names it, its last run and its owner (#815) [D1,C7].
+ * Declarations and runs are append-only board events, so the relay replays them like sentinel receipts.
+ */
+import {
+ PERSON,
+ atomic,
+ listAgents,
+ logEvent,
+} from './board.js';
+import { RECURRING_JOB_ENGINE } from './job-engine.js';
+import { ENGINE_VERSION } from './machine.js';
+import { Refused } from './refused.js';
+
+export { RECURRING_JOB_ENGINE };
+const NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/u;
+const UNIT_MS = Object.freeze({ m: 60_000, h: 3_600_000, d: 86_400_000 });
+/** A job is missed after this many cadences without a run. */
+export const MISSED_AFTER = 1.5;
+
+/**
+ * Read a cadence such as 10m, 2h, 1d, hourly or daily as milliseconds.
+ *
+ * @param {unknown} every
+ * @returns {number}
+ */
+export function cadenceMs(every) {
+ if (every === 'hourly') return UNIT_MS.h;
+ if (every === 'daily') return UNIT_MS.d;
+ const found = typeof every === 'string' ? /^([1-9]\d{0,3})([mhd])$/u.exec(every) : null;
+ const ms = found ? Number(found[1]) * UNIT_MS[found[2]] : 0;
+ if (!ms || ms < UNIT_MS.m || ms > 31 * UNIT_MS.d) {
+ throw new Refused('BAD_JOB', 'name a job and its cadence, like 10m, 2h, 1d, hourly or daily: pullboard loop declare <name> --every 10m --owner <seat or lane>');
+ }
+ return ms;
+}
+
+/**
+ * Read every declared job with its latest run. A later declaration replaces an earlier one's cadence
+ * and owner but keeps its run history.
+ *
+ * @param {any} board
+ * @returns {{ name: string, every: string, owner: string, declaredBy: string, declaredAt: string, lastRun: { by: string, at: string } | null, runs: number }[]}
+ */
+export function recurringJobs(board) {
+ const jobs = new Map();
+ const events = board.db.prepare("SELECT event_by, event_at, event_kind, event_detail FROM event WHERE event_kind IN ('job-declare','job-run') ORDER BY event_id").all();
+ for (const event of events) {
+ const detail = JSON.parse(event.event_detail);
+ if (detail.engine !== RECURRING_JOB_ENGINE) continue;
+ if (event.event_kind === 'job-declare') {
+ const prior = jobs.get(detail.name);
+ jobs.set(detail.name, { name: detail.name, every: detail.every, owner: detail.owner, declaredBy: event.event_by, declaredAt: prior?.declaredAt ?? event.event_at,
+ lastRun: prior?.lastRun ?? null, runs: prior?.runs ?? 0 });
+ } else if (jobs.has(detail.name)) {
+ const job = jobs.get(detail.name);
+ job.lastRun = { by: event.event_by, at: event.event_at };
+ job.runs += 1;
+ }
+ }
+ return [...jobs.values()];
+}
+
+/** Refuse a move on an engine too old to replay it. */
+function requireJobEngine(board) {
+ if ((board.executionEngineVersion ?? ENGINE_VERSION) < RECURRING_JOB_ENGINE) {
+ throw new Refused('ENGINE_VERSION', `recurring jobs require engine ${RECURRING_JOB_ENGINE}; upgrade Pullboard`);
+ }
+}
+
+/**
+ * Declare or change a recurring job. Only the person or the coordinator sets a cadence, so an agent cannot
+ * widen one to hide a stopped job.
+ *
+ * @param {any} board
+ * @param {{ agentId: string, name: string, every: string, owner: string }} move
+ * @returns {ReturnType<typeof recurringJobs>[number]}
+ */
+export function declareJob(board, { agentId, name, every, owner }) {
+ return atomic(board, () => {
+ requireJobEngine(board);
+ if (agentId !== PERSON && agentId !== 'coordinator') {
+ throw new Refused('JOB_CADENCE_COORDINATOR_ONLY', 'only the coordinator or the person declares or changes a job’s cadence');
+ }
+ if (typeof name !== 'string' || !NAME.test(name) || typeof owner !== 'string' || !owner.trim() || /\s/u.test(owner)) {
+ throw new Refused('BAD_JOB', 'name a job and its cadence, like 10m, 2h, 1d, hourly or daily: pullboard loop declare <name> --every 10m --owner <seat or lane>');
+ }
+ cadenceMs(every);
+ logEvent(board, agentId, 'job-declare', null, { name, every, owner, engine: RECURRING_JOB_ENGINE });
+ return recurringJobs(board).find(job => job.name === name);
+ });
+}
+
+/**
+ * Record that a declared job just ran, by any joined seat.
+ *
+ * @param {any} board
+ * @param {{ agentId: string, name: string }} move
+ * @returns {ReturnType<typeof recurringJobs>[number]}
+ */
+export function recordJobRun(board, { agentId, name }) {
+ return atomic(board, () => {
+ requireJobEngine(board);
+ if (!listAgents(board).some(agent => agent.agent_id === agentId)) throw new Refused('NOT_JOINED', 'join this board before recording a run: pullboard join <lane>');
+ if (!recurringJobs(board).some(job => job.name === name)) {
+ throw new Refused('UNKNOWN_JOB', `no job named ${name}; the coordinator declares it first: pullboard loop declare ${name} --every 10m --owner <seat or lane>`);
+ }
+ logEvent(board, agentId, 'job-run', null, { name, engine: RECURRING_JOB_ENGINE });
+ return recurringJobs(board).find(job => job.name === name);
+ });
+}
+
+/**
+ * The health findings for jobs that have not run within one and a half cadences. A job never run counts
+ * from its declaration.
+ *
+ * @param {any} board
+ * @param {number} now - Milliseconds since the epoch.
+ * @returns {object[]}
+ */
+export function missedJobFindings(board, now) {
+ const found = [];
+ for (const job of recurringJobs(board)) {
+ const since = job.lastRun?.at ?? job.declaredAt;
+ const late = now - Date.parse(since);
+ if (late <= cadenceMs(job.every) * MISSED_AFTER) continue;
+ found.push({
+ key: `JOB_MISSED:job:${job.name}`, cause: 'JOB_MISSED', item: null, subject: `job:${job.name}`, title: 'recurring job missed its cadence', since,
+ ageMinutes: Math.max(0, Math.floor(late / 60_000)),
+ why: `${job.name} should run ${job.every === 'daily' || job.every === 'hourly' ? job.every : `every ${job.every}`} and has not run since ${job.lastRun ? job.lastRun.at : `it was declared (${job.declaredAt})`}; its owner is ${job.owner}`,
+ next: `find out why ${job.name} stopped and restart it; each run records itself with pullboard loop ran ${job.name}`,
+ command: null, owner: { role: 'coordinator', who: job.owner }, detail: { job: job.name, every: job.every, lastRun: job.lastRun, owner: job.owner },
+ });
+ }
+ return found;
+}
diff --git a/src/relay-sender.js b/src/relay-sender.js
index ea5ed7cc..15015ae3 100644
--- a/src/relay-sender.js
+++ b/src/relay-sender.js
@@ -10,7 +10,7 @@ export function relayMoveActor(move) {
if (move.operation === 'addItem') return args[0]?.by ?? null;
if (move.operation === 'shout') return args[0]?.from ?? null;
if (['proposeSentinel', 'decideSentinel', 'beginSentinelRun', 'finishSentinelRun'].includes(move.operation)) return args[0]?.agentId ?? null;
- if (['recordHealthFindings', 'recordFlakeObservation'].includes(move.operation)) return args[0]?.agentId ?? null;
+ if (['recordHealthFindings', 'recordFlakeObservation', 'declareJob', 'recordJobRun'].includes(move.operation)) return args[0]?.agentId ?? null;
if (['holdLane', 'releaseLane'].includes(move.operation) && args[1]?.asPerson) return 'person';
if (move.operation === 'release') return args[1] ?? null;
if (['reserveNextReview', 'addMilestone', 'recordRowDecisions', 'applyRowDecisions', 'draftSpecRow', 'recordLandingBatch', 'recordLandingWaiver', 'recordLandingFlake', 'finishLandingBatch'].includes(move.operation)) return args[0]?.agentId ?? null;
diff --git a/test/api-catalog.test.js b/test/api-catalog.test.js
index 939a9ec3..7ab32ddf 100644
--- a/test/api-catalog.test.js
+++ b/test/api-catalog.test.js
@@ -704,6 +704,9 @@ catalogCase('[A1] catalog commands keep their real repository exercises', async
assert.equal((await json(source, source.repo, 'sentinel', ['approve', 'catalog-watch'], 'approve')).sentinel.status, 'approved');
assert.equal((await json(source, source.repo, 'sentinel', ['decline', 'catalog-watch', '--reason', 'Catalog coverage complete'], 'decline')).sentinel.status, 'declined');
assert.equal((await json(source, source.repo, 'sentinels')).sentinels[0].name, 'catalog-watch');
+ assert.equal((await json(source, source.repo, 'loop', ['declare', 'catalog-job', '--every', '10m', '--owner', 'coordinator'], 'declare')).job.every, '10m');
+ assert.equal((await json(source, source.repo, 'loop', ['ran', 'catalog-job'], 'ran')).job.runs, 1);
+ assert.equal((await json(source, source.repo, 'loop')).jobs[0].name, 'catalog-job');
await json(source, source.repo, 'milestone', ['add', 'Catalog', '--items', String(catalog.item_id)], 'add');
await json(source, source.repo, 'milestone', ['items', 'Catalog', '--remove', String(catalog.item_id)], 'items');
await json(source, source.repo, 'milestone', ['items', 'Catalog', '--add', String(catalog.item_id)], 'items');
diff --git a/test/health.test.js b/test/health.test.js
index db698b0e..f9c774d4 100644
--- a/test/health.test.js
+++ b/test/health.test.js
@@ -14,6 +14,7 @@ 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 { recurringJobs } from '../src/recurring-jobs.js';
import { scanHealthSentinel } from '../src/health-sentinel.js';
import { loadConfig } from '../src/config.js';
import { gateRuns } from '../src/gate-control.js';
@@ -539,3 +540,42 @@ test('one health run sends at most ten stuck shouts and names how many it held b
assert.equal(shouts.at(-1).shout_to, 'coordinator');
assert.equal(seats.length, 12);
});
+
+test('a recurring job that missed its cadence is a finding [D1,C7]', async (t) => {
+ const box = repo(t);
+ const { board, at } = boardAt(box);
+ store.register(board, { lane: 'coordinator', path: box.root });
+ const worker = store.register(board, { lane: 'core', path: join(box.dir, 'core-1') });
+ at(10 * HOUR);
+ for (const name of ['nightly', 'edge', 'fresh', 'never']) store.declareJob(board, { agentId: 'coordinator', name, every: '10m', owner: 'coordinator' });
+ at(9 * HOUR);
+ store.recordJobRun(board, { agentId: worker, name: 'nightly' });
+ at(16 * 60_000);
+ store.recordJobRun(board, { agentId: worker, name: 'edge' });
+ at(14 * 60_000);
+ store.recordJobRun(board, { agentId: worker, name: 'fresh' });
+ store.closeBoard(board);
+ const { code, stdout } = await cli(box.root, ['health', '--json']);
+ assert.equal(code, 1, 'a silent job is stuck work');
+ const missed = JSON.parse(stdout).stuck.filter((entry) => entry.cause === 'JOB_MISSED').map((entry) => entry.subject).sort();
+ assert.deepEqual(missed, ['job:edge', 'job:never', 'job:nightly'], 'a run 14 minutes ago is on time for a 10 minute job; 16 minutes ago and never run are missed');
+ const found = JSON.parse(stdout).stuck.find((entry) => entry.subject === 'job:nightly');
+ assert.match(found.why, /nightly/u);
+ assert.ok(found.why.includes(ago(9 * HOUR)), `the finding names the last run: ${found.why}`);
+ assert.match(found.why, /owner is coordinator/u);
+ assert.equal(found.owner.who, 'coordinator');
+ const scan = scanHealthSentinel(box.file, { root: box.root, config: loadConfig(box.root), now: new Date(NOW) });
+ assert.ok(scan.findings.some((entry) => entry.key === 'JOB_MISSED:job:nightly'), 'the sentinel feed carries the finding');
+});
+
+test('an agent cannot widen a declared cadence [D1,C7]', (t) => {
+ const box = repo(t);
+ const { board } = boardAt(box);
+ t.after(() => store.closeBoard(board));
+ store.register(board, { lane: 'coordinator', path: box.root });
+ const worker = store.register(board, { lane: 'core', path: join(box.dir, 'core-1') });
+ store.declareJob(board, { agentId: 'coordinator', name: 'loop', every: '10m', owner: 'coordinator' });
+ assert.throws(() => store.declareJob(board, { agentId: worker, name: 'loop', every: 'daily', owner: worker }), (error) => error.code === 'JOB_CADENCE_COORDINATOR_ONLY');
+ assert.equal(recurringJobs(board)[0].every, '10m');
+ assert.equal(store.declareJob(board, { agentId: 'coordinator', name: 'loop', every: '1h', owner: 'coordinator' }).every, '1h', 'the coordinator may change it');
+});