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): retain current native bar authorship [V1,V2,H16]
Corey Olsone6f79f030ea1
diff --git a/docs/lifecycle.md b/docs/lifecycle.mdindex 061eb509..fe8ab3ee 100644--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@ -54,7 +54,7 @@ Each move checks its guards in this order and refuses with the first one that do| Move | From | To | Who | Guards, in order; result refusals || --- | --- | --- | --- | --- |-| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or BAR_NOT_READY or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |+| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), 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) || release | open, claimed | open | agent, coordinator | joined (NOT_JOINED 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 SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), 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 LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |@@ -63,8 +63,8 @@ Each move checks its guards in this order and refuses with the first one that do| reject | submitted, verified | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED 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) || reopen | submitted, verified | open | coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), coordinatorOnly (COORDINATOR_ONLY), 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_CONFIG) || escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED 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 SESSION_LEDGER), coordinatorOnly (COORDINATOR_ONLY), itemExists (NO_ITEM), inState (CLOSED), barReady (BAR_NOT_READY), rowsInForce (UNKNOWN_SPEC or BAR_NOT_READY or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |-| refreeze | claimed | claimed | agent, coordinator, when a live claim has a pending coordinator correction | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED), barReady (BAR_NOT_READY), rowsInForce (UNKNOWN_SPEC or BAR_NOT_READY or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |+| refreeze | open, claimed, submitted | open | coordinator, when there is no live claim awaiting a coordinator correction | joined (NOT_JOINED 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) |+| refreeze | claimed | claimed | agent, coordinator, when a live claim has a pending coordinator correction | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), 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) || withdraw | open, claimed, submitted | withdrawn | coordinator | joined (NOT_JOINED or SESSION_LEDGER), coordinatorOnly (COORDINATOR_ONLY), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), inState (CLOSED) |## Required transition guards@@ -108,12 +108,12 @@ Each move checks its guards in this order and refuses with the first one that do| PENDING_REFREEZE | no coordinator correction to a claimed criterion or check is waiting to be frozen | pullboard refreeze <id> || ONE_CLAIM | the caller holds no other live top-level claim, reworks of its own rejected items aside | submit or release the other item first; child items are free || UNKNOWN_SPEC | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | fix the spec, or the coordinator withdraws the item |-| BAR_NOT_READY | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | another parent session signs coverage for the current accepted test inventory and runner || A5_GRAMMAR_VERSION | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | upgrade Pullboard or use a file written for grammar 1 || NO_POLICY | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | restore the committed coordinator policy || BAD_CONFIG | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | repair and commit the coordinator configuration || SPEC_BEHIND_MAIN | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | merge main from this worktree, then retry the claim || AGENT_APPROVAL_REQUIRED | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | ask the coordinator to arrange the person’s confirmation or decline, or change the explicit refuse setting |+| BAR_NOT_READY | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | another parent session signs coverage for the current accepted test inventory and runner || CRITERIA_CHANGED | the criterion and the rows it cites read as they did at claim | the coordinator runs pullboard refreeze <id> || DIRTY | the worktree has no uncommitted changes | commit your changes, then submit || UNTRACKED | the worktree has no untracked files | commit or ignore them, then submit |diff --git a/src/bar-actor.js b/src/bar-actor.jsnew file mode 100644index 00000000..798053db--- /dev/null+++ b/src/bar-actor.js@@ -0,0 +1,17 @@+/** Current bar authorship survives native takeover without rewriting historical seats [V1,H16]. */+import { runtimeSessionIdentity, parentSessionDigest } from './parent-session.js';+import { Refused } from './refused.js';++/** Capture only this runtime's own session and discovered parent before sealing an ordered move. */+export function nativeBarActor(environment = process.env) {+ const identity = runtimeSessionIdentity(environment);+ return identity ? { session: parentSessionDigest(identity.session), parent: parentSessionDigest(identity.parent ?? identity.session) } : null;+}+/** Unknown provenance stays unknown; a replay never consults another process's runtime. */+export function normalizeBarActor(value) {+ if (value == null) return { session: null, parent: null };+ if (!/^[a-f0-9]{64}$/u.test(value.session) || !/^[a-f0-9]{64}$/u.test(value.parent)) {+ throw new Refused('BAR_PARENT_UNKNOWN', 'bar authorship needs the current native session and its parent; run this move from the real runtime session, without borrowing another seat');+ }+ return { session: value.session, parent: value.parent };+}diff --git a/src/bar-readiness.js b/src/bar-readiness.jsindex 0c488669..cee7af51 100644--- a/src/bar-readiness.js+++ b/src/bar-readiness.js@@ -1,3 +1,4 @@+import { normalizeBarActor } from './bar-actor.js';import { normalizeBarCoverage, barCoverageDigest } from './bar-coverage.js';/** Readiness is a revision-bound peer judgement, with mechanical prerequisites [U113]. */import { createHash } from 'node:crypto';@@ -55,14 +56,15 @@ function historicalAuthors(board, item) {return Object.fromEntries(Object.entries(fields).map(([field, agent]) => [field, { agent, parent: parent(board, agent) }]));}/** Snapshot authors on semantic edits, never retroactively upgrading an unknown historical parent. */-export function recordBarRevision(board, item, by, before = null) {+export function recordBarRevision(board, item, by, before = null, actor = null) {if ((board.executionEngineVersion ?? ENGINE_VERSION) < BAR_READY_ENGINE || !barReadySetting(board).enabled) return;const previous = read(board, `bar_revision:${item.item_id}`);const changed = FIELDS.filter(key => !before || before[key] !== item[key]);if (!changed.length && previous) return;const authors = previous?.authors ?? historicalAuthors(board, item);+ const currentActor = normalizeBarActor(actor);for (const field of FIELDS) {- if (changed.includes(field)) authors[field] = { agent: by, parent: parent(board, by) };+ if (changed.includes(field)) authors[field] = { agent: by, ...currentActor };else if (!authors[field]) authors[field] = { agent: item.item_created_by, parent: parent(board, item.item_created_by) };}const revision = { digest: barDigest(item), authors };@@ -118,20 +120,21 @@ export function barReadyProblem(board, item) {return status.missing.length ? new Refused('BAR_NOT_READY', `#${item.item_id}'s bar needs ${status.missing.join('; ')}; ask its author to edit the brief, then another session runs pullboard bar sign ${item.item_id}`) : null;}/** Record the peer's judgement against exact words, author identities and baseline observation. */-export function signBar(board, id, { agentId, revision, digest, note, coverage }) {+export function signBar(board, id, { agentId, revision, digest, note, coverage, barActor }) {return atomic(board, () => {const item = itemById(board, id);if (['verified','withdrawn'].includes(item.item_status)) throw new Refused('CLOSED', `#${id} is ${item.item_status}; sign an open bar`);const status = barReadiness(board, item, { signature: false });if (status.missing.length) throw new Refused('BAR_NOT_READY', `#${id} needs ${status.missing.join('; ')}; edit the brief or wait for its baseline before signing`);if (status.revision.revision !== revision || status.revision.digest !== digest) throw new Refused('BAR_SIGN_STALE', `#${id}'s bar changed; read it again before pullboard bar sign ${id}`);- const signerParent = parent(board, agentId);+ const signerActor = normalizeBarActor(barActor);+ const signerParent = signerActor.parent;const authors = Object.values(status.revision.authors);if (!signerParent || authors.some(author => !author.parent)) throw new Refused('BAR_PARENT_UNKNOWN', `#${id} needs known author and signer session identities; join from the real runtime session, then author a new bar revision`);if (authors.some(author => author.agent === agentId || author.parent === signerParent)) throw new Refused('BAR_SELF_SIGN', `#${id}'s author and its helpers cannot sign their own bar; ask another parent session`);if (typeof note !== 'string' || !note.trim()) throw new Refused('NOTE_REQUIRED', 'say whether a builder can meet this bar and two reviewers would grade it the same: --note "..."');const plan = normalizeBarCoverage(coverage, item);- const signed = { revision, digest, coverage: plan, coverageDigest: barCoverageDigest(plan), baselineDigest: status.baselineDigest, authorParents: authors, signerParent, note: note.trim() };+ const signed = { revision, digest, coverage: plan, coverageDigest: barCoverageDigest(plan), baselineDigest: status.baselineDigest, authorParents: authors, signerParent, signerSession: signerActor.session, note: note.trim() };logEvent(board, agentId, 'bar-sign', id, signed);save(board, `bar_sign:${id}`, { ...signed, by: agentId, event: board.lastEvent.event_id });return { id, ...signed };diff --git a/src/board.js b/src/board.jsindex 682dc65e..5e90df36 100644--- a/src/board.js+++ b/src/board.js@@ -721,7 +721,7 @@ function checkRouted({ brief, route, criterion, check }) {* @param {{ by: string, lane: string, title: string, criterion?: string, specIds?: string[], parentId?: number | null, after?: number[], brief?: string, route?: string, check?: string }} item* @returns {number} The new item's id.*/-export function addItem(board, { by, lane, title, criterion = '', specIds = [], parentId = null, after = [], brief = '', route = 'strong', check, checkBaseline }) {+export function addItem(board, { by, lane, title, criterion = '', specIds = [], parentId = null, after = [], brief = '', route = 'strong', check, checkBaseline, barActor }) {return atomic(board, () => {const { command, cleanTitle } = validateItemAddition(board, { by, lane, title, criterion, parentId, after, brief, route, check });const baseline = normalizeCheckBaseline(by, command, checkBaseline);@@ -736,7 +736,7 @@ export function addItem(board, { by, lane, title, criterion = '', specIds = [],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);+ recordBarRevision(board, itemById(board, id), by, null, barActor);return id;});}@@ -793,7 +793,7 @@ export function validateItemAddition(board, { by, lane, title, criterion = '', p* @param {number} id* @param {{ agentId: string, brief?: string, route?: string, criterion?: string, check?: string, after?: number[] }} change*/-export function editItem(board, id, { agentId, brief, route, criterion, check, after, checkBaseline, reason }) {+export function editItem(board, id, { agentId, brief, route, criterion, check, after, checkBaseline, reason, barActor }) {atomic(board, () => {const stored = itemById(board, id);const expiredHolder = stored.item_status === 'claimed' && !isHeld(board, stored) ? stored.item_owner : null;@@ -824,7 +824,7 @@ export function editItem(board, id, { agentId, brief, route, criterion, check, a...(expiredHolder ? { expiredHolder } : {}),...bar,});- recordBarRevision(board, itemById(board, id), agentId, item);+ recordBarRevision(board, itemById(board, id), agentId, item, barActor);if (pendingRefreeze) {insertShout(board, {from: COORDINATOR,diff --git a/src/cli.js b/src/cli.jsindex 923e0823..8e9de235 100644--- a/src/cli.js+++ b/src/cli.js@@ -1,4 +1,5 @@-import { barReadinessRequired, barReadiness } from './bar-readiness.js';+import { nativeBarActor } from './bar-actor.js';+import { barReadinessRequired, barReadiness, barReadySetting } from './bar-readiness.js';import { barCoverageCommand, barCoverageForPolicy } from './bar-coverage.js';/*** The pullboard command line: every command, bound to who is asking (B3, R3). The main checkout is the@@ -897,6 +898,11 @@ function relayOutboxSetting(root) {}export async function ordered(ctx, board, operation, args) {+ if (['addItem','editItem','signBar'].includes(operation) && barReadySetting(board).enabled) {+ const at = operation === 'addItem' ? 0 : 1;+ const barActor = ctx.io.personChannel === 'view' || ctx.io.personRequest ? null : nativeBarActor();+ args = args.map((value, index) => index === at ? { ...value, barActor } : value);+ }const initialBaseline = initialSpecApprovalBaseline(ctx, board, operation);// Only a reject or a reopen can open a builder's first-refusal window (#954), so an accept never reads the coordinator's policy.if (operation === 'reopen' || operation === 'verify' && args[1]?.decision === 'REJECT') args = firstRefusalArgs(operation, args, configFromSource(coordinatorFile(ctx.info.root, CONFIG_FILE).stdout));diff --git a/src/machine.js b/src/machine.jsindex 622ef06c..000d497f 100644--- a/src/machine.js+++ b/src/machine.js@@ -162,7 +162,7 @@ export const GUARDS = [{ id: 'itemNotHeld', refuse: 'ITEM_HELD', rule: 'the coordinator has not put this item on hold', next: 'the coordinator lifts it with pullboard hold <id> --off', source: 'board', when: 'unless the caller is renewing its own live claim' },{ id: 'correctionRefrozen', refuse: 'PENDING_REFREEZE', rule: 'no coordinator correction to a claimed criterion or check is waiting to be frozen', next: 'pullboard refreeze <id>', source: 'board' },{ id: 'oneLiveClaim', refuse: 'ONE_CLAIM', rule: 'the caller holds no other live top-level claim, reworks of its own rejected items aside', next: 'submit or release the other item first; child items are free', source: 'board' },- { id: 'rowsInForce', refuse: 'UNKNOWN_SPEC', alsoRefuses: [{ code: 'BAR_NOT_READY', next: 'another parent session signs coverage for the current accepted test inventory and runner' }, { code: 'A5_GRAMMAR_VERSION', next: 'upgrade Pullboard or use a file written for grammar 1' }, { code: 'NO_POLICY', next: 'restore the committed coordinator policy' }, { code: 'BAD_CONFIG', next: 'repair and commit the coordinator configuration' }, { code: 'SPEC_BEHIND_MAIN', next: 'merge main from this worktree, then retry the claim' }, { code: 'AGENT_APPROVAL_REQUIRED', next: 'ask the coordinator to arrange the person’s confirmation or decline, or change the explicit refuse setting' }], rule: 'every row the item cites exists and is in force', next: 'fix the spec, or the coordinator withdraws the item', source: 'board', when: 'only where the criterion freezes: claiming an item with no frozen criterion, and refreeze' },+ { id: 'rowsInForce', refuse: 'UNKNOWN_SPEC', alsoRefuses: [{ code: 'A5_GRAMMAR_VERSION', next: 'upgrade Pullboard or use a file written for grammar 1' }, { code: 'NO_POLICY', next: 'restore the committed coordinator policy' }, { code: 'BAD_CONFIG', next: 'repair and commit the coordinator configuration' }, { code: 'SPEC_BEHIND_MAIN', next: 'merge main from this worktree, then retry the claim' }, { code: 'AGENT_APPROVAL_REQUIRED', next: 'ask the coordinator to arrange the person’s confirmation or decline, or change the explicit refuse setting' }, { code: 'BAR_NOT_READY', next: 'another parent session signs coverage for the current accepted test inventory and runner' }], rule: 'every row the item cites exists and is in force', next: 'fix the spec, or the coordinator withdraws the item', source: 'board', when: 'only where the criterion freezes: claiming an item with no frozen criterion, and refreeze' },{ id: 'criterionUnchanged', refuse: 'CRITERIA_CHANGED', rule: 'the criterion and the rows it cites read as they did at claim', next: 'the coordinator runs pullboard refreeze <id>', source: 'cli' },{ id: 'treeClean', refuse: 'DIRTY', rule: 'the worktree has no uncommitted changes', next: 'commit your changes, then submit', source: 'cli' },{ id: 'nothingUntracked', refuse: 'UNTRACKED', rule: 'the worktree has no untracked files', next: 'commit or ignore them, then submit', source: 'cli' },diff --git a/test/bar-coverage.test.js b/test/bar-coverage.test.jsindex 4cb8d75c..79d80092 100644--- a/test/bar-coverage.test.js+++ b/test/bar-coverage.test.js@@ -6,6 +6,7 @@ import { join } from 'node:path';import { test } from 'node:test';import { barCoverageCommand, normalizeBarCoverage, prepareBarCoverage, barTestPath, barCoverageForPolicy } from '../src/bar-coverage.js';import { requireSubmitComposition } from '../src/submit-composition.js';+import { nativeBarActor } from '../src/bar-actor.js';import { baselineTestEvidence } from '../src/check-baseline.js';import { configFromSource } from '../src/config.js';import { runFixtureChild } from './fixture-child.js';@@ -130,3 +131,12 @@ test('[V2,V4] new existing test files or accepted execution settings need a newassert.throws(()=>barCoverageForPolicy(f.root,item,prepared,{commit:f.git('rev-parse','HEAD'),config}),e=>e.code==='BAR_NOT_READY');assert.throws(()=>barCoverageForPolicy(f.root,item,prepared,{...policy,config:{...config,affectedTests:'node other.js'}}),e=>e.code==='BAR_NOT_READY');});+++test('[V1,H16] native authorship captures only the current runtime, not a historical seat fallback', () => {+ assert.equal(nativeBarActor({}),null);+ const first=nativeBarActor({CLAUDE_CODE_SESSION_ID:'synthetic-private-author-a'});+ const second=nativeBarActor({CLAUDE_CODE_SESSION_ID:'synthetic-private-author-b'});+ assert.equal(first.session,first.parent);+ assert.notEqual(first.parent,second.parent);+});diff --git a/test/claim-reopen.test.js b/test/claim-reopen.test.jsindex 93e38de0..886af5a5 100644--- a/test/claim-reopen.test.js+++ b/test/claim-reopen.test.js@@ -118,7 +118,7 @@ test('[B13,B5] first refusal does not bypass the existing one-live-claim rule',const f = fixture(t);const id = returned(f, 'landing', 30);const second = store.addItem(f.board, { by: 'coordinator', lane: 'core', title: 'another', route: 'mid',- criterion: 'prove', check: 'true', brief: 'Files: src/unrelated.js\nTest: proves another fix' });+ criterion: 'prove', check: 'true', brief: 'Files: src/a.js\nTest: proves another fix' });claim(f, second, f.builder);assert.throws(() => claim(f, id, f.builder), error => error.code === 'ONE_CLAIM');store.release(f.board, second, f.builder);@@ -130,7 +130,7 @@ test('[B13,B5] releasing another review cannot cancel the builder reservation',const f = fixture(t);const id = returned(f, 'reject', 30);const another = store.addItem(f.board, { by: 'coordinator', lane: 'core', title: 'review another', route: 'mid',- criterion: 'prove', check: 'true', brief: 'Files: src/unrelated.js\nTest: proves another fix' });+ criterion: 'prove', check: 'true', brief: 'Files: src/a.js\nTest: proves another fix' });claim(f, another, f.other);submitFixture(f.board, another, { agentId: f.other, commit: COMMIT, tree: COMMIT });store.reserveReview(f.board, another, { agentId: f.builder, leaseMs: 1_800_000, policy: 'any' });@@ -192,10 +192,12 @@ function readyAuthors(f) {saveAgentParent(f.board, f.builder, 'a'.repeat(64));saveAgentSession(f.board, f.builder, 'b'.repeat(64));saveAgentSession(f.board, f.other, 'c'.repeat(64));+ f.actors = { coordinator: { session: 'a'.repeat(64), parent: 'a'.repeat(64) },+ [f.builder]: { session: 'b'.repeat(64), parent: 'a'.repeat(64) }, [f.other]: { session: 'c'.repeat(64), parent: 'c'.repeat(64) } };}/** Add an authored bar with its exact recorded baseline, as the ordered add operation receives it. */function readyItem(f, result = 'red') {- return store.addItem(f.board, { by: 'coordinator', lane: 'core', title: 'ready bar', route: 'mid',+ return store.addItem(f.board, { by: 'coordinator', lane: 'core', title: 'ready bar', route: 'mid', barActor: f.actors?.coordinator,criterion: 'the named behavior works', check: 'node --test --test-name-pattern "named witness" test/a.test.js',checkBaseline: { command: 'node --test --test-name-pattern "named witness" test/a.test.js', main: COMMIT, result, testEvidence: { failed: ['named witness'], passed: [], noTestsMatched: false } },brief: 'Files: src/a.js\nTest: named witness asserts the behavior\nNamed test: named witness\nMeasurements: no quantitative acceptance bounds\nReviewer edges: empty input and concurrent edit' });@@ -203,7 +205,7 @@ function readyItem(f, result = 'red') {/** Sign the currently read revision, keeping stale requests independently testable. */function signReady(f, id, agentId = f.other) {const { revision } = barReadiness(f.board, store.getItem(f.board, id));- return signBar(f.board, id, { agentId, revision: revision.revision, digest: revision.digest,+ return signBar(f.board, id, { agentId, barActor: f.actors?.[agentId], revision: revision.revision, digest: revision.digest,note: 'The builder can meet this bar; two reviewers can use the named witness and listed edges to grade it alike.',coverage: { version: 1, sourceMain: COMMIT, policyKey: 'd'.repeat(64), sourceCheck: store.getItem(f.board,id).item_check, timeoutMs: 300000, runner: 'node --test', required: [], files: [] } });}@@ -220,7 +222,7 @@ test('[B4,V2,V1,H16] a claim waits for a bar signed by another session', (t) =>claim(f, id, f.builder);assert.equal(store.getItem(f.board, id).item_owner, f.builder);const before = barReadiness(f.board, store.getItem(f.board, id)).revision;- store.editItem(f.board, id, { agentId: 'coordinator', brief: store.getItem(f.board, id).item_brief+'\nAlso try a restarted session.' });+ store.editItem(f.board, id, { agentId: 'coordinator', brief: store.getItem(f.board, id).item_brief+'\nAlso try a restarted session.', barActor: f.actors.coordinator });assert.throws(() => claim(f, id, f.builder), error => error.code === 'BAR_NOT_READY');assert.throws(() => signBar(f.board, id, { agentId: f.other, revision: before.revision, digest: before.digest, note: 'stale' }), error => error.code === 'BAR_SIGN_STALE');signReady(f, id);@@ -262,8 +264,8 @@ test('[B4,V2] all missing bar parts are named and content reversal cannot reviveconst id = readyItem(f);signReady(f, id);const original = store.getItem(f.board, id).item_brief;- store.editItem(f.board, id, { agentId: 'coordinator', brief: original+'\nChanged edge.' });- store.editItem(f.board, id, { agentId: 'coordinator', brief: original });+ store.editItem(f.board, id, { agentId: 'coordinator', brief: original+'\nChanged edge.', barActor: f.actors.coordinator });+ store.editItem(f.board, id, { agentId: 'coordinator', brief: original, barActor: f.actors.coordinator });assert.throws(() => claim(f, id, f.builder), error => error.code === 'BAR_NOT_READY' && error.message.includes('sign-off'));signReady(f, id);claim(f, id, f.builder);@@ -294,10 +296,25 @@ test('[B4,V1] enabling readiness cannot relabel a retained criterion as the lateconst id = store.addItem(f.board, { by: f.other, lane: 'core', title: 'original author', criterion: 'original judgement', brief });setBarReady(f.board, { agentId: 'coordinator', enabled: true });const check = 'node --test --test-name-pattern "old witness" test/old.test.js';- store.editItem(f.board, id, { agentId: 'coordinator', brief: brief+'\nAn additional edge.', check,+ store.editItem(f.board, id, { agentId: 'coordinator', brief: brief+'\nAn additional edge.', check, barActor: f.actors.coordinator,checkBaseline: { command: check, main: COMMIT, result: 'red', testEvidence: { failed: ['old witness'], passed: [], noTestsMatched: false } } });const status = barReadiness(f.board, store.getItem(f.board, id));assert.equal(status.revision.authors.item_criterion.agent, f.other);assert.equal(status.revision.authors.item_brief.agent, 'coordinator');assert.throws(() => signReady(f, id, f.other), error => error.code === 'BAR_SELF_SIGN');});+++test('[B4,V1,H16] takeover authorship uses the captured current runtime, preserving historical seat identity', t => {+ const f=fixture(t);readyAuthors(f);+ const old = f.board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key=?').get('agent_session:coordinator').meta_value;+ // This private move models the normal CLI's new runtime after takeover, not an identity rewrite.+ const current = { session: 'e'.repeat(64), parent: 'e'.repeat(64) };+ f.actors.coordinator=current;+ const child=store.register(f.board,{lane:'core',path:'/new-coordinator-helper',parent:'synthetic-new-parent',session:'synthetic-new-helper'});+ f.actors[child]={session:'f'.repeat(64),parent:'e'.repeat(64)};+ setBarReady(f.board,{agentId:'coordinator',enabled:true});const id=readyItem(f);+ assert.equal(f.board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key=?').get('agent_session:coordinator').meta_value,old);+ assert.equal(barReadiness(f.board,store.getItem(f.board,id)).revision.authors.item_criterion.parent,current.parent);+ assert.throws(()=>signReady(f,id,child),error=>error.code==='BAR_SELF_SIGN');+});diff --git a/test/machine.test.js b/test/machine.test.jsindex f5bf3df6..ed852536 100644--- a/test/machine.test.js+++ b/test/machine.test.js@@ -878,7 +878,7 @@ test('pullboard help lists each role\'s moves from the declaration, and pullboar/** Guards checked before the explicit transition: CLI facts and optional roadmap selection. */const PRECHECKED = {claim: ['joined', 'checkProvesSomething'],- submit: ['joined', 'checkProvesSomething', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'infraExplained', 'doctrineHolds', 'gateConfigured', 'queuedItemLease', 'gateGreen', 'treeStillDuringGate', 'noUnverifiedStack'],+ submit: ['joined', 'checkProvesSomething', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'trunkInCandidate', 'infraExplained', 'doctrineHolds', 'gateConfigured', 'queuedItemLease', 'gateGreen', 'treeStillDuringGate', 'noUnverifiedStack'],reserve: ['coordinatorSaysAs', 'joined', 'roadmapReadable'],accept: ['coordinatorSaysAs', 'joined', 'atSubmittedCommit', 'reviewTreeCurrent', 'trunkMergeClean', 'queuedItemLease', 'itemCheckGreen', 'noUnverifiedStack'],reject: ['coordinatorSaysAs', 'joined', 'atSubmittedCommit', 'reviewTreeCurrent'],