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: preserve pending CPU alerts across older scan requests [A6,H16]
Corey Olsond89fe83bc36b
diff --git a/src/board.js b/src/board.jsindex 2a652453..6b0ea1a4 100644--- a/src/board.js+++ b/src/board.js@@ -244,6 +244,7 @@ import {import { RIGOR_NOTICE_ENGINE } from './rigor-source.js';import { RIGOR_AUTO_ENGINE } from './rigor-auto-engine.js';import { CPU_SENTINEL_ENGINE } from './cpu-sentinel-engine.js';+import { hasPendingCpuNotices } from './health-receipts.js';import {deriveRigorCause,recordAutomaticRigorDrafts,@@ -1703,7 +1704,7 @@ export function shout(board, message) {/** Record one current health snapshot atomically, notifying each new or resolved episode once [A6]. */export function recordHealthFindings(board, { agentId, observedRevision, findings }) {return atomic(board, () => {- const minimum = (Array.isArray(findings) && findings.some(finding => finding?.cause === 'AGENT_CPU')) ? CPU_SENTINEL_ENGINE : HEALTH_SENTINEL_ENGINE;+ const minimum = hasPendingCpuNotices(board) || (Array.isArray(findings) && findings.some(finding => finding?.cause === 'AGENT_CPU')) ? CPU_SENTINEL_ENGINE : HEALTH_SENTINEL_ENGINE;if ((board.executionEngineVersion ?? ENGINE_VERSION) < minimum) {throw new Refused('ENGINE_VERSION', `sentinel receipts require engine ${minimum}; upgrade Pullboard before scanning`);}diff --git a/src/health-receipts.js b/src/health-receipts.jsindex 8592006f..6de8e802 100644--- a/src/health-receipts.js+++ b/src/health-receipts.js@@ -11,6 +11,12 @@ export { HEALTH_CAP_ENGINE };/** The most stuck or resolved notices one health run shouts one by one (#940). */export const HEALTH_SHOUT_CAP = 10;+/** Pending CPU deliveries require an engine that can preserve their durable queue [A6,H16]. */+export function hasPendingCpuNotices(board) {+ const last = board.db.prepare("SELECT event_detail FROM event WHERE event_kind = 'health-scan' ORDER BY event_id DESC LIMIT 1").get();+ return Boolean(last && JSON.parse(last.event_detail).pendingCpu?.length);+}+/** 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) {diff --git a/src/moves/recordHealthFindings.js b/src/moves/recordHealthFindings.jsindex b86d2514..e99bb4cc 100644--- a/src/moves/recordHealthFindings.js+++ b/src/moves/recordHealthFindings.js@@ -2,11 +2,13 @@ import { CPU_SENTINEL_ENGINE } from '../cpu-sentinel-engine.js';import { RIGOR_AUTO_ENGINE } from '../rigor-auto-engine.js';/** Routing metadata owned by recordHealthFindings, discovered without a shared registry edit [C7,V4,H16]. */import { HEALTH_SENTINEL_ENGINE } from '../health-receipts.js';+import { hasPendingCpuNotices } from '../health-receipts.js';import { LANDING_LEASE_ENGINE } from '../landing-lease-engine.js';import { BOARD_SENTINEL_ENGINE } from '../sentinel-engine.js';/** Preserve this operation's historical first-matching engine conditions [H16]. */function minimumEngine(args, board, at) {+ if (hasPendingCpuNotices(board)) return CPU_SENTINEL_ENGINE;if (typeof args[1]?.cause === 'string' && args[1].cause.startsWith('conflict:')) return RIGOR_AUTO_ENGINE;if (args[0]?.landingFence !== undefined) return LANDING_LEASE_ENGINE;if (typeof args[1]?.cause === 'string' && args[1].cause.startsWith('sentinel:')) return BOARD_SENTINEL_ENGINE;diff --git a/test/sentinel-cpu.test.js b/test/sentinel-cpu.test.jsindex c7d882de..0fede9d1 100644--- a/test/sentinel-cpu.test.js+++ b/test/sentinel-cpu.test.js@@ -77,6 +77,13 @@ test('the sentinel names an agent process past 20 CPU minutes once [A6,H16]', as};cappedScan();assert.equal(notices().length - beforeCap, 5, 'sixth and later coordinator alerts wait rather than exceed the cap');+ const pendingEvents = store.events(board);+ board.executionEngineVersion = CPU_SENTINEL_ENGINE - 1;+ assert.throws(() => store.recordHealthFindings(board, {+ agentId: 'coordinator', observedRevision: pendingEvents.length, findings: [],+ }), { code: 'ENGINE_VERSION' }, 'an older empty scan cannot erase pending CPU delivery');+ assert.deepEqual(store.events(board), pendingEvents, 'refusal preserves the complete delivery queue and history');+ delete board.executionEngineVersion;store.closeBoard(board); board = store.openBoard(file);cappedScan(); cappedScan();for (const pid of pids) assert.equal(notices().filter(row => row.shout_text.includes(`pid ${pid} `)).length, 1, `PID ${pid} is named exactly once after restart`);