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): teach rigor the sentinel receipt cause [A6,D1]
Corey Olsoned26a4758047
diff --git a/src/rigor.js b/src/rigor.jsindex 9540357c..d3289c68 100644--- a/src/rigor.js+++ b/src/rigor.js@@ -88,16 +88,17 @@ export function causeReading(key) {}/**- * The cause keys one recorded reject or reopen carries. A move recorded with --cause names its key;+ * The cause keys a reject, reopen or allocated sentinel failure receipt carries. A move recorded with --cause names its key;* a reopen after a red landing names its failing tests in structured fields, so those give keys* even for events recorded before cause keys existed. A note is never parsed.*- * @param {{ event_kind: string, event_detail: string }} event+ * @param {{ event_kind: string, event_detail: string, event_by?: string }} event* @returns {string[]}*/export function eventCauses(event) {- if (!['reject', 'reopen'].includes(event.event_kind)) return [];+ if (!['reject', 'reopen', 'health-failure'].includes(event.event_kind)) return [];const detail = JSON.parse(event.event_detail);+ if (event.event_kind === 'health-failure' && (event.event_by !== 'sentinel' || detail.engine !== HEALTH_SENTINEL_ENGINE)) return [];const keys = [];if (typeof detail.cause === 'string' && !causeProblem(detail.cause)) keys.push(detail.cause);const tests = Array.isArray(detail.landingFailure?.tests) ? detail.landingFailure.tests : [];diff --git a/test/health-sentinel.test.js b/test/health-sentinel.test.jsindex f919ac14..0bd82780 100644--- a/test/health-sentinel.test.js+++ b/test/health-sentinel.test.js@@ -12,7 +12,7 @@ import { applyRelayMove, appliedSequence, prepareEngineMove } from '../src/enginimport { exportBoard } from '../src/exchange.js';import { HEALTH_SENTINEL_ENGINE } from '../src/health-receipts.js';import { scanHealthSentinel } from '../src/health-sentinel.js';-import { rigorReport } from '../src/rigor.js';+import { eventCauses, rigorReport } from '../src/rigor.js';import { startServeSentinel, HEALTH_SENTINEL_INTERVAL_MS } from '../src/serve-sentinel.js';import { machineSettingsFile } from '../src/settings.js';import { frozenCriterion, loadSpec } from '../src/spec.js';@@ -139,6 +139,25 @@ test('sentinel replay refuses older engines and stale observations without a falassert.equal(box.scan().added.length, 1, 'a fresh observation succeeds after the stale one');});+test('a recurring health episode needs no changed code commit and legacy lookalikes are ignored [A6,H16]', t => {+ const box = fixture(t);+ const id = box.claimed(0);+ box.clock.offset += 2 * HOUR; box.scan();+ store.claim(box.board, id, { agentId: box.builders[0], lane: 'core', leaseMs: HOUR, freeze: box.freeze });+ store.release(box.board, id, box.builders[0]); box.scan();+ store.claim(box.board, id, { agentId: box.builders[0], lane: 'core', leaseMs: HOUR, freeze: box.freeze });+ box.clock.offset += 2 * HOUR; box.scan();+ const report = rigorReport(store.events(box.board), { person: store.PERSON });+ assert.equal(report.causes[0].key, 'refusal:CLAIM_LAPSED');+ assert.equal(report.causes[0].occurrences, 2);+ assert.deepEqual(report.causes[0].items, [{ id, commits: [] }]);+ const event = store.events(box.board).find(value => value.event_kind === 'health-failure');+ const old = { ...event, event_detail: JSON.stringify({ ...JSON.parse(event.event_detail), engine: HEALTH_SENTINEL_ENGINE - 1 }) };+ assert.deepEqual(eventCauses(old), []);+ assert.deepEqual(eventCauses({ ...event, event_by: 'coordinator' }), []);+ assert.deepEqual(eventCauses({ ...event, event_kind: 'shout' }), []);+});+test('resume publishes health and the board and machine off switches suppress it [A6]', async t => {const box = fixture(t);box.claimed(0); box.clock.offset += 2 * HOUR;