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(merge): compose landed main for foreign waits [B24,H16]
Corey Olson9ef7aa7d32fa
diff --cc docs/lifecycle.mdindex c4b0d0a5,d7aa48c7..147a4037--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@@ -56,13 -56,13 +56,13 @@@ Each move checks its guards in this ord| Move | From | To | Who | Guards, in order; result refusals || --- | --- | --- | --- | --- || intake | open | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), outsideSubmission (OUTSIDE_SOURCE) |-| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE or OUTSIDE_NATIVE_BUILD), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), lineCapacity (LINE_WIP_LIMIT or LINE_SETTING_RANGE), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED or BAR_NOT_READY) |+| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE or OUTSIDE_NATIVE_BUILD), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), lineCapacity (LINE_WIP_LIMIT or LINE_SETTING_RANGE), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED or BAR_NOT_READY), result (BAD_DEPENDENCIES) || release | open, claimed | open | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), releaseOwnsWork (NOT_YOURS), reviewReleaseExplained (NOTE_REQUIRED) || lapse | claimed | open | clock, when its lease runs out | none |- | submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS or OUTSIDE_NATIVE_BUILD), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), 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), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), result (BAD_DEPENDENCIES), result (LINE_SETTING_RANGE) |-| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS or OUTSIDE_NATIVE_BUILD), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), 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), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or RUNNER_WAIT_DEADLINE or RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), result (LINE_SETTING_RANGE) |-| reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), roadmapReadable (MILESTONES_CORRUPT or LINE_SETTING_RANGE), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) |-| accept | submitted, verified | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_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), noUnverifiedStack (STACKED_ON_UNVERIFIED), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), itemCheckGreen (CHECK_RED or RUNNER_WAIT_DEADLINE or RUNNER_BROWSER_SLOT_REQUIRED or RUNNER_GUI_SESSION_REQUIRED or SANDBOX_PROVIDER_REQUIRED or SANDBOX_IMAGE_REQUIRED or SANDBOX_RUNTIME or SANDBOX_EXPORT or SANDBOX_EXECUTION or SANDBOX_CLEANUP_REQUIRED or SANDBOX_CHECK_REQUIRED or CHECK_NO_PROOF or OUTSIDE_SANDBOX_REQUIRED or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or CHECK_UNVERIFIED or GUARD_CANNOT_FAIL or GUARD_NOT_FOUND), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), proofNoted (PROOF_REQUIRED), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION) |-| reject | submitted, verified | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION), result (NOT_YOURS), result (CLOSED) |++| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS or OUTSIDE_NATIVE_BUILD), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), 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), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or RUNNER_WAIT_DEADLINE or RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), result (BAD_DEPENDENCIES), result (LINE_SETTING_RANGE) |+| reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), roadmapReadable (MILESTONES_CORRUPT or LINE_SETTING_RANGE), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), result (BAD_DEPENDENCIES) |- | accept | submitted, verified | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_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), noUnverifiedStack (STACKED_ON_UNVERIFIED), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), itemCheckGreen (CHECK_RED or RUNNER_BROWSER_SLOT_REQUIRED or RUNNER_GUI_SESSION_REQUIRED or SANDBOX_PROVIDER_REQUIRED or SANDBOX_IMAGE_REQUIRED or SANDBOX_RUNTIME or SANDBOX_EXPORT or SANDBOX_EXECUTION or SANDBOX_CLEANUP_REQUIRED or SANDBOX_CHECK_REQUIRED or CHECK_NO_PROOF or OUTSIDE_SANDBOX_REQUIRED or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or CHECK_UNVERIFIED or GUARD_CANNOT_FAIL or GUARD_NOT_FOUND), proofNoted (PROOF_REQUIRED), result (BAD_DEPENDENCIES), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION) |++| accept | submitted, verified | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_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), noUnverifiedStack (STACKED_ON_UNVERIFIED), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), itemCheckGreen (CHECK_RED or RUNNER_WAIT_DEADLINE or RUNNER_BROWSER_SLOT_REQUIRED or RUNNER_GUI_SESSION_REQUIRED or SANDBOX_PROVIDER_REQUIRED or SANDBOX_IMAGE_REQUIRED or SANDBOX_RUNTIME or SANDBOX_EXPORT or SANDBOX_EXECUTION or SANDBOX_CLEANUP_REQUIRED or SANDBOX_CHECK_REQUIRED or CHECK_NO_PROOF or OUTSIDE_SANDBOX_REQUIRED or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or CHECK_UNVERIFIED or GUARD_CANNOT_FAIL or GUARD_NOT_FOUND), proofRecorded (PROOF_RUN_UNAVAILABLE or PROOF_RUN_UNBOUND or PROOF_RUN_ACTOR or PROOF_RUN_STALE or PROOF_RUN_CHANGED), proofNoted (PROOF_REQUIRED), result (BAD_DEPENDENCIES), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION) |+| reject | submitted, verified | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), result (BAD_DEPENDENCIES), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION), result (NOT_YOURS), result (CLOSED) || reopen | submitted, verified | open | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reopenAuthority (COORDINATOR_ONLY or VERDICT_WITHDRAW_FORBIDDEN or VERDICT_WITHDRAW_STATE), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), notMerged (ALREADY_MERGED), landingFailureRecorded (LANDING_FAILURE_REQUIRED), trunkConflicts (NOT_CONFLICTING or CONFLICT_FILES or NO_TRUNK or MERGE_CHECK_FAILED), conflictAccepted (NOT_ACCEPTED or BAD_CONFLICT or ENGINE_VERSION), result (BAD_VERDICT_WITHDRAW), result (ENGINE_VERSION), result (BAD_CONFIG) || escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED) || refreeze | open, claimed, submitted | open | coordinator, when there is no live claim awaiting a coordinator correction | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), coordinatorOnly (COORDINATOR_ONLY), itemExists (NO_ITEM), inState (CLOSED), barReady (BAR_NOT_READY), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED or BAR_NOT_READY) |diff --cc src/board.jsindex 44d4224b,e0df1501..e5c7b787--- a/src/board.js+++ b/src/board.js@@@ -1,9 -1,15 +1,21 @@@+import { foreignBlockers } from './cross-repo-dependencies.js';+import {+ dependencyValues,+ localDependencyIds,+ dependencyLabel,+} from './item-dependencies.js';+ import { applyLaneLead } from './lane-lead-policy.js';+ import { applyHealthFindings } from './board-health.js';+ import {+ isLaneEscalation,+ laneLeads,+ leadOwnsDecision,+ routeLaneMessage,+ } from './lane-lead.js';+ export { laneLeads };++ import { companionPlan } from './companion.js';+ import { applyCompanionRequest } from './companion.js';export { readBoardMembers, setBoardMembers } from './board-members.js';import { heartbeatSeat } from './seat-presence.js';import * as itemDecisions from './item-decision-queue.js';@@@ -691,10 -679,36 +685,37 @@@ export function addItem(board, { by, la});}+ /** Insert an already validated ordinary or companion child without bypassing check or bar recording. */+ function insertItem(board, item, { command, cleanTitle }) {+ const { by, lane, criterion, specIds, parentId, after, brief, route, checkBaseline, barActor } = item;+ const baseline = normalizeCheckBaseline(by, command, checkBaseline);+ const at = now(board);+ const result = board.db+ .prepare(+ `INSERT INTO item (item_parent_id, item_lane, item_title, item_criterion, item_spec_ids,+ item_after, item_brief, item_route, item_check, item_created_by, item_created_at, item_updated_at)+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,+ )+ .run(parentId, lane, cleanTitle, criterion.trim(), specIds.join(','), after.join(','), brief.trim(), route, command, by, at, at);+ const id = Number(result.lastInsertRowid);+ saveCheckBaseline(board, id, baseline);+ logEvent(board, by, 'add', id, { lane, specIds, after, route, ...(baseline ? { checkBaseline: baseline } : {}) });+ recordBarRevision(board, itemById(board, id), by, null, barActor);+ return id;+ }++ /** Read the canonical request plan before a CLI performs any authorized baseline work. */+ export function planCompanion(board, options) { return companionPlan(board, options, validateItemAddition); }++ /** The single ordered operation permitted to create a child in a different lane. */+ export function requestCompanion(board, options) {+ return applyCompanionRequest(board, options, { validateAddition: validateItemAddition, insertItem });+ }+/** Validate that dependencies exist, remain usable, and cannot lead back to the edited item. */function validateItemDependencies(board, itemId, after) {- const direct = after.map((dependency) => itemById(board, dependency));+ dependencyValues(after);+ const direct = localDependencyIds(after).map((dependency) => itemById(board, dependency));const withdrawn = direct.find((dependency) => dependency.item_status === 'withdrawn');if (withdrawn) {throw new Refused('WITHDRAWN', `item #${withdrawn.item_id} is withdrawn; nothing can wait on it`);diff --cc src/machine.jsindex 047032c6,6cfa0832..ea47dbdb--- a/src/machine.js+++ b/src/machine.js@@@ -175,8 -175,8 +176,8 @@@ export const MOVES ={ verb: 'lapse', from: ['claimed'], to: 'open', by: ['clock'], guards: [], when: 'its lease runs out' },{verb: 'submit', from: ['claimed'], to: 'submitted', by: ['agent', 'coordinator'], refuse: 'NOT_YOURS',- alsoRefuses: [{ code: 'LINE_SETTING_RANGE', rule: 'the recorded board line setting has a valid registry value', next: 'restore the recorded board line setting from its ordered event history, then retry submit' }],+ alsoRefuses: [{ code: 'BAD_DEPENDENCIES', rule: 'persisted prerequisites contain only positive local item ids or exact repo#id references', next: 'restore the item dependencies from their ordered history, then retry' }, { code: 'LINE_SETTING_RANGE', rule: 'the recorded board line setting has a valid registry value', next: 'restore the recorded board line setting from its ordered event history, then retry submit' }],- guards: ['joined', 'itemExists', IN_STATE, 'isHolder', 'correctionRefrozen', 'checkProvesSomething', 'barReady', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'trunkInCandidate', 'noUnverifiedStack', 'infraExplained', 'doctrineHolds', 'gateConfigured', 'queuedItemLease', 'gateGreen', 'treeStillDuringGate', 'submissionProofValid', 'childrenDone', 'headIsNew'],+ guards: ['joined', 'itemExists', IN_STATE, 'isHolder', 'correctionRefrozen', 'checkProvesSomething', 'barReady', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'trunkInCandidate', 'noUnverifiedStack', 'infraExplained', 'doctrineHolds', 'gateConfigured', 'queuedItemLease', 'gateGreen', 'proofRecorded', 'treeStillDuringGate', 'submissionProofValid', 'childrenDone', 'headIsNew'],sets: ['item_built_by', 'item_commit'], command: 'pullboard submit <id>',},{@@@ -187,8 -186,8 +188,8 @@@},{verb: 'accept', from: ['submitted', 'verified'], to: 'verified', by: ['agent', 'coordinator'], refuse: 'NOT_SUBMITTED',- guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'atSubmittedCommit', 'notMerged', 'verdictReviewRecorded', 'reviewTreeCurrent', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree', 'criterionUnchanged', 'reasonIsMet', 'trunkMergeClean', 'noUnverifiedStack', 'queuedItemLease', 'itemCheckGreen', 'proofNoted'],+ guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'atSubmittedCommit', 'notMerged', 'verdictReviewRecorded', 'reviewTreeCurrent', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree', 'criterionUnchanged', 'reasonIsMet', 'trunkMergeClean', 'noUnverifiedStack', 'queuedItemLease', 'itemCheckGreen', 'proofRecorded', 'proofNoted'],- alsoRefuses: [{ code: 'VERDICT_ENVIRONMENT', rule: 'optional recorded verdict environment contains exact platform, architecture and Node version', next: 'run the frozen check with current Pullboard, then have an independent reviewer record a fresh verdict with its actual executor environment' }, { code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 20 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],+ alsoRefuses: [{ code: 'BAD_DEPENDENCIES', rule: 'persisted prerequisites contain only positive local item ids or exact repo#id references', next: 'restore the item dependencies from their ordered history, then retry' }, { code: 'VERDICT_ENVIRONMENT', rule: 'optional recorded verdict environment contains exact platform, architecture and Node version', next: 'run the frozen check with current Pullboard, then have an independent reviewer record a fresh verdict with its actual executor environment' }, { code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 20 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],sets: ['item_verified_by'], command: 'pullboard verify <id> accept --note "..."',},{diff --cc test/team.test.jsindex 6749f5a5,48cf582c..79bbb900--- a/test/team.test.js+++ b/test/team.test.js@@@ -1022,120 -1027,91 +1029,205 @@@ test('a landing lease renewal or waiteassert.equal(state.line.length, 1, 'suppressing polling events does not discard the waiting command');});+/** Cross-repository prerequisites use real signed E32 disclosure and never a same-number local item [B24,H16]. */+test('an item waits across repos [B24,H16]', async t => {+ /** A private board clock makes exact canonical replay comparisons deterministic. */+ const clock = { now: () => new Date('2026-10-25T00:00:00Z') };+ const parent = signedBoard(t, 'app', clock);+ const child = signedBoard(t, 'service', clock);+ const local = parent.board, foreign = child.board;+ writeFileSync(join(parent.root, 'pullboard.json'), JSON.stringify({ name: 'app', project: 'fixture', gate: 'true', lanes: { web: { owns: ['web/'] } } }));+ writeFileSync(join(parent.root, 'SPEC.md'), '# Synthetic fixture\n\n- B24 [approved, must] Cross-repo fixture. | gate: test/team.test.js\n');+ parent.git('add', 'pullboard.json', 'SPEC.md');+ parent.git('commit', '-q', '-m', 'fixture: configure the private dependency API');+ for (const box of [parent, child]) {+ store.register(box.board, { lane: 'coordinator', path: box.root });+ store.register(box.board, { lane: 'web', path: join(box.root, 'synthetic-builder') });+ }+ const localId = store.addItem(local, { by: 'coordinator', lane: 'web', title: 'Local same-number item' });+ const foreignId = store.addItem(foreign, { by: 'coordinator', lane: 'web', title: 'Foreign prerequisite' });+ assert.equal(localId, foreignId, 'independent real Git/SQLite boards intentionally reuse the same item number');+ const dependent = store.addItem(local, { by: 'coordinator', lane: 'web', title: 'Wait for service', after: [`service#${foreignId}`] });+ assert.equal(store.getItem(local, dependent).item_after, `service#${foreignId}`);+ /** Explicit synthetic frozen bar; native moves below do not claim that this fixture ran a gate. */+ const freeze = item => ({ text: item.item_title, digest: `fixture:${item.item_title}` });+ /** Record an actual native verified transition, with a clearly synthetic build receipt. */+ function accept(board, id, root, title) {+ const box = root === parent.root ? parent : child;+ const commit = box.git('rev-parse', 'HEAD').trim();+ const tree = box.git('rev-parse', 'HEAD^{tree}').trim();+ store.claim(board, id, { agentId: 'web-1', lane: 'web', leaseMs: 60_000, head: commit, freeze });+ submitFixture(board, id, { agentId: 'web-1', commit, tree });+ const reviewer = store.register(board, { lane: 'web', path: join(root, 'synthetic-reviewer') });+ store.verify(board, id, { agentId: reviewer, decision: 'ACCEPT', reason: 'CRITERION_MET',+ note: 'synthetic board-state fixture; no gate execution', head: commit, digest: `fixture:${title}`, policy: 'any' });+ }+ accept(local, localId, parent.root, 'Local same-number item');+ store.merged(local, localId, { agentId: 'coordinator', commit: parent.git('rev-parse', 'HEAD').trim() });+ /** Assert the native claim guard and pull queue name the owning repository. */+ function blocked(id, label) {+ assert.throws(() => store.claim(local, id, { agentId: 'web-1', lane: 'web', leaseMs: 60_000, freeze }),+ error => error.code === 'BLOCKED' && error.message.includes(label));+ assert.ok(store.nextFor(local, { agentId: 'web-1', lane: 'web' }).reasons.some(reason => reason.includes(label)));+ }+ blocked(dependent, 'service#1');+ const missing = store.addItem(local, { by: 'coordinator', lane: 'web', title: 'Missing board', after: ['missing#999'] });+ blocked(missing, 'missing#999');+ const api = await import('../src/board-link.js');+ const transportApi = await import('../src/board-link-relay.js');+ const { createSshBoardLinkAuthority } = await import('../src/board-link-ssh.js');+ const { createBoardLinkCapability } = await import('../src/board-link-envelope.js');+ const { generateBoardKey } = await import('../src/seal.js');+ const authority = createSshBoardLinkAuthority([parent, child]);+ const record = await consent(api, authority, parent, child, 'dependency');+ await api.applyBoardLink(local, record, authority);+ await api.applyBoardLink(foreign, record, authority);+ const relay = await linkRelay(t, [parent, child], authority);+ const sender = transportApi.createBoardLinkRelayTransport(relay.states.get(child.reference.boardId));+ const receiver = transportApi.createBoardLinkRelayTransport(relay.states.get(parent.reference.boardId));+ await sender.publish(record);+ const capability = createBoardLinkCapability(record, await generateBoardKey());+ /** Send only actual child item states through the established authenticated E32 transport. */+ async function announce(position) {+ const context = { linkId: record.linkId, generation: record.generation, sourceBoardId: child.reference.boardId,+ destinationBoardId: parent.reference.boardId, position, correlationId: `state-${position}`,+ rows: [{ board: child.reference.boardId, id: foreignId, state: store.getItem(foreign, foreignId).item_status }] };+ await transportApi.deliverBoardState(foreign, context, { authority, capability, transport: sender });+ const deliveries = (await receiver.read()).deliveries;+ await transportApi.receiveBoardState(local, deliveries.at(-1), { authority, capability });+ }+ await announce(1);+ blocked(dependent, 'service#1');+ const builds = [];+ const localApi = await serveApi({ port: 0, runCommand: main, stateDetail: 'full',+ projects: () => [{ root: parent.root, name: 'app', project: 'fixture', added: '2026-10-25T00:00:00Z' }],+ onItemBuild: entry => builds.push(entry.itemId) });+ t.after(() => localApi.close());+ const address = new URL(localApi.url);+ /** Observe the real cached API projection without substituting an item builder. */+ async function readState() {+ const response = await fetchFresh(`${address.origin}/api/v1/boards/${parent.reference.boardId}/state?detail=full`,+ { headers: { 'x-pullboard-key': address.searchParams.get('k') } });+ const document = await response.json();+ assert.equal(response.status, 200, JSON.stringify(document));+ return document.state;+ }+ await readState();+ builds.length = 0;+ await readState();+ assert.deepEqual(builds, [], 'unchanged API reads actually reuse the warm item cache');+ accept(foreign, foreignId, child.root, 'Foreign prerequisite');+ blocked(dependent, 'service#1');+ await announce(2);+ await readState();+ assert.ok(builds.includes(dependent), 'an authenticated global state announcement rebuilds its cached foreign dependents');+ const replica = store.openBoard(':memory:', clock);+ t.after(() => store.closeBoard(replica));+ importBoard(replica, exportBoard(local));+ const options = { agentId: 'web-1', lane: 'web', leaseMs: 60_000, freeze };+ assert.equal(store.nextFor(local, { agentId: 'web-1', lane: 'web' }).item.item_id, dependent);+ assert.equal(store.nextFor(replica, { agentId: 'web-1', lane: 'web' }).item.item_id, dependent);+ const move = prepareEngineMove(local, 'claim', [dependent, options]);+ const { CROSS_REPO_DEPENDENCY_ENGINE } = await import('../src/cross-repo-dependency-engine.js');+ assert.ok(move.engine >= CROSS_REPO_DEPENDENCY_ENGINE, 'older replicas cannot flatten a foreign-dependent claim');+ const ordered = { sequence: 1, at: clock.now().toISOString() };+ assert.deepEqual(applyEngineMove(local, move, ordered), applyEngineMove(replica, move, ordered), 'one ordered claim returns the same receipt on both replicas');+ assert.equal(store.getItem(local, dependent).item_status, 'claimed');+ assert.equal(store.getItem(replica, dependent).item_status, 'claimed', 'replica uses canonical received state, not a local registry or foreign-board path');+ assert.deepEqual(exportBoard(replica), exportBoard(local), 'same canonical state and claim produce exact replica rows and event IDs');+ await readState();+ builds.length = 0;+ const revoked = await api.revokeBoardLink(record, parent.reference.boardId, authority, { by: parent.by, key: parent.key });+ await api.applyBoardLink(local, revoked, authority);+ await readState();+ assert.ok(builds.includes(dependent), 'a canonical link revocation invalidates cached foreign dependency status');+});++ /** Initialise a second repo in the first one's sandbox, so both register in the same machine home. */+ function siblingRepo(box, name, project) {+ const repo = join(box.dir, name);+ mkdirSync(repo);+ box.git(repo, 'init', '-q', '-b', 'main');+ assert.equal(box.run(repo, 'init').code, 0);+ return { repo, project };+ }++ /** Put a repo into a named project under its own name, committed so the board reads it. */+ function nameRepo(box, repo, name, project) {+ const file = join(repo, 'pullboard.json');+ const config = JSON.parse(readFileSync(file, 'utf8'));+ writeFileSync(file, JSON.stringify({ ...config, name, project }, null, 2));+ box.git(repo, 'add', '-A');+ box.git(repo, 'commit', '-q', '-m', 'chore: name the repo');+ }++ test("one decision list across a project's repos [N34]", { timeout: 180_000 }, async t => { // budget: hang ceiling for three real repos' CLI runs and one view process; not a speed target.+ const box = helpers.project();+ const other = siblingRepo(box, 'repo-b').repo;+ const lone = siblingRepo(box, 'repo-c').repo;+ nameRepo(box, box.repo, 'alpha', 'shop');+ nameRepo(box, other, 'beta', 'shop');+ nameRepo(box, lone, 'gamma', 'elsewhere');+ const ask = (root, text) => {+ const asked = box.run(root, 'shout', 'person', text, '--decision');+ assert.equal(asked.code, 0, asked.err);+ return Number(/as #(\d+)/.exec(asked.out)?.[1]);+ };+ const alphaId = ask(box.repo, 'Ship alpha?');+ const betaId = ask(other, 'Ship beta?');+ ask(lone, 'Ship gamma?');+ const listed = () => JSON.parse(box.run(box.repo, 'decisions', '--as', 'person', '--json').out);++ // The person sees both repos of the project, each with its repo, and not another project's.+ const text = box.run(box.repo, 'decisions', '--as', 'person');+ assert.equal(text.code, 0, text.err);+ assert.match(text.out, new RegExp(`alpha#${alphaId} .*Ship alpha\\?`));+ assert.match(text.out, new RegExp(`beta#${betaId} .*Ship beta\\?`));+ assert.doesNotMatch(text.out, /gamma|Ship gamma/);+ const both = listed();+ assert.deepEqual(both.decisions.map(({ repo, shout_id: id }) => `${repo}#${id}`).sort(), [`alpha#${alphaId}`, `beta#${betaId}`].sort());++ // The local API lists the same decisions, each with its board and repo.+ const view = await helpers.startView(box, box.repo);+ t.after(view.stop);+ const headers = { 'x-pullboard-key': view.key };+ const boards = (await (await fetchFresh(`${view.base}/api/v1/boards`, { headers })).json()).boards;+ const alphaBoard = boards.find(entry => entry.root === box.repo);+ const betaBoard = boards.find(entry => entry.root === other);+ const api = await (await fetchFresh(`${view.base}/api/v1/decisions?board=${alphaBoard.id}`, { headers })).json();+ assert.equal(api.project, 'shop');+ assert.deepEqual(api.decisions.map(({ board, repo }) => `${repo}:${board}`).sort(), [`alpha:${alphaBoard.id}`, `beta:${betaBoard.id}`].sort());++ // Answering from the first repo closes the decision on the second repo's own board, and nowhere else.+ const answered = box.run(box.repo, 'answer', `beta#${betaId}`, 'Yes, ship it.', '--as', 'person');+ assert.equal(answered.code, 0, answered.err);+ assert.deepEqual(withBoard(other, board => store.openDecisions(board, store.PERSON)), []);+ assert.equal(withBoard(box.repo, board => store.openDecisions(board, store.PERSON)).length, 1);+ assert.deepEqual(listed().decisions.map(({ repo }) => repo), ['alpha']);+ const unknown = box.run(box.repo, 'answer', 'nowhere#1', 'x', '--as', 'person');+ assert.notEqual(unknown.code, 0);+ assert.match(unknown.err, /PROJECT_REPO_UNKNOWN/);+ });++ test('two repos of a project that share a name are addressed by folder, never guessed [N34]', { timeout: 120_000 }, () => { // budget: hang ceiling for two real repos' CLI runs; not a speed target.+ const box = helpers.project();+ const other = siblingRepo(box, 'repo-twin').repo;+ nameRepo(box, box.repo, 'twin', 'shop');+ nameRepo(box, other, 'twin', 'shop');+ const ask = (root, text) => Number(/as #(\d+)/.exec(box.run(root, 'shout', 'person', text, '--decision').out)?.[1]);+ ask(box.repo, 'Ship first?');+ const secondId = ask(other, 'Ship second?');+ const listed = JSON.parse(box.run(box.repo, 'decisions', '--as', 'person', '--json').out).decisions.map(({ repo }) => repo).sort();+ assert.deepEqual(listed, ['repo', 'repo-twin']);+ const guessed = box.run(box.repo, 'answer', `twin#${secondId}`, 'yes', '--as', 'person');+ assert.notEqual(guessed.code, 0);+ assert.match(guessed.err, /PROJECT_REPO_AMBIGUOUS/);+ assert.equal(withBoard(other, board => store.openDecisions(board, store.PERSON)).length, 1, 'nothing closed on either board');+ assert.equal(box.run(box.repo, 'answer', `repo-twin#${secondId}`, 'yes', '--as', 'person').code, 0);+ assert.deepEqual(withBoard(other, board => store.openDecisions(board, store.PERSON)), []);+ assert.equal(withBoard(box.repo, board => store.openDecisions(board, store.PERSON)).length, 1, 'the same-numbered question here stays open');+ });+test('a non-approver device without a signed member list receives no board key [H15,E17]', async t => {const folder = mkdtempSync(join(tmpdir(), 'pullboard-handover-membership-'));