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(board): resubmit corrected rejected commits [V4,B3]
Corey Olson59717549b1a8
diff --git a/docs/formats.md b/docs/formats.mdindex 4d12f5fa..333f26db 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -102,10 +102,10 @@ The board file is in the repository's Git common directory at `.git/pullboard/bo| `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. || `board schema` | `2` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | Create missing tables and indexes, add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. || `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |-| `move engine` | `8` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |+| `move engine` | `9` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |<!-- format-versions:end -->-Pullboard 0.6.1 released engine 1. Engine 2 records a fresh explicit-build claim's skipped-review snapshot. Pullboard 0.8.1 released engine 3, including lane-sensitive graft refusals and authenticated relay senders. Engine 4 adds captured background-baseline completions through `completeCheckBaseline`; released engine-3 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Engine 5 requires a one-line reason when releasing a review and gives that reviewer a one-hour cooldown for the current submission. Each sealed move replays under its recorded engine version: engines 1 through 4 retain the original release event and review-reservation behavior. Engine 5 retains support for older moves, including engine-4 baseline completions. Pullboard 0.8.3 released engine 6, adding board-scoped machine credentials and permitting machine execution only for one exact, earlier authenticated phone request, including its payload digest. Engine 7 adds ordered item holds through `holdItem` and `releaseItemHold`; engine-6 clients stop with `ENGINE_VERSION` before interpreting either operation or advancing their replay cursor. Engine 8, shared by the 0.8.5 move changes, retains merged-item exception notes, selects the next review in roadmap order, and adds coordinator-only `reopen` for a submission returned without a verdict; engine-7 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Recorded engines 1 through 7 retain their original tier-first review selection. Engine 8 also adds durable refusal recovery for blocked relay positions; each explicit skip publishes the readable prefix even when another unsupported record follows. Engine 8 also permits coordinator criterion/check edits on a live claim as pending corrections; the holder cannot renew or submit until a refreeze adopts the correction while preserving the claim. Older request receipts retain their recorded engine semantics. Upgrade every linked device before using the new moves. Each release shares one engine bump across its changed moves. Engine 8 also retains declared model labels on registration and records each registered agent move's model snapshot; engines 1 through 7 retain their original registration and event details without these model fields.+Pullboard 0.6.1 released engine 1. Engine 2 records a fresh explicit-build claim's skipped-review snapshot. Pullboard 0.8.1 released engine 3, including lane-sensitive graft refusals and authenticated relay senders. Engine 4 adds captured background-baseline completions through `completeCheckBaseline`; released engine-3 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Engine 5 requires a one-line reason when releasing a review and gives that reviewer a one-hour cooldown for the current submission. Each sealed move replays under its recorded engine version: engines 1 through 4 retain the original release event and review-reservation behavior. Engine 5 retains support for older moves, including engine-4 baseline completions. Pullboard 0.8.3 released engine 6, adding board-scoped machine credentials and permitting machine execution only for one exact, earlier authenticated phone request, including its payload digest. Engine 7 adds ordered item holds through `holdItem` and `releaseItemHold`; engine-6 clients stop with `ENGINE_VERSION` before interpreting either operation or advancing their replay cursor. Engine 8, shared by the 0.8.5 move changes, retains merged-item exception notes, selects the next review in roadmap order, and adds coordinator-only `reopen` for a submission returned without a verdict; engine-7 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Recorded engines 1 through 7 retain their original tier-first review selection. Engine 8 also adds durable refusal recovery for blocked relay positions; each explicit skip publishes the readable prefix even when another unsupported record follows. Engine 8 also permits coordinator criterion/check edits on a live claim as pending corrections; the holder cannot renew or submit until a refreeze adopts the correction while preserving the claim. Older request receipts retain their recorded engine semantics. Upgrade every linked device before using the new moves. Each release shares one engine bump across its changed moves. Engine 8 also retains declared model labels on registration and records each registered agent move's model snapshot; engines 1 through 7 retain their original registration and event details without these model fields. Engine 9, shared with the 0.8.10 move changes, allows resubmitting the same rejected commit after a corrected criterion is refrozen, but only when the rejection names a different frozen digest. Engine 8 retains its HEAD_NOT_NEW refusal and prior submit-event detail. Engine-9 submit events add `criterionDigest`, and engine-8 boards replay with the original refusal and event history.The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 3 after issuing any agent token, including@@ -284,7 +284,7 @@ Each connection also has a temporary `moving(token INTEGER)` table and `status_t## Event log-The `event` table is a SQLite schema object governed by `SCHEMA_VERSION`; its append-only record format has the independent `EVENT_LOG_VERSION`. Each event has an increasing integer id, an ISO timestamp, the actor, the event kind, an optional item id, and a JSON object in `event_detail`. Board moves append their event inside the same immediate transaction as the move. Events are append-only; board triggers reject updates and deletes. The actor column is the acting agent id, except guard-repair events, which use `board`. Under engine 8, each event by a registered agent also carries a `model` string snapshot in `event_detail`; legacy agents without a declaration use `unknown`. Declared models live under `agent_model:<agent id>` in `board_meta`, without changing the agent table or stable ids. Rejoining with another model appends a `model` event whose common snapshot holds the new declaration. This common snapshot is separate from the per-kind payload fields listed below. The following rows name the emitted kinds and the union of their operation-specific detail keys; CLI accept events additionally carry the frozen-check result described below:+The `event` table is a SQLite schema object governed by `SCHEMA_VERSION`; its append-only record format has the independent `EVENT_LOG_VERSION`. Each event has an increasing integer id, an ISO timestamp, the actor, the event kind, an optional item id, and a JSON object in `event_detail`. Board moves append their event inside the same immediate transaction as the move. Events are append-only; board triggers reject updates and deletes. The actor column is the acting agent id, except guard-repair events, which use `board`. Under engine 8 and later, each event by a registered agent also carries a `model` string snapshot in `event_detail`; legacy agents without a declaration use `unknown`. Declared models live under `agent_model:<agent id>` in `board_meta`, without changing the agent table or stable ids. Rejoining with another model appends a `model` event whose common snapshot holds the new declaration. This common snapshot is separate from the per-kind payload fields listed below. The following rows name the emitted kinds and the union of their operation-specific detail keys; CLI accept events additionally carry the frozen-check result described below:<!-- events:start -->| Kind | Actor | Detail fields |@@ -301,7 +301,7 @@ The `event` table is a SQLite schema object governed by `SCHEMA_VERSION`; its ap| `claim` | builder | `leaseUntil`, `digest` || `renew` | builder | `leaseUntil`, `digest` || `release` | builder | — |-| `submit` | builder | `commit`, `tree`, `policyCommit` |+| `submit` | builder | `commit`, `tree`, `policyCommit`, engine-9 `criterionDigest` || `reserve` | reviewer | `until` || `accept` | reviewer | `reason`, `commit` || `reject` | reviewer | `reason`, `commit` |diff --git a/src/board.js b/src/board.jsindex f9a876c8..ca514c23 100644--- a/src/board.js+++ b/src/board.js@@ -1114,9 +1114,12 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyComreturn total ? new Refused('CHILDREN_OPEN', `item #${id} has ${total} unfinished child items`) : null;},headIsNew: (found) => {- const wasRejected = board.db.prepare("SELECT 1 FROM verdict WHERE item_id = ? AND verdict_decision = 'REJECT' AND verdict_commit = ?").get(id, commit);+ const engineVersion = board.executionEngineVersion ?? ENGINE_VERSION;+ const rejectedHead = board.db.prepare(+ "SELECT 1 FROM verdict WHERE item_id = ? AND verdict_decision = 'REJECT' AND verdict_commit = ? AND (? < 9 OR verdict_digest = ?) LIMIT 1",+ ).get(id, commit, engineVersion, found.item_frozen_digest);const sameReopenedHead = found.item_verdict === null && found.item_commit === commit;- return wasRejected || sameReopenedHead+ return rejectedHead || sameReopenedHead? new Refused('HEAD_NOT_NEW', `#${id} already has a submission at ${commit.slice(0, 12)}; commit the rework first`): null;},@@ -1132,7 +1135,14 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyComitem_files: [...new Set([...(found.item_files ?? '').split('\n').filter(Boolean), ...files])].join('\n'),}),});- logEvent(board, agentId, 'submit', id, { commit, tree, ...(policyCommit ? { policyCommit } : {}) });+ const engineVersion = board.executionEngineVersion ?? ENGINE_VERSION;+ const criterionDigest = engineVersion >= 9 ? getItem(board, id).item_frozen_digest : null;+ logEvent(board, agentId, 'submit', id, {+ commit,+ tree,+ ...(policyCommit ? { policyCommit } : {}),+ ...(criterionDigest ? { criterionDigest } : {}),+ });});}diff --git a/src/machine.js b/src/machine.jsindex 87cd61b8..6c12da3f 100644--- a/src/machine.js+++ b/src/machine.js@@ -10,7 +10,7 @@*//** Executable move semantics, carried by every sealed move and retained during replay [H16]. */-export const ENGINE_VERSION = 8;+export const ENGINE_VERSION = 9;/** @typedef {'agent' | 'coordinator' | 'clock'} Role */diff --git a/test/agent-model-engine.test.js b/test/agent-model-engine.test.jsindex f21a0fc3..deca2a0f 100644--- a/test/agent-model-engine.test.js+++ b/test/agent-model-engine.test.js@@ -10,9 +10,9 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';-test('model declarations and event snapshots retain engines 1 through 7 semantics [O8,O3,H16]', (t) => {- assert.equal(ENGINE_VERSION, 8, 'model moves share the approved 0.8.5 engine');- for (const version of [1, 2, 3, 4, 5, 6, 7, 8]) {+test('model declarations and event snapshots retain engines 1 through 9 semantics [O8,O3,H16]', (t) => {+ assert.equal(ENGINE_VERSION, 9, 'model moves remain supported by the 0.8.10 engine');+ for (const version of [1, 2, 3, 4, 5, 6, 7, 8, 9]) {const board = store.openBoard(':memory:');t.after(() => store.closeBoard(board));const registration = prepareEngineMove(board, 'register', [{ lane: 'web', path: '/web', model: 'First Model' }]);@@ -29,7 +29,7 @@ test('model declarations and event snapshots retain engines 1 through 7 semanticassert.equal(changed.result, 'web-1');assert.equal(changed.events.length, version < 8 ? 0 : 1);assert.equal(store.agentAt(board, '/web').agent_model, version < 8 ? null : 'Second Model');- if (version === 8) {+ if (version >= 8) {assert.equal(changed.events[0].event_kind, 'model');assert.deepEqual(JSON.parse(changed.events[0].event_detail), { model: 'Second Model' });assert.deepEqual(JSON.parse(store.events(board)[0].event_detail), { lane: 'web', model: 'First Model' },diff --git a/test/board.test.js b/test/board.test.jsindex 851406cd..c1f276f1 100644--- a/test/board.test.js+++ b/test/board.test.js@@ -16,6 +16,9 @@ import { exportBoard } from '../src/exchange.js';import { main } from '../src/cli.js';import { briefFiles } from '../src/brief.js';import { JSON_SHAPES } from '../src/json.js';+import { ENGINE_VERSION } from '../src/machine.js';+import { pathToFileURL } from 'node:url';+import { unpackRelease } from './release-archive.js';const HOUR = 3_600_000;const SHA_A = 'a'.repeat(40);@@ -387,6 +390,138 @@ test('REJECT reopens the item; resubmitting a rejected head is refused [V6]', ()assert.equal(store.getItem(board, id).item_status, 'verified');});+test('a rejected commit resubmits after its bar was corrected [V4,B3]', async (t) => {+ const directory = mkdtempSync(join(tmpdir(), 'pullboard-corrected-reject-'));+ const repo = join(directory, 'repo');+ mkdirSync(repo);+ let durable;+ t.after(() => {+ if (durable) store.closeBoard(durable);+ rmSync(directory, { recursive: true, force: true });+ });++ execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: repo, stdio: 'pipe' });+ execFileSync('git', ['config', 'user.name', 'Pullboard Test'], { cwd: repo, stdio: 'pipe' });+ execFileSync('git', ['config', 'user.email', '[email protected]'], { cwd: repo, stdio: 'pipe' });+ writeFileSync(join(repo, 'page.html'), '<h1>Page</h1>\n');+ execFileSync('git', ['add', 'page.html'], { cwd: repo, stdio: 'pipe' });+ execFileSync('git', ['commit', '-q', '-m', 'feat(web): render a page [G1]'], { cwd: repo, stdio: 'pipe' });+ const commit = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: repo, encoding: 'utf8' }).trim();+ const tree = execFileSync('git', ['rev-parse', 'HEAD^{tree}'], { cwd: repo, encoding: 'utf8' }).trim();++ durable = store.openBoard(join(repo, '.git', 'pullboard', 'board.sqlite'), clock);+ store.register(durable, { lane: 'coordinator', path: repo });+ const builder = store.register(durable, { lane: 'web', path: join(directory, 'web-1') });+ const reviewer = store.register(durable, { lane: 'web', path: join(directory, 'web-2') });+ /** Freeze the current criterion deterministically for this real-board replay test. */+ const criterionFreeze = (item) => ({ text: item.item_criterion, digest: `digest:${item.item_criterion}` });+ assert.equal(ENGINE_VERSION, 9, 'corrected-bar resubmission is an engine-9 move rule');+ const id = store.addItem(durable, {+ by: 'coordinator', lane: 'web', title: 'Page', criterion: 'the page renders its heading',+ });+ const originalClaim = store.claim(durable, id, { agentId: builder, lane: 'web', leaseMs: HOUR, freeze: criterionFreeze });+ store.submit(durable, id, { agentId: builder, commit, tree });+ store.verify(durable, id, {+ agentId: reviewer, decision: 'REJECT', reason: 'BEHAVIOR_MISMATCH',+ note: 'the heading is missing', head: commit, digest: originalClaim.digest, policy: 'any',+ });++ store.claim(durable, id, { agentId: builder, lane: 'web', leaseMs: HOUR, freeze: criterionFreeze });+ assert.throws(+ () => store.submit(durable, id, { agentId: builder, commit, tree }),+ (error) => error.code === 'HEAD_NOT_NEW',+ 'the same rejected head is still refused while its criterion is unchanged',+ );+ store.editItem(durable, id, { agentId: 'coordinator', criterion: 'the page renders an accessible heading' });+ const correction = store.refreeze(durable, id, { agentId: 'coordinator', freeze: criterionFreeze });+ assert.notEqual(correction.after, originalClaim.digest);+ assert.equal(store.getItem(durable, id).item_owner, builder, 'refreeze keeps the builder claim for the corrected bar');++ assert.doesNotThrow(+ () => store.submit(durable, id, { agentId: builder, commit, tree }),+ 'the rejected commit is resubmitted unchanged after the coordinator corrects the criterion',+ );+ const item = store.getItem(durable, id);+ assert.equal(item.item_status, 'submitted');+ assert.equal(item.item_commit, commit);+ assert.equal(item.item_frozen_digest, correction.after, 'the resubmission is recorded against the new criterion digest');+ const rejects = store.verdictsFor(durable, id).filter((entry) => entry.verdict_decision === 'REJECT');+ assert.equal(rejects.length, 1);+ assert.equal(rejects[0].verdict_commit, commit);+ assert.equal(rejects[0].verdict_digest, originalClaim.digest, 'the original rejection remains bound to its original bar');+ assert.equal(store.events(durable, { itemId: id }).filter((event) => event.event_kind === 'reject').length, 1);+ const resubmission = JSON.parse(store.events(durable, { itemId: id }).at(-1).event_detail);+ assert.equal(resubmission.commit, commit);+ assert.equal(resubmission.criterionDigest, correction.after, 'the engine-9 submit event names its corrected frozen digest');+ store.verify(durable, id, {+ agentId: reviewer, decision: 'REJECT', reason: 'BEHAVIOR_MISMATCH',+ note: 'the corrected criterion still fails', head: commit, digest: correction.after, policy: 'any',+ });+ store.claim(durable, id, { agentId: builder, lane: 'web', leaseMs: HOUR, freeze: criterionFreeze });+ assert.throws(+ () => store.submit(durable, id, { agentId: builder, commit, tree }),+ (error) => error.code === 'HEAD_NOT_NEW',+ 'engine 9 refuses the same commit after a rejection at the unchanged corrected digest',+ );+ const allRejects = store.verdictsFor(durable, id).filter((entry) => entry.verdict_decision === 'REJECT');+ assert.equal(allRejects.length, 2);+ assert.equal(allRejects[1].verdict_digest, correction.after);++ const legacy = [+ store.openBoard(join(directory, 'engine-8-source.sqlite'), clock),+ store.openBoard(join(directory, 'engine-8-replica.sqlite'), clock),+ ];+ t.after(() => legacy.forEach((replica) => store.closeBoard(replica)));+ const oldIds = legacy.map((replica) => {+ store.register(replica, { lane: 'coordinator', path: '/legacy/repo' });+ const oldBuilder = store.register(replica, { lane: 'web', path: '/legacy/web-1' });+ store.register(replica, { lane: 'web', path: '/legacy/web-2' });+ return { oldBuilder, oldItem: store.addItem(replica, {+ by: 'coordinator', lane: 'web', title: 'Legacy page', criterion: 'the page renders its heading',+ }) };+ });+ for (const replica of legacy) {+ replica.db.prepare('UPDATE board_meta SET meta_value = ? WHERE meta_key = ?').run('8'.repeat(32), 'board_id');+ }+ const legacyClientDirectory = join(directory, 'engine-8-client');+ mkdirSync(legacyClientDirectory);+ unpackRelease('v0.8.6', legacyClientDirectory);+ const legacyEngine = await import(pathToFileURL(join(legacyClientDirectory, 'src/engine.js')).href);+ /** Freeze an engine-8 item with its captured verify policy, as released boards require. */+ const legacyFreeze = (item) => ({+ text: JSON.stringify({+ criterion: item.item_criterion,+ policy: { version: 1, commit: 'a'.repeat(40), verify: { policy: 'any', family: 'off' } },+ }),+ digest: `digest:${item.item_criterion}`,+ });+ const oldMoves = [+ ['claim', (replica, ids) => [ids.oldItem, { agentId: ids.oldBuilder, lane: 'web', leaseMs: HOUR, freeze: legacyFreeze }]],+ ['submit', (replica, ids) => [ids.oldItem, { agentId: ids.oldBuilder, commit, tree }]],+ ['verify', (replica, ids) => [ids.oldItem, { agentId: 'web-2', decision: 'REJECT', reason: 'BEHAVIOR_MISMATCH', note: 'heading missing', head: commit, digest: 'digest:the page renders its heading', policy: 'any' }]],+ ['claim', (replica, ids) => [ids.oldItem, { agentId: ids.oldBuilder, lane: 'web', leaseMs: HOUR, freeze: legacyFreeze }]],+ ['editItem', (replica, ids) => [ids.oldItem, { agentId: 'coordinator', criterion: 'the page renders an accessible heading' }]],+ ['refreeze', (replica, ids) => [ids.oldItem, { agentId: 'coordinator', freeze: legacyFreeze }]],+ ['submit', (replica, ids) => [ids.oldItem, { agentId: ids.oldBuilder, commit, tree }]],+ ];+ let finalLegacyOutcome;+ oldMoves.forEach(([operation, argsFor], index) => {+ const args = argsFor(legacy[0], oldIds[0]);+ const move = legacyEngine.prepareEngineMove(legacy[0], operation, args, { id: `engine-8-resubmit-${index}` });+ assert.equal(move.engine, 8);+ const receipt = { sequence: index + 1, at: `2026-10-11T16:00:0${index}.000Z` };+ const sourceOutcome = legacyEngine.applyEngineMove(legacy[0], move, receipt);+ const replicaOutcome = applyEngineMove(legacy[1], move, receipt);+ assert.deepEqual(sourceOutcome, replicaOutcome, `engine-8 move ${operation} replays identically`);+ if (index < oldMoves.length - 1) assert.equal(sourceOutcome.error, undefined, `released engine-8 ${operation} applies`);+ if (index === oldMoves.length - 1) finalLegacyOutcome = sourceOutcome;+ });+ assert.equal(finalLegacyOutcome.error.code, 'HEAD_NOT_NEW', 'engine 8 still refuses a rejected commit after refreeze');+ assert.deepEqual(store.events(legacy[0]), store.events(legacy[1]), 'engine-8 event details replay without engine-9 additions');+ assert.ok(store.events(legacy[0]).filter((event) => event.event_kind === 'submit')+ .every((event) => !Object.hasOwn(JSON.parse(event.event_detail), 'criterionDigest')));+});+test('every verdict binds the submitted commit and the frozen digest [V8]', () => {const id = submitted();verdict(id, { agentId: 'web-2', decision: 'ACCEPT', head: SHA_B });