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): align review release guards and versions [V1,R1,H16,M1]
Corey Olson8ca110c639ca
diff --git a/docs/api.md b/docs/api.mdindex a860e8f7..d7a5a193 100644--- a/docs/api.md+++ b/docs/api.md@@ -103,7 +103,9 @@ The board-state API's item projection includes `check` and, when recorded, `checEach checkout is bound to the first agent session that writes there. The local Git directory holds only its session digest, agent id and timestamp; bindings are absent from board exports and relay snapshots. Another agent session gets `NOT_YOUR_CHECKOUT` and the command to make its own worktree. The same agent starting a new session runs `pullboard takeover`; the existing ordered shout records the takeover, addressed to the person for the main checkout or the coordinator for a lane checkout. Markerless terminals, reads, the view and person requests keep their existing behavior. A shout or decision addressed to its sender is refused with `SELF_SHOUT`.-`status.reviewQueue` contains `pending`, `reviewing` (distinct agents with live review leases), `reserved`, `oldestSubmittedAt` and `ageMs`. Age starts at each outstanding item's latest submit event; reserving or renewing its review does not reset it. An empty queue has `oldestSubmittedAt: null` and `ageMs: 0`.+`status.reviewQueue` contains `pending`, `reviewing` (distinct agents with live review leases), `reserved`, `oldestSubmittedAt` and `ageMs`. Age starts at each outstanding item's latest submit event; reserving or renewing its review does not reset it. An empty queue has `oldestSubmittedAt: null` and `ageMs: 0`. Among unreserved submissions, `awaitingFirstReview` counts items with no release since their latest submission; `releasedWithoutVerdict` counts those released without a verdict. `releasedItems` lists `{item, releases, reason}` with the cumulative release count and latest reason for that submission. Historical releases without a reason show `reason not recorded`.++Releasing a reserved review requires a nonempty one-line `--note` (or `--note-file`); the authenticated release action accepts the same `note` field. A refusal keeps the reservation and records no release. The same reviewer is not offered that submission again until it is resubmitted or an hour passes, while other reviewers remain eligible. Releasing a build claim keeps its existing behavior and does not require a reason.When outstanding reviews reach `verify.reviewRatio` times the active reviewers (default 3, with zero reviewers counting as one), `next` first offers a review the agent may take. This creates no claim or reservation. Its additive v1 `offer` has the review's `item` id, exact `command` to reserve it, `queue` and `ratio`; `build` previews the otherwise available build or is `null`. `next --verify <id>` reserves explicitly. `next --build` claims explicitly; a fresh claim's event detail records `reviewSkipped` with the offered id (or `null`), ratio and queue snapshot. Renewing an existing claim creates no new skip.diff --git a/docs/formats.md b/docs/formats.mdindex 3ce78143..7235641f 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -76,10 +76,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` | `4` | `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` | `5` | `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 4 retains support for older moves. Upgrade every linked device before using the new moves. The first change to released move semantics raises the engine once for the next release; all further move changes developed before that release share engine 4.+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. Upgrade every linked device before using the new moves.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/docs/lifecycle.md b/docs/lifecycle.mdindex 185450f0..55e2f22b 100644--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@ -50,10 +50,10 @@ Each move checks its guards in this order and refuses with the first one that do| Move | From | To | Who | Guards, in order || --- | --- | --- | --- | --- || claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), inLane (WRONG_LANE), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), laneOpen (LANE_HELD), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG) |-| release | claimed | open | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS) |+| release | claimed | open | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), reviewReleaseExplained (NOTE_REQUIRED) || lapse | claimed | open | clock, when its lease runs out | none || submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), gateConfigured (NO_GATE), gateGreen (GATE_RED), treeStillDuringGate (MOVED_DURING_GATE), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |-| reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) |+| reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) || accept | submitted | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonIsMet (BAD_REASON), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), itemCheckGreen (CHECK_RED or CHECK_UNVERIFIED), proofNoted (PROOF_REQUIRED) || reject | submitted | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED) || escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED) |@@ -127,6 +127,8 @@ Each move checks its guards in this order and refuses with the first one that do| BAD_REASON | an accept gives CRITERION_MET as its reason | a failed criterion is a reject: pullboard verify <id> reject --reason CODE || PROOF_REQUIRED | an accept notes how it was proved | --note "what you broke or which edge you tried, and what happened" || BAD_REASON | a reject names one of the reject reasons | --reason TEST_FAILURE, BEHAVIOR_MISMATCH, INSUFFICIENT_EVIDENCE, STALE_HEAD or OTHER |+| NOTE_REQUIRED | a review release gives a nonempty one-line reason, engine 5 or newer, only when freeing a submitted review reservation | release with --note "why", or --note-file <file> |+| REVIEW_COOLDOWN | the reviewer has not released this submission within the past hour, engine 5 or newer, only for the same reviewer and current submission | let another reviewer take it, or wait an hour or for a new submission || NOTE_REQUIRED | the move carries a note: what failed, what was tried, or why | --note "..." or --note-file <file> || BAD_DECISION | a verdict is accept or reject | pullboard verify <id> accept, or reject --reason CODE --note "..." |diff --git a/src/board.js b/src/board.jsindex f264c859..d5eb0bcc 100644--- a/src/board.js+++ b/src/board.js@@ -1002,6 +1002,7 @@ export function release(board, id, agentId, note = '') {joined: null,[IN_STATE]: () => new Refused('NOT_YOURS', `item #${id} is not claimed by you`),isHolder: (found) => (found.item_owner === agentId ? null : new Refused('NOT_YOURS', `item #${id} is not claimed by you`)),+ reviewReleaseExplained: null, // Claimed releases do not free a submitted review.},set: () => ({ item_owner: null, item_lease_until: null }),});@@ -1226,15 +1227,17 @@ export function reserveNextReview(board, { agentId, lane, leaseMs, policy, famil* @returns {any}*/function reserveWithin(board, id, { agentId, leaseMs, policy, familyPolicy = 'off' }) {- const currentItem = getItem(board, id);- const cooldown = currentItem.item_status === 'submitted' ? reviewReleaseCooldown(board, id, agentId) : null;- if (cooldown) throw new Refused('REVIEW_COOLDOWN', `you released the review of #${id}; try again after ${cooldown}, or let another reviewer take it`);const until = new Date(board.clock.now().getTime() + leaseMs).toISOString();moveItem(board, id, 'reserve', {checks: {coordinatorSaysAs: null,joined: null,[IN_STATE]: (found) => new Refused('NOT_SUBMITTED', `item #${id} is ${current(board, found).item_status}, not submitted`),+ /** Enforce the cooldown after state validation and before reviewer eligibility [V1]. */+ reviewCooldownElapsed: () => {+ const cooldown = reviewReleaseCooldown(board, id, agentId);+ return cooldown ? new Refused('REVIEW_COOLDOWN', `you released the review of #${id}; try again after ${cooldown}, or let another reviewer take it`) : null;+ },...reviewerChecks(board, { agentId, policy, familyPolicy }),},set: () => ({ item_review_by: agentId, item_review_until: until }),diff --git a/src/cli.js b/src/cli.jsindex 3e028bc8..02769fa3 100644--- a/src/cli.js+++ b/src/cli.js@@ -166,7 +166,7 @@ Workpullboard check [id] [--yes] show and run your item's check; --yes confirms a check set by someone elsethe command and its author print first; the project gate is pullboard gatepullboard claim <id> take or renew a lease; the first claim freezes the criterion- pullboard release <id> [--note "why"] hand it back; a review release needs a one-line reason+ pullboard release <id> [--note "why"] hand it back; a review release needs a one-line reasonpullboard submit <id> needs a clean tree and the gate green at HEAD (alias: done)pullboard verify <id> accept --note "what you broke or which edge you tried, and what happened"pullboard verify <id> reject --reason TEST_FAILURE --note "what failed"@@ -711,10 +711,6 @@ function withBoard(ctx, work) {/** Dispatch a board mutation locally, or seal it before any linked replica applies it. */async function ordered(ctx, board, operation, args) {- if (operation === 'release') {- const problem = store.reviewReleaseNoteProblem(board, args[0], args[1], args[2]);- if (problem) throw problem;- }const command = ['add', 'edit', 'merged'].includes(ctx.io.relayCommand?.cliOperation) ? ctx.io.relayCommand : undefined;/** Dispatch while this session holds the checkout, including long-running next/run loops. */const execute = () => relayLinked(ctx.info.root)@@ -2094,7 +2090,10 @@ function workCommands(io, args) {return 0;}),release: () => act(async (ctx, board, me) => {- const review = await ordered(ctx, board, 'release', [idArg(first), me.id, textArg(io, values, 'note') ?? '']);+ const args = [idArg(first), me.id, textArg(io, values, 'note') ?? ''];+ const problem = store.reviewReleaseNoteProblem(board, ...args);+ if (problem) throw problem;+ const review = await ordered(ctx, board, 'release', args);io.result?.({ id: idArg(first) });io.say(review ? `released the review of #${first}; the review is free again` : `released #${first}`);return 0;diff --git a/src/machine.js b/src/machine.jsindex 23e0c8e3..1e509d0d 100644--- a/src/machine.js+++ b/src/machine.js@@ -9,7 +9,7 @@* broken copy, and checks the declaration against the refusals board.js and cli.js raise today.*/-/** Executable move semantics; bump once per release after a released move's meaning changes [H16]. */+/** Executable move semantics, carried by every sealed move and retained during replay [H16]. */export const ENGINE_VERSION = 5;/** @typedef {'agent' | 'coordinator' | 'clock'} Role */@@ -130,6 +130,8 @@ export const GUARDS = [{ id: 'reasonIsMet', refuse: 'BAD_REASON', rule: 'an accept gives CRITERION_MET as its reason', next: 'a failed criterion is a reject: pullboard verify <id> reject --reason CODE', source: 'board' },{ id: 'proofNoted', refuse: 'PROOF_REQUIRED', rule: 'an accept notes how it was proved', next: '--note "what you broke or which edge you tried, and what happened"', source: 'board' },{ id: 'reasonCoded', refuse: 'BAD_REASON', rule: 'a reject names one of the reject reasons', next: '--reason TEST_FAILURE, BEHAVIOR_MISMATCH, INSUFFICIENT_EVIDENCE, STALE_HEAD or OTHER', source: 'board' },+ { id: 'reviewReleaseExplained', refuse: 'NOTE_REQUIRED', rule: 'a review release gives a nonempty one-line reason', next: 'release with --note "why", or --note-file <file>', source: 'board', when: 'engine 5 or newer, only when freeing a submitted review reservation' },+ { id: 'reviewCooldownElapsed', refuse: 'REVIEW_COOLDOWN', rule: 'the reviewer has not released this submission within the past hour', next: 'let another reviewer take it, or wait an hour or for a new submission', source: 'board', when: 'engine 5 or newer, only for the same reviewer and current submission' },{ id: 'noteGiven', refuse: 'NOTE_REQUIRED', rule: 'the move carries a note: what failed, what was tried, or why', next: '--note "..." or --note-file <file>', source: 'board' },];@@ -142,7 +144,7 @@ export const MOVES = [},{verb: 'release', from: ['claimed'], to: 'open', by: ['agent', 'coordinator'], refuse: 'NOT_YOURS',- guards: ['joined', 'itemExists', IN_STATE, 'isHolder'], command: 'pullboard release <id>',+ guards: ['joined', 'itemExists', IN_STATE, 'isHolder', 'reviewReleaseExplained'], command: 'pullboard release <id>',},{ verb: 'lapse', from: ['claimed'], to: 'open', by: ['clock'], guards: [], when: 'its lease runs out' },{@@ -152,7 +154,7 @@ export const MOVES = [},{verb: 'reserve', from: ['submitted'], to: 'submitted', by: ['agent', 'coordinator'], refuse: 'NOT_SUBMITTED',- guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree'],+ guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'reviewCooldownElapsed', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree'],sets: ['item_review_by', 'item_review_until'], command: 'pullboard next --verify',},{diff --git a/test/machine.test.js b/test/machine.test.jsindex 8d1ba986..64a956a3 100644--- a/test/machine.test.js+++ b/test/machine.test.js@@ -928,11 +928,14 @@ test('reserve refuses in the declared order, one failure peeled at a time [V15,const built = submittedItem(board);const open = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Page' });const reserveAs = (id, agentId, policy = 'coordinator', familyPolicy = 'off') => outcome(() => store.reserveReview(board, id, { agentId, leaseMs: 3_600_000, policy, familyPolicy }));- const fired = [reserveAs(999, 'web-2'), reserveAs(open, 'web-2'), reserveAs(built, 'web-1'), reserveAs(built, light), reserveAs(built, 'web-2')];+ const cooling = submittedItem(board);+ store.reserveReview(board, cooling, { agentId: 'web-2', leaseMs: 3_600_000, policy: 'any' });+ store.release(board, cooling, 'web-2', 'another reviewer should take it');+ const fired = [reserveAs(999, 'web-2'), reserveAs(open, 'web-2'), reserveAs(cooling, 'web-2'), reserveAs(built, 'web-1'), reserveAs(built, light), reserveAs(built, 'web-2')];store.reserveReview(board, built, { agentId: other, leaseMs: 3_600_000, policy: 'any' });fired.push(reserveAs(built, other, 'any', 'require'), reserveAs(built, 'web-2', 'any'), reserveAs(built, other, 'any'));assert.deepEqual(fired, [...declaredBoardOrder('reserve'), 'ok']);- assert.deepEqual(fired, ['NO_ITEM', 'NOT_SUBMITTED', 'SELF_VERIFY', 'ROUTE', 'COORDINATOR_VERIFIES', 'O2_FAMILY_MATCH', 'REVIEW_HELD', 'ok']);+ assert.deepEqual(fired, ['NO_ITEM', 'NOT_SUBMITTED', 'REVIEW_COOLDOWN', 'SELF_VERIFY', 'ROUTE', 'COORDINATOR_VERIFIES', 'O2_FAMILY_MATCH', 'REVIEW_HELD', 'ok']);} finally {lab.done();}diff --git a/test/relay-sealed.test.js b/test/relay-sealed.test.jsindex 66ea1883..27bc40e2 100644--- a/test/relay-sealed.test.js+++ b/test/relay-sealed.test.js@@ -611,7 +611,7 @@ test('two real clients enforce the verify policy captured in the item freeze [H1test('relay accepts engine 4 clients carrying sealed background completions [V2,H16]', async t => {const box = await fixture(t);const headers = { 'x-pullboard-engine': '4' };- assert.equal(ENGINE_VERSION, 4);+ assert.ok(ENGINE_VERSION >= 4, 'engine-4 background completions remain supported');const snapshot = await box.call(box.path + '/state', {method: 'PUT', token: box.person.token, headers,body: { sequence: 0, sealed: box.clientSeal(box.document, 'snapshot', 0) },@@ -621,9 +621,12 @@ test('relay accepts engine 4 clients carrying sealed background completions [V2,let move;try {const expected = { command: 'true', main: 'a'.repeat(40), request: '12345678-1234-1234-1234-123456789abc' };- move = prepareEngineMove(board, 'completeCheckBaseline', [1, {+ const prepared = prepareEngineMove(board, 'completeCheckBaseline', [1, {agentId: 'client-one', expected, baseline: { ...expected, result: 'green' },}]);+ assert.equal(prepared.engine, ENGINE_VERSION, 'new operations declare the current engine');+ move = { ...prepared, engine: 4 }; // Keep exercising the original engine-4 client.+ assert.equal(move.engine, 4);} finally { store.closeBoard(board); }const uploaded = await box.call(box.path + '/moves', {method: 'POST', headers, body: { sequence: 1, sealed: box.clientSeal(move, 'move', 1) },