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.

test: cover ordered old-engine CPU queue refusal

Corey Olson3c2e88549af8
diff --git a/src/health-receipts.js b/src/health-receipts.js
index 6de8e802..62bf6859 100644
--- a/src/health-receipts.js
+++ b/src/health-receipts.js
@@ -13,6 +13,7 @@ export const HEALTH_SHOUT_CAP = 10;
/** Pending CPU deliveries require an engine that can preserve their durable queue [A6,H16]. */
export function hasPendingCpuNotices(board) {
+ if (!board) return false;
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);
}
diff --git a/test/sentinel-cpu.test.js b/test/sentinel-cpu.test.js
index 0fede9d1..a6b3fcd6 100644
--- a/test/sentinel-cpu.test.js
+++ b/test/sentinel-cpu.test.js
@@ -9,6 +9,7 @@ import { runFixtureGit } from './fixture-child.js';
import { scanHealthSentinel } from '../src/health-sentinel.js';
import { CPU_SENTINEL_ENGINE } from '../src/cpu-sentinel-engine.js';
import { HEALTH_SHOUT_CAP } from '../src/health-receipts.js';
+import { applyRelayMove, prepareEngineMove } from '../src/engine.js';
// CPU time is observed, not burned: the native utility port supplies an exact ps/lsof transcript.
test('the sentinel names an agent process past 20 CPU minutes once [A6,H16]', async t => {
@@ -78,6 +79,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);
+ const emptyMove = prepareEngineMove(board, 'recordHealthFindings', [{
+ agentId: 'coordinator', observedRevision: pendingEvents.length, findings: [],
+ }], { actor: 'coordinator' });
+ assert.throws(() => applyRelayMove(board, { ...emptyMove, engine: CPU_SENTINEL_ENGINE - 1 }, {
+ sequence: 1, at: new Date().toISOString(), kind: 'move',
+ sender: { kind: 'agent', agent: 'coordinator', userId: 'fixture-user' },
+ }), { code: 'RELAY_MOVE' }, 'ordered old-engine input cannot erase the pending queue');
board.executionEngineVersion = CPU_SENTINEL_ENGINE - 1;
assert.throws(() => store.recordHealthFindings(board, {
agentId: 'coordinator', observedRevision: pendingEvents.length, findings: [],