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(verdict): derive carries from native Git [V1,V4,H16]
Corey Olson928a8e46fe5d
diff --git a/docs/lifecycle.md b/docs/lifecycle.mdindex 0018d90d..8fb0bb1f 100644--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@ -47,7 +47,7 @@ stateDiagram-v2| open | waiting for a builder; claimable once what it waits on is verified | none || claimed | an agent holds it under a lease, its criterion frozen | item_owner, item_lease_until, item_frozen_digest || submitted | a native build gated green, or an intaken outside commit awaiting sandbox verification, at a pinned commit | item_built_by, item_commit, item_frozen_digest |-| verified | another agent accepted it at the submitted commit | item_verified_by, item_commit |+| verified | another agent accepted the frozen work at this commit or its locally proved trunk-only merge | item_verified_by, item_commit || withdrawn (final) | nobody should build it; the reason stays on it | item_withdrawn_reason |## Moves@@ -95,7 +95,7 @@ Each move checks its guards in this order and refuses with the first one that do| CLOSED | refreeze: the item is in open, claimed, submitted | pullboard show <id> || CLOSED | refreeze: the item is in claimed | pullboard show <id> || CLOSED | withdraw: the item is in open, claimed, submitted | pullboard show <id> |-| MERGE_ONLY_PROOF | the exact gated merge carries the unwithdrawn acceptance of the unchanged bar and its recorded conflict resolution | submit normally for outside review if the merge cannot be proved |+| MERGE_ONLY_PROOF | real local Git proves the exact gated merge carries the unwithdrawn acceptance and records its conflict resolution; serialized builder facts never authorize it | submit normally for outside review if local Git cannot prove the merge || OUTSIDE_SOURCE | an outside author and exact fetched commit/tree are recorded with a trusted frozen criterion, without pretending a native builder gated it | fetch and intake the exact GitHub pull request again || NOT_JOINED | the caller is the main checkout, or an unreplaced worktree seat that joined a lane; an agent session's claims, submits and verdicts can be checked against its local ledger | pullboard join <lane> --model "<model name>" (see: pullboard lanes) || AGENT_REPLACED | the caller is the main checkout, or an unreplaced worktree seat that joined a lane; an agent session's claims, submits and verdicts can be checked against its local ledger | read the takeover and only shout on its exact hand-off item; continue work from the incoming agent worktree |diff --git a/src/board.js b/src/board.jsindex aed49ff4..69342c2b 100644--- a/src/board.js+++ b/src/board.js@@ -120,6 +120,7 @@ import {mergeOnlyProblem,} from './merge-only-verdict.js';import { MERGE_ONLY_VERDICT_ENGINE } from './merge-only-verdict-engine.js';+import { deriveMergeOnly } from './merge-only-source.js';import {atomic,logEvent,@@ -339,10 +340,10 @@ export { openBoardReadOnly } from './board-read-open.js';** @param {string} file* @param {{ now: () => Date }} [clock]- * @param {{ isMain?: boolean, onDiagnostic?: (message: string) => void, writeContext?: {command?:string, seat?:string, path?:string} }} [options] Only the main checkout may upgrade a shared board.+ * @param {{ isMain?: boolean, onDiagnostic?: (message: string) => void, writeContext?: {command?:string, seat?:string, path?:string}, gitRoot?: string }} [options] Only main upgrades schema; gitRoot is a local verification port, never replicated metadata.* @returns {{ db: DatabaseSync, clock: { now: () => Date } }}*/-export function openBoard(file, clock = systemClock, { isMain, onDiagnostic, writeContext } = {}) {+export function openBoard(file, clock = systemClock, { isMain, onDiagnostic, writeContext, gitRoot } = {}) {isMain = sharedSchemaOwner(file, isMain);if (file !== ':memory:' && isMain === false) {let boardVersion = 0;@@ -377,7 +378,7 @@ export function openBoard(file, clock = systemClock, { isMain, onDiagnostic, wridb = new DatabaseSync(file);db.exec(`PRAGMA busy_timeout = ${BOARD_BUSY_TIMEOUT_MS}`);if (file !== ':memory:' && isMain !== false) configureBoardJournal(db, writeContext);- const board = { db, clock, writeContext };+ const board = { db, clock, writeContext, gitRoot };let warmCounters = true;if (isMain !== false || file === ':memory:') {// Migrate and audit only a board whose version is behind; a drifted shape is reported and left alone (#1047).@@ -1133,17 +1134,18 @@ export function release(board, id, agentId, note = '') {* @param {{ agentId: string, commit: string, tree: string, files?: string[], policyCommit?: string, note?: string }} at - `files`: what the* item's own commits changed since its claim; a rework adds to what the first attempt changed.*/-export function submit(board, id, { agentId, commit, tree, files = [], policyCommit = null, note, submissionProof: proof, infra = null, mergeOnly }) {+export function submit(board, id, { agentId, commit, tree, files = [], policyCommit = null, note, submissionProof: proof, infra = null, gateGreen }) {let recordedProof;if (note !== undefined && (typeof note !== 'string' || !note.trim() || /[\r\n\u2028\u2029]/u.test(note))) {throw new Refused('USAGE', 'a submission note, when present, is one nonempty line');}atomic(board, () => {- const carry = mergeOnly !== undefined;- const basis = carry ? mergeOnlyBasis(board, getItem(board, id)) : null;- const carriedProblem = found => (board.executionEngineVersion ?? ENGINE_VERSION) < MERGE_ONLY_VERDICT_ENGINE- ? new Refused('MERGE_ONLY_PROOF', 'upgrade Pullboard before carrying an acceptance across a merge')- : mergeOnlyProblem(board, found, mergeOnly, { agentId, commit, tree, policyCommit });+ const modern = (board.executionEngineVersion ?? ENGINE_VERSION) >= MERGE_ONLY_VERDICT_ENGINE;+ const basis = modern && gateGreen === true ? mergeOnlyBasis(board, getItem(board, id)) : null;+ const mergeOnly = basis && !itemAuthorProblem(board, getItem(board, id), basis.by)+ ? deriveMergeOnly(board.gitRoot, basis, { commit, tree, policyCommit }) : null;+ const carry = Boolean(mergeOnly);+ const carriedProblem = found => mergeOnlyProblem(board, found, mergeOnly, { commit, tree, policyCommit });const notYours = () => new Refused('NOT_YOURS', `item #${id} is not claimed by you; claim it first`);moveItem(board, id, 'submit', {...(carry ? { transition: MOVES.find(move => move.verb === 'submit-merge') } : {}),@@ -1216,6 +1218,7 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyCom...(criterionDigest ? { criterionDigest } : {}),...(note === undefined ? {} : { note: note.trim() }),...(recordedProof ? { submissionProof: recordedProof } : {}), ...(infra ? { infra } : {}),+ ...(modern && gateGreen !== undefined ? { gateGreen: gateGreen === true } : {}),...(carry ? { mergeOnly } : {}),});});diff --git a/src/cli-context.js b/src/cli-context.jsindex 9434da52..7a1fa769 100644--- a/src/cli-context.js+++ b/src/cli-context.js@@ -42,6 +42,7 @@ export {*/export function withBoard(ctx, work, opened) {const board = opened ?? store.openBoard(ctx.file, ctx.clock, { isMain: ctx.allowSchemaUpgrade,+ gitRoot: ctx.info.root,writeContext: { command: ctx.io.relayCommand?.cliOperation, path: ctx.info.root, ...(ctx.info.isMain ? { seat: 'coordinator' } : {}) },/** Report each source mismatch once through this invocation's text or JSON diagnostics. */onDiagnostic(message) {@@ -52,6 +53,7 @@ export function withBoard(ctx, work, opened) {ctx.io.err(message);},});+ board.gitRoot = ctx.info.root; // A connection-local verification port, never board or wire metadata.return withOpenedBoard(ctx, work, board);}diff --git a/src/commands/submit.js b/src/commands/submit.jsindex 9468dde6..004a695e 100644--- a/src/commands/submit.js+++ b/src/commands/submit.js@@ -86,9 +86,6 @@ import {withBoard,} from '../cli.js';import { recordedRecovery } from '../recorded-recovery.js';-import { mergeOnlyBasis } from '../merge-only-verdict.js';-import { captureMergeOnly } from '../merge-only-source.js';-import { itemAuthorProblem } from '../item-authors.js';/*** Submit: a clean tree, nothing untracked, the gate green at HEAD, then the board (V4).@@ -109,7 +106,7 @@ export async function submitHere(ctx, id, infra) {if (recordedRecovery(board, recovered)) return { me, recorded: true };const item = store.getItem(board, id);const trunk = requireTrunkMerge(root, recovered.args[1].commit);- if ((barReadySetting(board).enabled || recovered.args[1].mergeOnly) && (recovered.args[1].policyCommit !== trunk.commit || !contains(root, trunk.commit, recovered.args[1].commit))) {+ if (barReadySetting(board).enabled && (recovered.args[1].policyCommit !== trunk.commit || !contains(root, trunk.commit, recovered.args[1].commit))) {throw new Refused('MAIN_NOT_COMPOSED', 'the unrecorded recovered submission has no proof for current main; run pullboard inbox to synchronize its original receipt, or ask the coordinator to resolve the pending move before a fresh submit; the original request is retained');}refuseUnverifiedStack(root, board, item, recovered.args[1].commit, trunk);@@ -222,14 +219,10 @@ export async function submitHere(ctx, id, infra) {const waivedLines = waived ? waived.map(waiverLine) : [];await withBoard(ctx, async (board) => {refuseUnverifiedStack(root, board, store.getItem(board, id), commit, currentTrunk);- const basis = mergeOnlyBasis(board, store.getItem(board, id));- const mergeOnly = gate.isGreen && !waived && basis && !itemAuthorProblem(board, store.getItem(board, id), basis.by)- && currentTrunk.commit === acceptedMain.commit ? captureMergeOnly(root,- basis, { commit, tree: headTree(root) ?? '', trunk: currentTrunk.commit }) : null;// The waived run is written to the item's thread before the submission, so no waived proof reads as green.if (waived) await ordered(ctx, board, 'appendFact', [id, { agentId: me.id, kind: 'measurement', text: `submission proof at ${commit.slice(0, 12)} was red and is recorded as waived, not green; every failure is covered by a live person waiver:\n${waivedLines.join('\n')}` }]);return await ordered(ctx, board, 'submit', [id, { agentId: me.id, commit, tree: headTree(root) ?? '', files: filesSince(root, id, claimHead, commit), policyCommit: acceptedMain.commit, ...(infraRecord ? { infra: infraRecord } : {}),- ...(mergeOnly ? { mergeOnly } : {}),+ gateGreen: gate.isGreen && !waived,submissionProof: { version: 1, files: gate.files, full: gate.full, deferred: gate.deferred, reason: gate.reason, ...(gate.deferredFiles ? { deferredFiles: gate.deferredFiles } : {}) },...(gate.deferred ? { note: gate.deferredFiles ? deferredSelectionNote(gate.deferredFiles) : 'full suite deferred to the landing gate' } : {}) }]);});diff --git a/src/machine.js b/src/machine.jsindex 4d09b8cb..26009aef 100644--- a/src/machine.js+++ b/src/machine.js@@ -84,7 +84,7 @@ export const STATES = [{ id: 'claimed', means: 'an agent holds it under a lease, its criterion frozen', requires: ['item_owner', 'item_lease_until', 'item_frozen_digest'] },{ id: 'submitted', means: 'a native build gated green, or an intaken outside commit awaiting sandbox verification, at a pinned commit', requires: ['item_built_by', 'item_commit', 'item_frozen_digest'] },{- id: 'verified', means: 'another agent accepted it at the submitted commit', requires: ['item_verified_by', 'item_commit'],+ id: 'verified', means: 'another agent accepted the frozen work at this commit or its locally proved trunk-only merge', requires: ['item_verified_by', 'item_commit'],proof: {says: 'an immutable ACCEPT on the frozen criterion by its independent verifier, at this commit or bound by an ordered merge-only receipt',sql: "EXISTS (SELECT 1 FROM verdict v WHERE v.item_id = NEW.item_id AND v.verdict_decision = 'ACCEPT' AND v.verdict_digest = NEW.item_frozen_digest AND v.verdict_by = NEW.item_verified_by AND v.verdict_by <> NEW.item_built_by AND (v.verdict_commit = NEW.item_commit OR EXISTS (SELECT 1 FROM event e WHERE e.item_id = NEW.item_id AND e.event_kind = 'merge-only-accept' AND json_extract(e.event_detail,'$.verdict') = v.verdict_id AND json_extract(e.event_detail,'$.commit') = NEW.item_commit AND json_extract(e.event_detail,'$.tree') = NEW.item_tree AND json_extract(e.event_detail,'$.digest') = NEW.item_frozen_digest AND json_extract(e.event_detail,'$.by') = v.verdict_by)))",@@ -95,7 +95,7 @@ export const STATES = [/** @type {Guard[]} */export const GUARDS = [- { id: 'mergeOnlyRecorded', refuse: 'MERGE_ONLY_PROOF', rule: 'the exact gated merge carries the unwithdrawn acceptance of the unchanged bar and its recorded conflict resolution', next: 'submit normally for outside review if the merge cannot be proved', source: 'board' },+ { id: 'mergeOnlyRecorded', refuse: 'MERGE_ONLY_PROOF', rule: 'real local Git proves the exact gated merge carries the unwithdrawn acceptance and records its conflict resolution; serialized builder facts never authorize it', next: 'submit normally for outside review if local Git cannot prove the merge', source: 'board' },{ id: 'outsideSubmission', refuse: 'OUTSIDE_SOURCE', rule: 'an outside author and exact fetched commit/tree are recorded with a trusted frozen criterion, without pretending a native builder gated it', next: 'fetch and intake the exact GitHub pull request again', source: 'board' },{ id: IN_STATE, refuse: '', rule: "the move can start from the item's current state", next: 'pullboard show <id>', source: 'board' },{ id: 'joined', refuse: 'NOT_JOINED', alsoRefuses: [{ code: 'AGENT_REPLACED', next: 'read the takeover and only shout on its exact hand-off item; continue work from the incoming agent worktree' }, { code: 'SESSION_LEDGER', next: 'make the agent-session ledger named in the message readable and writable by this user, then run the command again' }], rule: 'the caller is the main checkout, or an unreplaced worktree seat that joined a lane; an agent session\'s claims, submits and verdicts can be checked against its local ledger', next: 'pullboard join <lane> --model "<model name>" (see: pullboard lanes)', source: 'cli' },diff --git a/src/merge-only-source.js b/src/merge-only-source.jsindex ab9a0811..968a8a22 100644--- a/src/merge-only-source.js+++ b/src/merge-only-source.js@@ -1,12 +1,15 @@/** Bounded Git proof that a resubmission adds only trunk and actual conflict resolutions [V1,V4]. */import { spawnSync } from 'node:child_process';-import { cleanGitEnvironment } from './git.js';+import {+ cleanGitEnvironment,+ mainCheckout,+} from './git.js';/** Read immutable objects with fixed merge rules, bounded time/output and no external diff drivers. */function readGit(root, args, statuses, deadline) {const remaining = Math.min(5000, deadline - Date.now());if (remaining <= 0) throw new Error('merge proof budget exhausted');- const result = spawnSync('git', ['--no-replace-objects', '-c', 'merge.conflictStyle=merge',+ const result = spawnSync('git', ['--no-replace-objects', '-c', 'merge.conflictStyle=merge', '-c', 'merge.renormalize=false','-c', 'core.attributesFile=/dev/null', ...args], {cwd: root, env: cleanGitEnvironment(), encoding: 'utf8', timeout: remaining, maxBuffer: 2 * 1024 * 1024,});@@ -81,3 +84,15 @@ export function captureMergeOnly(root, basis, { commit, tree, trunk }) {reopen: basis.reopen, paths, resolutionDiff };} catch { return null; }}++/** Derive from this connection's real repository, never a serialized caller's proposed source facts. */+export function deriveMergeOnly(root, basis, { commit, tree, policyCommit }) {+ if (!root || !basis) return null;+ try {+ const branch = mainCheckout(root)?.branch;+ if (!branch?.startsWith('refs/heads/')) return null;+ const trunk = readGit(root, ['rev-parse', '--verify', `${branch}^{commit}`], [0], Date.now() + 5000).trim();+ if (trunk !== policyCommit) return null;+ return captureMergeOnly(root, basis, { commit, tree, trunk });+ } catch { return null; }+}diff --git a/src/moves/submit.js b/src/moves/submit.jsindex c3be6f9f..c761d35a 100644--- a/src/moves/submit.js+++ b/src/moves/submit.js@@ -27,7 +27,7 @@ function existingEngine(args, board, at) {/** Keep outside-source isolation as the original maximum over the older engine rule. */function minimumEngine(args, board, at) {const outside = board && Boolean(outsideSource(board, args[0]));- return Math.max(args[1]?.mergeOnly !== undefined ? MERGE_ONLY_VERDICT_ENGINE : 1,+ return Math.max(args[1]?.gateGreen !== undefined ? MERGE_ONLY_VERDICT_ENGINE : 1,outside ? OUTSIDE_INTAKE_ENGINE : 1, existingEngine(args, board, at));}diff --git a/src/relay.js b/src/relay.jsindex 23b1e2c1..726c4109 100644--- a/src/relay.js+++ b/src/relay.js@@ -411,7 +411,7 @@ async function rawRequest(state, path, { method = 'GET', body, allowMissing = fa/** Read durable local event rows; their ids are the crash-safe outbox after the saved cursor. */export function localRecords(root, work) {const info = repoInfo(root);- const board = store.openBoard(join(info.commonDir, 'pullboard', 'board.sqlite'), undefined, { isMain: codeIsFromMain() });+ const board = store.openBoard(join(info.commonDir, 'pullboard', 'board.sqlite'), undefined, { isMain: codeIsFromMain(), gitRoot: root });try { return work(board); } finally { store.closeBoard(board); }}@@ -977,7 +977,7 @@ async function catchUp(root, file, state, io) {}let pendingRefusal;for (const record of remote.events) {- const board = store.openBoard(join(repoInfo(root).commonDir, 'pullboard', 'board.sqlite'), undefined, { isMain: codeIsFromMain() });+ const board = store.openBoard(join(repoInfo(root).commonDir, 'pullboard', 'board.sqlite'), undefined, { isMain: codeIsFromMain(), gitRoot: root });let outcome;try { outcome = await replayRelayRecord(board, key, state, record); } finally { store.closeBoard(board); }// Exact ciphertext identifies an interrupted send even when its document was refused before replay.@@ -1403,8 +1403,8 @@ export async function relayRecover(root, skip, io) {const state = loadLink(file);if (!state || state.unlinking || state.mode !== 'ordered') throw new Refused('RELAY_LINKED', 'link this ordered relay board before recovering a blocked sequence');const boardFile = join(repoInfo(root).commonDir, 'pullboard', 'board.sqlite');- const source = store.openBoard(boardFile, undefined, { isMain: codeIsFromMain() });- const staged = store.openBoard(':memory:');+ const source = store.openBoard(boardFile, undefined, { isMain: codeIsFromMain(), gitRoot: root });+ const staged = store.openBoard(':memory:', undefined, { gitRoot: root });try {const cursor = appliedSequence(source);const sourceDigest = nativeBoardDigest(source);diff --git a/src/sync.js b/src/sync.jsindex 9beff6dc..8e72b3ca 100644--- a/src/sync.js+++ b/src/sync.js@@ -200,6 +200,7 @@ async function settle(root, board, pending) {/** Sync only after explicit opt-in; a normal read catches network refusals and keeps its local prefix. */export async function syncGitBoard(root, board, io, { settlePending = false } = {}) {+ board.gitRoot = root; // Runtime Git authority is local, not a field supplied by a replicated move.const file = paths(root);return locked(file.marker, async () => {save(file.marker, { version: 1, remote: 'origin', ref: GIT_BOARD_REF });@@ -213,6 +214,7 @@ export async function syncGitBoard(root, board, io, { settlePending = false } =/** Route a mutation through the single remote order, retaining a pending intent before its first push. */export async function gitBoardOperation(root, board, operation, args, io = {}) {+ board.gitRoot = root;const file = paths(root);return locked(file.marker, async () => {// An enabled replica seals its intent before its first network attempt, including an outage.diff --git a/test/machine.test.js b/test/machine.test.jsindex 676a349b..37608e27 100644--- a/test/machine.test.js+++ b/test/machine.test.js@@ -465,7 +465,7 @@ test('the declared lifecycle is sound: reachable, no traps, no second door, everassert.deepEqual(machineProblems(), []);assert.deepEqual(MACHINE.states.map((state) => state.id), ['open', 'claimed', 'submitted', 'verified', 'withdrawn']);assert.deepEqual(MACHINE.states.filter((state) => state.final).map((state) => state.id), ['withdrawn']);- assert.deepEqual(MACHINE.moves.map((move) => move.verb), ['intake', 'claim', 'release', 'lapse', 'submit', 'reserve', 'accept', 'reject', 'reopen', 'escalate', 'refreeze', 'refreeze', 'withdraw']);+ assert.deepEqual(MACHINE.moves.map((move) => move.verb), ['intake', 'claim', 'release', 'lapse', 'submit', 'submit-merge', 'reserve', 'accept', 'reject', 'reopen', 'escalate', 'refreeze', 'refreeze', 'withdraw']);});for (const broken of BROKEN) {@@ -806,11 +806,11 @@ test('the triggers come from the declaration, so a changed declaration changes tconst moveSql = (machine) => storeTriggers(machine).find(({ name }) => name === 'machine_item_move').sql;const pairs = MACHINE.moves.flatMap((move) => move.from.filter((from) => from !== move.to).map((from) => `'${from}>${move.to}'`));for (const pair of pairs) assert.ok(moveSql(MACHINE).includes(pair), `the move trigger allows ${pair}`);- // Outside intake now legitimately declares open>submitted; claimed>verified still cannot bypass a submitted review.- assert.ok(!moveSql(MACHINE).includes("'claimed>verified'"));+ // Intake and a locally proved merge carry are declared; open>verified still has no direct door.+ assert.ok(!moveSql(MACHINE).includes("'open>verified'"));const machine = copy();- machine.moves.push({ verb: 'testDirectVerdict', from: ['claimed'], to: 'verified', by: ['coordinator'], refuse: 'CLOSED', guards: ['joined', 'coordinatorOnly', 'itemExists', IN_STATE], sets: ['item_built_by', 'item_commit', 'item_frozen_digest'] });- assert.ok(moveSql(machine).includes("'claimed>verified'"));+ machine.moves.push({ verb: 'testDirectVerdict', from: ['open'], to: 'verified', by: ['coordinator'], refuse: 'CLOSED', guards: ['joined', 'coordinatorOnly', 'itemExists', IN_STATE], sets: ['item_built_by', 'item_commit', 'item_frozen_digest'] });+ assert.ok(moveSql(machine).includes("'open>verified'"));const names = storeTriggers().map(({ name }) => name);for (const state of MACHINE.states.filter((entry) => entry.requires.length)) assert.ok(names.includes(`machine_fields_${state.id}`), `${state.id} has a fields trigger`);assert.ok(names.includes('machine_proof_verified'));diff --git a/test/merge-only-verdict.test.js b/test/merge-only-verdict.test.jsindex bce75fd4..1863a0de 100644--- a/test/merge-only-verdict.test.js+++ b/test/merge-only-verdict.test.js@@ -84,26 +84,45 @@ test('a merge-only resubmission keeps its accept and records the resolution diffassert.doesNotMatch(shown.out, /re-review: main merge only/u);const submitted = JSON.parse(carried.events.findLast(event => event.event_kind === 'submit').event_detail);const options = { agentId: pending.item.item_owner, commit: head, tree: submitted.tree,- policyCommit: submitted.policyCommit, submissionProof: submitted.submissionProof, mergeOnly: detail };- for (const key of ['commit', 'tree', 'trunk', 'acceptedHead', 'digest', 'verdict', 'reopen']) {- const replica = store.openBoard(':memory:');+ policyCommit: submitted.policyCommit, submissionProof: submitted.submissionProof, gateGreen: submitted.gateGreen,+ mergeOnly: detail };+ for (const key of ['commit', 'tree', 'policyCommit']) {+ const replica = store.openBoard(':memory:', undefined, { gitRoot: box.web });try {importBoard(replica, pending.snapshot);- const bad = { ...detail, [key]: typeof detail[key] === 'number' ? detail[key] + 100 : '0'.repeat(40) };- assert.throws(() => store.submit(replica, id, { ...options, mergeOnly: bad }), error => error.code === 'MERGE_ONLY_PROOF', key);- assert.equal(store.getItem(replica, id).item_status, 'claimed', 'invalid proof is atomic');+ store.submit(replica, id, { ...options, [key]: '0'.repeat(40) });+ assert.equal(store.getItem(replica, id).item_status, 'submitted', `${key}: unavailable or mismatched actual source gets ordinary review`);assert.equal(store.events(replica, { itemId: id }).filter(event => event.event_kind === 'merge-only-accept').length, 0);} finally { store.closeBoard(replica); }}- const refrozen = store.openBoard(':memory:');+ for (const key of ['acceptedHead', 'digest', 'verdict', 'reopen']) {+ const replica = store.openBoard(':memory:', undefined, { gitRoot: box.web });+ try {+ importBoard(replica, pending.snapshot);+ const fake = { ...detail, [key]: typeof detail[key] === 'number' ? detail[key] + 100 : '0'.repeat(40) };+ store.submit(replica, id, { ...options, mergeOnly: fake });+ const receipt = JSON.parse(store.events(replica, { itemId: id }).findLast(event => event.event_kind === 'merge-only-accept').event_detail);+ assert.equal(receipt[key], detail[key], `${key}: native history and Git replace caller-supplied facts`);+ } finally { store.closeBoard(replica); }+ }+ const refrozen = store.openBoard(':memory:', undefined, { gitRoot: box.web });try {importBoard(refrozen, pending.snapshot);store.refreeze(refrozen, id, { agentId: 'coordinator', freeze: () => ({ text: pending.item.item_frozen, digest: 'a different frozen bar' }) });store.claim(refrozen, id, { agentId: options.agentId, lane: 'web', leaseMs: 7_200_000,freeze: () => ({ text: pending.item.item_frozen, digest: 'a different frozen bar' }) });- assert.throws(() => store.submit(refrozen, id, options), error => error.code === 'MERGE_ONLY_PROOF');+ store.submit(refrozen, id, options);+ assert.equal(store.getItem(refrozen, id).item_status, 'submitted', 'a changed frozen bar requires outside review');assert.equal(store.events(refrozen, { itemId: id }).filter(event => event.event_kind === 'merge-only-accept').length, 0);} finally { store.closeBoard(refrozen); }+ for (const gateGreen of [false, undefined]) {+ const ungated = store.openBoard(':memory:', undefined, { gitRoot: box.web });+ try {+ importBoard(ungated, pending.snapshot);+ store.submit(ungated, id, { ...options, gateGreen });+ assert.equal(store.getItem(ungated, id).item_status, 'submitted', 'an absent or waived gate cannot carry acceptance');+ } finally { store.closeBoard(ungated); }+ }// This private authenticated engine fixture must not upgrade a builder's invented source facts.// The real commit retains both merge parents but changes behavior outside the conflict region.writeFileSync(join(box.web, 'web/feature.js'), "export const choice = 'resolved';\n\nexport const unrelated = 'silently changed';\n");@@ -111,18 +130,35 @@ test('a merge-only resubmission keeps its accept and records the resolution diffbox.git(box.web, 'commit', '-q', '--amend', '--no-edit');const extraHead = box.git(box.web, 'rev-parse', 'HEAD');const extraTree = box.git(box.web, 'rev-parse', 'HEAD^{tree}');- const forged = store.openBoard(':memory:');+ const forged = store.openBoard(':memory:', undefined, { gitRoot: box.web });try {importBoard(forged, pending.snapshot);const move = prepareEngineMove(forged, 'submit', [id, options]);move.args[1] = { ...options, commit: extraHead, tree: extraTree,mergeOnly: { ...detail, commit: extraHead, tree: extraTree } };- assert.throws(() => applyEngineMove(forged, move, { sequence: 1, at: '2026-01-01T00:00:00.000Z' }),- error => ['MERGE_ONLY_PROOF', 'COORDINATOR_ONLY'].includes(error.code),+ applyEngineMove(forged, move, { sequence: 1, at: '2026-01-01T00:00:00.000Z' });+ assert.equal(store.getItem(forged, id).item_status, 'submitted','a serialized builder claim cannot lend the original verdict to unrelated same-file behavior');- assert.equal(store.getItem(forged, id).item_status, 'claimed');+ assert.equal(store.events(forged, { itemId: id }).filter(event => event.event_kind === 'merge-only-accept').length, 0);} finally { store.closeBoard(forged); }- const replay = store.openBoard(':memory:');+ const absent = store.openBoard(':memory:');+ try {+ importBoard(absent, pending.snapshot);+ const move = prepareEngineMove(absent, 'submit', [id, { ...options, gitRoot: box.web }]);+ applyEngineMove(absent, move,+ { sequence: 1, at: '2026-01-01T00:00:00.000Z' });+ assert.equal(store.getItem(absent, id).item_status, 'submitted', 'coordinator28566: replay without local Git needs ordinary review');+ } finally { store.closeBoard(absent); }+ const historical = store.openBoard(':memory:', undefined, { gitRoot: box.web });+ try {+ importBoard(historical, pending.snapshot);+ const { gateGreen, mergeOnly, ...oldOptions } = options;+ const move = prepareEngineMove(historical, 'submit', [id, oldOptions]);+ applyEngineMove(historical, { ...move, engine: MERGE_ONLY_VERDICT_ENGINE - 1 },+ { sequence: 1, at: '2026-01-01T00:00:00.000Z' });+ assert.equal(store.getItem(historical, id).item_status, 'submitted', 'historical submit replay never gains carry semantics');+ } finally { store.closeBoard(historical); }+ const replay = store.openBoard(':memory:', undefined, { gitRoot: box.web });try {importBoard(replay, pending.snapshot);const move = prepareEngineMove(replay, 'submit', [id, options]);