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.

Merge branch 'main' into core/954-claude

Corey Olson5b13f89d8a79
diff --cc src/cli.js
index 62fc3979,35d95eb0..04250be5
--- a/src/cli.js
+++ b/src/cli.js
@@@ -354,17 -286,8 +287,9 @@@ import
launchBackgroundView,
reportView,
} from './background-view.js';
- import { rigorDraftCommand } from './rigor-draft.js';
- import {
- conflictLines,
- conflictReport,
- } from './rigor-conflicts.js';
- import { draftConflictSplits } from './rigor-splits.js';
import { nextReview } from './next-review.js';
+import { firstRefusalArgs } from './claims.js';
import { serveApi } from './api.js';
- import { watchCommand } from './watch.js';
import { serveMcp } from './mcp.js';
import { scanHealthSentinel } from './health-sentinel.js';
import { SENTINEL_OPTIONS } from './sentinel-command.js';
@@@ -480,10 -362,12 +364,10 @@@ import
} from './land.js';
import { installStep } from './worktree.js';
import * as infraNotes from './infra-note.js';
-
export { gateWaitReporter };
- const CHECKOUT_LEASES = new WeakMap();
+ export const CHECKOUT_LEASES = new WeakMap();
const CHECKOUT_BOARD_ONLY = new WeakMap();
let startupMainTraced = false;
-
/**
* Read the collision baseline from the primary branch, retained trunk, or detached HEAD default.
*
@@@ -978,8 -863,8 +862,8 @@@ export async function reserveRow(ctx, r
/** Note the session behind a claim or submit (#921): its ledger must be writable before the move, and record after it. */
async function withItemSession(info, operation, args, move) { const noted = operation === 'claim' || operation === 'submit'; if (noted) itemSessions.requireLedger(info); const result = await move(); if (noted) itemSessions.recordItemSession(info, args[0], operation); return result; }
- async function ordered(ctx, board, operation, args) {
+ export async function ordered(ctx, board, operation, args) {
+ if (['verify', 'reopen'].includes(operation)) args = firstRefusalArgs(operation, args, configFromSource(coordinatorFile(ctx.info.root, CONFIG_FILE).stdout));
// Every engine-27 registration records the seat that made it: the coordinator from the main
// checkout, the joined agent from its worktree, or `machine` for a join no seat made (#579).
if (operation === 'register' && args[0] && args[0].createdBy === undefined) {
diff --cc src/machine.js
index 71293c92,de81f194..da0998b0
--- a/src/machine.js
+++ b/src/machine.js
@@@ -9,49 -9,46 +9,48 @@@
* broken copy, and checks the declaration against the refusals board.js and cli.js raise today.
*/
- 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';
- import { LOCAL_LANDING_ENGINE } from './land-engine.js';
+ import {
+ ENGINE_CANDIDATE,
+ ENGINE_FILE,
+ discovered,
+ } from './discovery.js';
+ import {
+ readdirSync,
+ readFileSync,
+ } from 'node:fs';
+
+ export { AUTO_ESCALATE_ENGINE } from './auto-escalate-engine.js';
+ export { ROW_DRAFT_ENGINE } from './row-draft-engine.js';
+ export { STRONG_REJECTION_NOTICE_ENGINE } from './strong-rejection-notice-engine.js';
+ export { SUBMITTED_CONFLICT_ENGINE } from './submitted-conflict-engine.js';
+ export { WITHDRAW_MILESTONE_ENGINE } from './withdraw-milestone-engine.js';
- /** First writer for withdraw-and-remove milestone behavior; shipment remains engine 45. */
- export const WITHDRAW_MILESTONE_ENGINE = 51;
-
- /** First engine that automatically escalates an item's second rejection at its current route [B15]. */
- export const AUTO_ESCALATE_ENGINE = 50;
-
- /** The first engine that records a spec row a lane agent drafts on the board, not in SPEC.md (#878). */
- export const ROW_DRAFT_ENGINE = 55;
-
- /** First engine replacing an automatic ceiling escalation with a paired notice [B15,H16]. */
- export const STRONG_REJECTION_NOTICE_ENGINE = 54;
-
- /** Executable move semantics, carried by every sealed move and retained during replay [H16]. */
/**
- * The engine at which a conflict reopen may return a submitted head, not only an accepted one, and any joined
- * seat may record it (#807; allocated by the coordinator, 19 Oct).
+ * Find every feature engine: each src/*-engine.js leaf declares exactly one `export const NAME_ENGINE = n;` line.
+ * A feature that raises the engine adds its own new file and no line of any shared one, so two items adding
+ * different engines never conflict [C7,V4]. The value is read as text because machine.js needs it synchronously.
+ *
+ * @param {URL} directory the folder holding the *-engine.js leaves
+ * @returns {Record<string, number>} engine number by file name, in name order
*/
- export const SUBMITTED_CONFLICT_ENGINE = 60;
-
- /** First engine reserving opt-in reopened work for its builder (#954, coordinator allocation). */
- export const REOPEN_FIRST_REFUSAL_ENGINE = 66;
-
- export const ENGINE_VERSION = Math.max(
- REOPEN_FIRST_REFUSAL_ENGINE,
- LOCAL_LANDING_ENGINE,
- HEALTH_CAP_ENGINE,
- SUBMITTED_CONFLICT_ENGINE,
- NATIVE_FLAKE_ENGINE,
- ROW_DRAFT_ENGINE,
- AUTO_ESCALATE_ENGINE,
- RIGOR_NOTICE_ENGINE,
- WITHDRAW_MILESTONE_ENGINE,
- STRONG_REJECTION_NOTICE_ENGINE,
- 52,
- 56,
- RECURRING_JOB_ENGINE,
- );
+ export function discoverEngines(directory = new URL('./', import.meta.url)) {
+ const found = {};
+ for (const file of discovered(readdirSync(directory), ENGINE_CANDIDATE, ENGINE_FILE, 'feature engine')) {
+ const lines = readFileSync(new URL(file, directory), 'utf8').split('\n').filter((line) => /^export const /u.test(line));
+ const match = lines.length === 1 ? /^export const [A-Z][A-Z0-9_]*_ENGINE = (\d+);$/u.exec(lines[0]) : null;
+ if (!match) throw new Error(`${file} must declare exactly one line \`export const NAME_ENGINE = <number>;\` so ENGINE_VERSION can read it`);
+ found[file.slice(0, -'-engine.js'.length)] = Number(match[1]);
+ }
+ return found;
+ }
+
++export { REOPEN_FIRST_REFUSAL_ENGINE } from './reopen-first-refusal-engine.js';
++
+ /** Every feature engine by name, discovered from the *-engine.js files beside this one. */
+ export const ENGINE_REGISTRY = discoverEngines();
+
+ /** The highest engine number any feature declares. */
+ export const ENGINE_VERSION = Math.max(...Object.values(ENGINE_REGISTRY));
/**
* The engine whose relay moves carry seat provenance and verifier standing (#579). It is its own
diff --cc src/reopen-first-refusal-engine.js
index 00000000,00000000..73288aab
new file mode 100644
--- /dev/null
+++ b/src/reopen-first-refusal-engine.js
@@@ -1,0 -1,0 +1,2 @@@
++/** First engine reserving opt-in reopened work for its builder (#954, coordinator allocation). */
++export const REOPEN_FIRST_REFUSAL_ENGINE = 66;
diff --cc test/engine.test.js
index eaca73ed,de315001..9fe2af2d
--- a/test/engine.test.js
+++ b/test/engine.test.js
@@@ -7,10 -8,10 +8,11 @@@ import { join } from 'node:path'
import { pathToFileURL } from 'node:url';
import { test } from 'node:test';
import * as store from '../src/board.js';
+import { submitFixture } from './board-submit-fixture.js';
import { exportBoard, importBoard, restoreRelaySnapshot } from '../src/exchange.js';
import { applyEngineMove, applyRelayMove, prepareEngineMove, appliedSequence, engineReceipt, refuseRelayMove, startRelayEpoch, checkpointSequence, ENGINE_OPERATIONS } from '../src/engine.js';
- import { ENGINE_VERSION } from '../src/machine.js';
+ import { COMMAND_CANDIDATE, COMMAND_FILE, discovered } from '../src/discovery.js';
+ import { ENGINE_REGISTRY, ENGINE_VERSION, discoverEngines } from '../src/machine.js';
import { Refused } from '../src/refused.js';
import { unpackRelease } from './release-archive.js';
@@@ -625,32 -626,26 +627,55 @@@ test('a failed durable receipt rolls ba
assert.equal(replayCursor(board), 0);
});
-
+test('engine 65 keeps an ordinary claim available without a return window [B13,H16]', t => {
+ const { copies: [board], item } = engineCopies(t);
+ const move = { ...claimMove(board, item, 'web-2'), engine: 65 };
+ const result = applyEngineMove(board, move, { sequence: 1, at: CLAIM_AT });
+ assert.equal(result.error, undefined);
+ assert.equal(store.getItem(board, item).item_owner, 'web-2');
+});
+
+test('return-window engine admission uses the receipt time rather than replica clocks [B13,H16]', t => {
+ const { copies: [insideClock, expiredClock], item } = engineCopies(t, board => {
+ board.clock = { now: () => new Date('2026-10-07T16:00:00.000Z') };
+ const id = store.listItems(board)[0].item_id;
+ store.claim(board, id, { agentId: 'web-1', lane: 'web', leaseMs: 2 * HOUR,
+ freeze: () => ({ text: '{"rows":[]}', digest: 'f'.repeat(64) }) });
+ submitFixture(board, id, { agentId: 'web-1', commit: 'a'.repeat(40), tree: 'a'.repeat(40) });
+ store.verify(board, id, { agentId: 'web-2', decision: 'REJECT', reason: 'OTHER', note: 'proof',
+ head: 'a'.repeat(40), digest: 'f'.repeat(64), policy: 'any', reopenFirstRefusalMinutes: 30 });
+ });
+ const before = boardRows(expiredClock, item);
+ const old = { ...claimMove(expiredClock, item, 'web-2'), engine: 65 };
+ assert.throws(() => applyEngineMove(expiredClock, old, { sequence: 1, at: '2026-10-07T16:05:00.000Z' }), /engine/);
+ assert.deepEqual(boardRows(expiredClock, item), before);
+ assert.equal(appliedSequence(expiredClock), 0);
+ const atExpiry = { ...claimMove(insideClock, item, 'web-2'), engine: 65 };
+ const result = applyEngineMove(insideClock, atExpiry, { sequence: 1, at: '2026-10-07T16:30:00.000Z' });
+ assert.equal(result.error, undefined);
+ assert.equal(store.getItem(insideClock, item).item_owner, 'web-2');
+});
++
+ test('the engine version is the highest feature engine [C7,V4]', () => {
+ const entries = Object.entries(ENGINE_REGISTRY);
+ assert.ok(entries.length > 0, 'the registry names at least one feature engine');
+ for (const [name, engine] of entries) assert.ok(Number.isSafeInteger(engine) && engine > 0, `feature ${name} declares a positive whole engine number`);
+ assert.equal(ENGINE_VERSION, Math.max(...entries.map(([, engine]) => engine)), 'the engine version is the highest number any feature declares');
+ const source = new URL('../src/', import.meta.url);
+ const files = readdirSync(source).filter((file) => /-engine\.js$/u.test(file));
+ assert.deepEqual(Object.keys(ENGINE_REGISTRY), files.map((file) => file.slice(0, -'-engine.js'.length)).sort(), 'every src/*-engine.js leaf is a feature engine, discovered by its file name');
+ for (const file of files) assert.match(readFileSync(new URL(file, source), 'utf8'), /^export const [A-Z][A-Z0-9_]*_ENGINE = \d+;$/mu, `${file} declares its one engine constant`);
+ assert.doesNotMatch(readFileSync(new URL('machine.js', source), 'utf8'), /Math\.max\([A-Z_]+ENGINE,/u, 'src/machine.js lists no engine by name');
+ });
+
+ test('a feature engine or command file name outside letters, digits, underscore and hyphen is refused by discovery [C7,V4]', () => {
+ const directory = mkdtempSync(join(tmpdir(), 'pullboard-discovery-'));
+ try {
+ writeFileSync(join(directory, 'check-alpha-engine.js'), 'export const CHECK_ALPHA_ENGINE = 70;\n');
+ assert.deepEqual(discoverEngines(pathToFileURL(directory + '/')), { 'check-alpha': 70 }, 'a hyphenated engine file is discovered');
+ writeFileSync(join(directory, 'check.beta-engine.js'), 'export const CHECK_BETA_ENGINE = 71;\n');
+ assert.throws(() => discoverEngines(pathToFileURL(directory + '/')), /check\.beta-engine\.js cannot be a feature engine/u, 'a dotted engine file is refused by name');
+ } finally { rmSync(directory, { recursive: true, force: true }); }
+ assert.deepEqual(discovered(['index.js', 'add.js', 'two-words.js'], COMMAND_CANDIDATE, COMMAND_FILE, 'command'), ['add.js', 'two-words.js']);
+ assert.throws(() => discovered(['index.js', 'add.js', 'a.b.js'], COMMAND_CANDIDATE, COMMAND_FILE, 'command'), /a\.b\.js cannot be a command/u, 'a dotted command file is refused by name');
+ });