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(core): resume the checked review composition [E8,N19,H16]
Corey Olsondc88a52efdd3
diff --git a/docs/api.md b/docs/api.mdindex 3ea0c754..953a9527 100644--- a/docs/api.md+++ b/docs/api.md@@ -376,7 +376,7 @@ Each checkout with a committed npm lockfile runs `npm ci`, including lifecycle sPost-run cleanup reports `RUNNER_CLEANUP_TIMEOUT` after 30 seconds instead of leaving the controller waiting indefinitely. That failure does not retry the command. The physical runner slot is released after its known children have drained and no unresolved live process remains; an unresolved live process keeps the slot occupied until cleanup can be verified.-New acceptances seal the exact checked commit in `review.head`. A stale re-review lands that checked composition while retaining the original submitted commit as the item identity; landing snapshots record `reviewedCommit` when it differs. Adoption and publishing refuse if that proof changes. Historical released-engine receipts retain their original replay meaning. The checked commit is pinned at `refs/pullboard/items/<id>/<first-12-sha>`; another replica must fetch that ref's Git objects before the sealed re-review can clear its stale state. Missing objects fail closed. The checked-head meaning starts at engine 20 on this composition. Before landing, merge the current trunk and take its next engine number; no number is reserved and earlier records retain their original meaning.+New acceptances seal the exact checked commit in `review.head`. A stale re-review lands that checked composition while retaining the original submitted commit as the item identity; landing snapshots record `reviewedCommit` when it differs. Adoption and publishing refuse if that proof changes. Historical released-engine receipts retain their original replay meaning. Coordinator resume derives `item_checked_commit` on its pending-merge cards. Merge groups, active integration claims and the printed merge command use that accepted composition; `item_commit` remains the immutable submitted identity, and stale cards still stay out of `toMerge`. The checked commit is pinned at `refs/pullboard/items/<id>/<first-12-sha>`; another replica must fetch that ref's Git objects before the sealed re-review can clear its stale state. Missing objects fail closed. The checked-head meaning starts at engine 25 on this composition, as assigned by the coordinator. Before landing, merge the actual trunk; if trunk has passed 25, use its next engine number and notify the coordinator. Earlier records retain their original meaning.A re-review seals the union of the original item paths and paths changed by the checked repair against its reviewed trunk. Files added by a repair therefore participate in later stale-verdict detection.diff --git a/docs/formats.md b/docs/formats.mdindex 1ec703af..1fb2171e 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -102,7 +102,7 @@ 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` | `20` | `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` | `25` | `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.8.8 released engine 9, which 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.@@ -115,7 +115,7 @@ Engine 12 records declined person row decisions without replacing the exact sourEngine 19 makes a corrected bar record why the old one was wrong. Once an item has ever been claimed, an `editItem` that changes its criterion or check must carry `reason`, the text of what the old bar got wrong; without one it is refused with `BAR_REASON`, naming `--reason`. The edit event then records `reason` and `barCorrection: {fields, reject}`: `fields` lists `criterion` and/or `check`, and `reject` is `{verdict, by, reason, at}` when the item's newest verdict is a reject no earlier correction already explained, or `null`. That reject is counted as caused by the bar. The board derives `barCorrection` from its own rows; a move supplies only `reason`. An edit before any claim needs no reason and records one only if given. `pullboard stats` JSON adds `bars`, keyed by agent: `{corrections, barRejects, buildRejects}`. Corrections and the rejects they explain count to the agent who corrected the bar; any other reject counts as the build's, to the agent who added the item. An `editItem` move carrying `reason` requires engine 19, and older engines refuse it with `RELAY_MOVE` before changing their board or cursor. Moves recorded under engines 18 and earlier replay without the reason rule. Trunk skipped engine numbers 13 through 18. A later engine change takes the current trunk's next number, keeping every earlier recorded engine's replay unchanged.-Engine 20 binds a review to the immutable submitted commit, the exact checked composition, its reviewed trunk and sorted candidate paths. A stale, unmerged acceptance can be re-reviewed without rewriting the submission; landing uses its accepted checked composition. New review metadata and landing batches carrying `reviewedCommit` require engine 20, including later updates to those batches. Previously recorded outcomes replay before this state-dependent version check, and previously released engines retain their original review and landing behavior. Older clients refuse engine-20 moves before changing their board or replay cursor; upgrade linked clients before using checked-composition reviews. Before landing, merge the current trunk and take its next engine number; no number is reserved.+Engine 25 binds a review to the immutable submitted commit, the exact checked composition, its reviewed trunk and sorted candidate paths. A stale, unmerged acceptance can be re-reviewed without rewriting the submission; landing uses its accepted checked composition. New review metadata and landing batches carrying `reviewedCommit` require engine 25, including later updates to those batches. Previously recorded outcomes replay before this state-dependent version check, and previously released engines retain their original review and landing behavior. Older clients refuse engine-25 moves before changing their board or replay cursor; upgrade linked clients before using checked-composition reviews. The coordinator assigned engine 25 to this change. Before landing, merge the actual trunk; if trunk has passed 25, use its next engine number and notify the coordinator.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, includingdiff --git a/src/cli.js b/src/cli.jsindex 492ce442..1a22f08f 100644--- a/src/cli.js+++ b/src/cli.js@@ -1044,7 +1044,7 @@ function coordinatorNext(card, rows) {if (card.toVerify.length) return 'pullboard next --verify --as coordinator, or a verifier that built nothing: pullboard worktree review --model "<model name>"';if (card.toMerge.length) {const [first] = card.toMerge;- return `merge #${first.item_id}: git merge --no-edit ${first.item_commit.slice(0, 12)}, run the gate, then pullboard merged ${first.item_id} <merge commit>`;+ return `merge #${first.item_id}: git merge --no-edit ${(first.item_checked_commit ?? first.item_commit).slice(0, 12)}, run the gate, then pullboard merged ${first.item_id} <merge commit>`;}if (card.staleVerdicts?.length) {const item = card.staleVerdicts[0];@@ -1069,7 +1069,7 @@ function integrationClaims(root, item, shouts, now) {if (shout.shout_evidence_item !== item.item_id) continue;if (shout.shout_evidence_kind === 'receipt') actors.delete(shout.shout_from);else if (shout.shout_evidence_kind === 'attempt' && shout.shout_evidence_outcome === 'integrating'- && contains(root, item.item_commit, shout.shout_evidence_commit)) {+ && contains(root, item.item_checked_commit ?? item.item_commit, shout.shout_evidence_commit)) {actors.set(shout.shout_from, shout);}}@@ -1094,7 +1094,7 @@ function verifiedMergeGroups(root, items, shouts, now) {}if (claimed.expired) staleIntegrations.push({ item, ...claimed.expired });try {- requireTrunkMerge(root, item.item_commit);+ requireTrunkMerge(root, item.item_checked_commit ?? item.item_commit);groups.clean.push(item);} catch (error) {if (error.code !== 'MERGE_CONFLICT') throw error;@@ -1291,7 +1291,8 @@ function resumeHere(io) {const me = whoAmI(ctx, board);const projector = verdictProjector(root, board);const all = store.listItems(board, { all: true }).map(projector.project);- const pendingMerges = all.filter((item) => item.item_status === 'verified' && !item.item_merged_commit);+ const pendingMerges = all.filter((item) => item.item_status === 'verified' && !item.item_merged_commit)+ .map(item => ({ ...item, item_checked_commit: store.checkedLandingCommit(board, item) }));const toMerge = pendingMerges.filter(item => !item.item_verdict_state);const staleVerdicts = pendingMerges.filter(item => item.item_verdict_state);const decisionSections = isMain ? coordinatorDecisionSections(board, ctx) : null;diff --git a/src/machine.js b/src/machine.jsindex 05c1a0c3..0945c14e 100644--- a/src/machine.js+++ b/src/machine.js@@ -10,10 +10,10 @@*//** Executable move semantics, carried by every sealed move and retained during replay [H16]. */-export const ENGINE_VERSION = 20;+export const ENGINE_VERSION = 25;/** First released engine binding the checked composition, review trunk and paths [E8,H16]. */-export const VERDICT_REVIEW_ENGINE = 20;+export const VERDICT_REVIEW_ENGINE = 25;/** @typedef {'agent' | 'coordinator' | 'clock'} Role */diff --git a/test/agent-model-engine.test.js b/test/agent-model-engine.test.jsindex 15cfc238..a704c37c 100644--- a/test/agent-model-engine.test.js+++ b/test/agent-model-engine.test.js@@ -11,7 +11,7 @@ import { tmpdir } from 'node:os';import { join } from 'node:path';test('model declarations and event snapshots retain engines 1 through 19 semantics [O8,O3,H16]', (t) => {- assert.equal(ENGINE_VERSION, 20, 'the next writer preserves every historical model snapshot through main engine 19');+ assert.equal(ENGINE_VERSION, 25, 'the next writer preserves every historical model snapshot through main engine 19');for (const version of Array.from({ length: ENGINE_VERSION }, (_, index) => index + 1)) {const board = store.openBoard(':memory:');t.after(() => store.closeBoard(board));diff --git a/test/checked-composition-resume.test.js b/test/checked-composition-resume.test.jsnew file mode 100644index 00000000..0ab2c9cb--- /dev/null+++ b/test/checked-composition-resume.test.js@@ -0,0 +1,115 @@+/**+ * Standalone regression for coordinator resume after a stale verdict is freshly reviewed.+ * Run with PULLBOARD_409_CANDIDATE_ROOT pointing at the source checkout under test.+ */+import assert from 'node:assert/strict';+import { mkdirSync, writeFileSync } from 'node:fs';+import { join, resolve } from 'node:path';+import { pathToFileURL } from 'node:url';+import { after, test } from 'node:test';++const candidateRoot = process.env.PULLBOARD_409_CANDIDATE_ROOT ?? resolve(import.meta.dirname, '..');+assert.ok(candidateRoot, 'set PULLBOARD_409_CANDIDATE_ROOT to the candidate checkout');++const { createE2eHelpers } = await import(pathToFileURL(resolve(candidateRoot, 'test/e2e-helpers.js')).href);+const helpers = createE2eHelpers();+after(helpers.cleanup);++/** Commit the fixture's current tree through its real hooks. */+function commit(box, cwd, subject) {+ box.git(cwd, 'add', '-A');+ box.git(cwd, 'commit', '-q', '-m', subject);+ return box.git(cwd, 'rev-parse', 'HEAD');+}++/** Create one cited row item and claim it from the already joined builder worktree. */+function addAndClaim(box, title) {+ const brief = 'Files:\n- web/shared.txt\nTest:\n- inspect the reviewed composition\n';+ const added = box.run(box.repo, 'add', 'web', title, '--route', 'strong', '--specs', 'G1',+ '--criterion', 'the cited row holds', '--check', 'true', '--brief', brief);+ assert.equal(added.code, 0, added.err || added.out);+ const itemId = Number(/#(\d+)/u.exec(added.out)?.[1]);+ assert.ok(itemId > 0, added.out);+ const claimed = box.run(box.web, 'claim', String(itemId));+ assert.equal(claimed.code, 0, claimed.err || claimed.out);+ return itemId;+}++/** Submit a committed shared-file edit and return its immutable submitted head. */+function submitShared(box, itemId) {+ writeFileSync(join(box.web, 'web/shared.txt'), 'submitted side\n');+ const submitted = commit(box, box.web, 'feat(web): submit shared change [G1]');+ const result = box.run(box.web, 'submit', String(itemId));+ assert.equal(result.code, 0, result.err || result.out);+ return submitted;+}++/** Accept the exact submitted commit through the public CLI, then restore the main checkout. */+function acceptSubmitted(box, itemId, submitted) {+ box.git(box.repo, 'switch', '-q', '--detach', submitted);+ const accepted = box.run(box.repo, 'verify', String(itemId), 'accept', '--as', 'coordinator',+ '--note', 'The submitted change passed its frozen check.');+ assert.equal(accepted.code, 0, accepted.err || accepted.out);+ box.git(box.repo, 'switch', '-q', 'main');+}++test('coordinator resume guides and groups the checked composition after stale re-review [E8,N19]',+ { timeout: 120_000 }, async () => { // budget: hang ceiling for private Git worktrees and public CLI checks; not a speed target.+ const box = helpers.project();+ box.env.LC_ALL = 'C';+ mkdirSync(join(box.repo, 'web'), { recursive: true });+ writeFileSync(join(box.repo, 'web/shared.txt'), 'base\n');+ commit(box, box.repo, 'chore(web): create shared-file base [G1]');+ box.git(box.web, 'merge', '-q', '--ff-only', 'main');++ const itemId = addAndClaim(box, 'Fresh composition');+ const submitted = submitShared(box, itemId);+ acceptSubmitted(box, itemId, submitted);++ writeFileSync(join(box.repo, 'web/shared.txt'), 'main side\n');+ commit(box, box.repo, 'feat(web): update the same line on main [G1]');++ const reviewer = join(box.dir, 'composition-reviewer');+ box.git(box.repo, 'worktree', 'add', '-q', '--detach', reviewer, submitted);+ const joined = box.run(reviewer, 'join', 'web', '--route', 'strong');+ assert.equal(joined.code, 0, joined.err || joined.out);++ const conflict = box.tryGit(reviewer, 'merge', '-q', '--no-edit', 'main');+ assert.notEqual(conflict.status, 0, 'the original submitted commit must conflict with the same-line main change');+ assert.match(`${conflict.stdout ?? ''}${conflict.stderr ?? ''}`, /CONFLICT \(content\): Merge conflict in web\/shared\.txt/u,+ 'the failure must be the intended content conflict');+ writeFileSync(join(reviewer, 'web/shared.txt'), 'resolved composition\n');+ const checked = commit(box, reviewer, 'fix(web): resolve against current main [G1]');++ assert.notEqual(checked, submitted, 'the resolution is a separate checked composition');+ assert.equal(box.tryGit(reviewer, 'merge-base', '--is-ancestor', 'main', checked).status, 0, 'the checked resolution contains current main');+ const reReview = box.run(reviewer, 'verify', String(itemId), 'accept', '--note',+ 'The exact resolution against current main passed the frozen check.');+ assert.equal(reReview.code, 0, reReview.err || reReview.out);++ // Complete the real first-run view step; no forged receipt can mask the guidance under test.+ const view = await helpers.startView(box, box.repo);+ await view.stop();++ const resumed = box.run(box.repo, 'resume', '--json');+ assert.equal(resumed.code, 0, resumed.err || resumed.out);+ const document = JSON.parse(resumed.out);+ assert.equal(document.setup, null, 'the actual view bind completed setup before merge guidance is judged');+ assert.match(document.next, new RegExp('git merge --no-edit ' + checked.slice(0, 12)), 'resume names the freshly accepted checked resolution');+ assert.equal(document.toMerge.find(item => item.item_id === itemId)?.item_commit, submitted, 'the original submitted identity remains immutable');+ const cleanIds = document.verifiedNotMerged.clean.map(item => item.item_id);+ const conflictIds = document.verifiedNotMerged.conflicts.map(entry => entry.item.item_id);+ const item = document.all.find(entry => entry.item_id === itemId);+ assert.deepEqual({+ stillStale: Boolean(item?.item_verdict_state),+ groupedClean: cleanIds.includes(itemId),+ groupedConflict: conflictIds.includes(itemId),+ }, {+ stillStale: false,+ groupedClean: true,+ groupedConflict: false,+ }, 'resume must group the latest checked composition after fresh re-review');+ box.git(box.repo, 'merge', '--no-edit', checked);+ assert.equal(box.tryGit(box.repo, 'merge-base', '--is-ancestor', checked, 'HEAD').status, 0, 'the exact indicated resolution actually merges onto current main');+ });+diff --git a/test/pending-refreeze.test.js b/test/pending-refreeze.test.jsindex 569e28c3..e260ef66 100644--- a/test/pending-refreeze.test.js+++ b/test/pending-refreeze.test.js@@ -261,7 +261,7 @@ async function checkDependencyLegacyClients(cleanup, directory, snapshot, target}test('dependency edits replay the same on every engine [B3,V2,H16]', async (t) => {- assert.equal(ENGINE_VERSION, 20, 'the next writer retains all recorded dependency-edit behavior');+ assert.equal(ENGINE_VERSION, 25, 'the next writer retains all recorded dependency-edit behavior');const directory = mkdtempSync(join(tmpdir(), 'pullboard-dependency-engines-'));const cleanup = [];t.after(() => {diff --git a/test/team-engine.test.js b/test/team-engine.test.jsindex d0b41e4f..08988eb5 100644--- a/test/team-engine.test.js+++ b/test/team-engine.test.js@@ -83,7 +83,7 @@ test('engine 12 acceptance receipts stay exact and sealed re-review needs a newe}const originalVerdicts = store.verdictsFor(one, 1);const reReview = { ...prepareEngineMove(one, 'verify', [1, verdict({ commit: COMMIT, head: COMMIT, trunk: TRUNK, paths: ['web/feature.js'] })], { id: 'sealed-new-review' }), engine: VERDICT_REVIEW_ENGINE };- assert.equal(reReview.engine, 20, 'the feature replays at its introduction version even after a later writer upgrade');+ assert.equal(reReview.engine, 25, 'the feature replays at its introduction version even after a later writer upgrade');const oldBefore = oldExchange.exportBoard(old);assert.throws(() => oldEngine.applyEngineMove(old, reReview, { sequence: 3, at: AT }), { code: 'ENGINE_VERSION' });assert.deepEqual(oldExchange.exportBoard(old), oldBefore, 'an actual old client refuses the future envelope before changing its prefix');