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
feat(bar): retain distinct person authority for bars [B26,V1,H16]
Corey Olsonb635853777a1
diff --git a/docs/formats.md b/docs/formats.mdindex 062f0618..10467cbf 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -212,7 +212,7 @@ Engine 90 records the parent session a seat joined under and stamps each verdict`BAR_READY_ENGINE` introduces ordered `setBarReady` and `signBar` moves; its unassigned leaf is numbered by the landing merge. Readiness defaults off. `pullboard bar ready on` is coordinator-only and snapshots already-frozen bars, which remain grandfathered until their words change. Older engine moves retain their recorded behavior. Enabling readiness makes later bars require an observed main-red named case (including an absent named case), `Named test:`, `Measurements:` and `Reviewer edges:` sections, and an outside-parent signature. Section presence is enforced; the signer judges whether the methods and edge cases are adequate.-Semantic add/edit moves capture the current native author session and parent in their ordered arguments, preserving authors of unchanged fields. Signing likewise captures the current signer; replay never consults a replica's environment. A current session's explicit joined parent is used when native parent metadata is unavailable. Taking over a known helper seat without current parent metadata refuses rather than declaring that helper independent. Unknown historical identities cannot sign. These captures do not rewrite historical seat identity. Each `bar-revision` event binds the exact title, criterion, check, brief, citations, dependencies and route; `bar-sign` additionally binds its event revision, baseline digest, coverage plan, author parents, signer and note. Editing away and back still requires a new signature. Additive `board_meta` keys `bar_ready_setting`, `bar_grandfather:<id>`, `bar_revision:<id>` and `bar_sign:<id>` hold the current indexes; the events retain history.+Semantic add/edit moves capture the current native author session and parent in their ordered arguments, preserving authors of unchanged fields. Signing likewise captures the current signer; replay never consults a replica's environment. A current session's explicit joined parent is used when native parent metadata is unavailable. Taking over a known helper seat without current parent metadata refuses rather than declaring that helper independent. Unknown historical agent identities cannot establish independence. The authenticated person has `authority: "person"`, with null session and parent, and is a distinct authority: an agent may sign a person-authored bar and the person may sign an agent-authored bar. Unknown agent authors still fail closed. Terminal person actions use `--as person` on `add`, `edit` or `bar sign`; the authenticated coordinator view records that authority directly. Ordered transport selects person credentials for this provenance, while retaining normal agent credentials for agent authors; no parent is invented for the person. These captures do not rewrite historical seat identity. Each `bar-revision` event binds the exact title, criterion, check, brief, citations, dependencies and route; `bar-sign` additionally binds its event revision, baseline digest, coverage plan, author parents, signer and note. Editing away and back still requires a new signature. Additive `board_meta` keys `bar_ready_setting`, `bar_grandfather:<id>`, `bar_revision:<id>` and `bar_sign:<id>` hold the current indexes; the events retain history.`pullboard bar sign <id> --coverage-file <json> --note "..."` records whole-file obligations for existing committed test files in the brief's `Files` list. `claim.barTestFiles` defaults to Node test/spec filename globs; projects can explicitly provide their own globs. The file supplies `files: [{path, mode: "whole"|"landing", evidence}]`, a `named` observation, and an install observation when accepted main configures an install. Each observation retains `durationMs`, `selection` (`whole-file`, `named-check` or `install`), `ref`, `sha256`, full source commit, runtime and outcome. Whole mode requires a completed green whole-file observation. Landing mode requires a recorded whole-file duration exceeding the unchanged available review budget, explicit landing coverage in the brief and retained `namedCases`; unknown or named-only durations cannot establish that exception. Named, install and appended whole-file durations must fit the existing timeout together. References and hashes are signer-attested metadata; Pullboard validates their shape and budget, and does not independently open evidence artifacts during replay or prove the accuracy of a signer's account.diff --git a/src/bar-actor.js b/src/bar-actor.jsindex ac221a90..8f8402c0 100644--- a/src/bar-actor.js+++ b/src/bar-actor.js@@ -25,6 +25,7 @@ export function nativeBarActorForSeat(board, agent, environment = process.env) {/** 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 (value.authority === 'person' && value.session === null && value.parent === null) return { authority: 'person', 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');}diff --git a/src/bar-readiness.js b/src/bar-readiness.jsindex 5ea3c975..e964a780 100644--- a/src/bar-readiness.js+++ b/src/bar-readiness.js@@ -129,12 +129,16 @@ export function signBar(board, id, { agentId, revision, digest, note, coverage,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 signerActor = normalizeBarActor(barActor);const signerParent = signerActor.parent;+ const signerPerson = signerActor.authority === 'person';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`);+ const agentAuthors = authors.filter(author => author.authority !== 'person');+ if (agentAuthors.some(author => !author.parent) || !signerPerson && agentAuthors.length && !signerParent) throw new Refused('BAR_PARENT_UNKNOWN', `#${id} needs known agent author and signer session identities; join from the real runtime session, then author a new bar revision`);+ const selfSign = signerPerson ? authors.some(author => author.authority === 'person')+ : agentAuthors.some(author => author.agent === agentId || author.parent === signerParent);+ if (selfSign) throw new Refused('BAR_SELF_SIGN', `#${id}'s author and its helpers cannot sign their own bar; ask another authority or 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, signerSession: signerActor.session, note: note.trim() };+ const signed = { revision, digest, coverage: plan, coverageDigest: barCoverageDigest(plan), baselineDigest: status.baselineDigest, authorParents: authors, signerParent, signerSession: signerActor.session, signerAuthority: signerPerson ? 'person' : 'agent', 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/cli.js b/src/cli.jsindex 12b0b0a1..9aed1e04 100644--- a/src/cli.js+++ b/src/cli.js@@ -898,9 +898,16 @@ function relayOutboxSetting(root) {}/** Capture bar provenance only at author/sign commands, never during unrelated lifecycle dispatch. */-export function barActorForCommand(ctx, board) {- if (!barReadySetting(board).enabled || ctx.io.personChannel === 'view' || ctx.io.personRequest) return null;+export function barActorForCommand(ctx, board, { asPerson = false } = {}) {+ if (!barReadySetting(board).enabled) return null;const actor = ctx.info.isMain ? COORDINATOR : store.agentAt(board, ctx.info.root)?.agent_id;+ const phone = ctx.io.personRequest?.phase === 'execute';+ if (asPerson || phone || ctx.io.personChannel === 'view' && actor === COORDINATOR) {+ if (!phone) requirePersonChannel(ctx.io.personChannel);+ if (!ctx.info.isMain || actor !== COORDINATOR) throw new Refused('B26_PERSON_ANSWER', 'the person authors or signs a bar from the main checkout or its authenticated view');+ return { authority: 'person', session: null, parent: null };+ }+ if (ctx.io.personChannel === 'view' || ctx.io.personRequest) return null;return nativeBarActorForSeat(board, actor);}@@ -2231,8 +2238,8 @@ async function runCommand(argv, io) {const help = selectedHelp(command, first, second, rest, values);if (help) return await (await COMMANDS.help()).run(io, args, help);try {- if (values.as === 'person' && !['answer', 'decisions', 'fact'].includes(command)) {- throw new Refused('USAGE', '--as person works only with pullboard answer, decisions, or fact --never-again');+ if (values.as === 'person' && !['answer', 'decisions', 'fact', 'add', 'edit'].includes(command) && !(command === 'bar' && first === 'sign')) {+ throw new Refused('USAGE', '--as person works with answer, decisions, fact --never-again, add, edit, or bar sign');}const load = COMMANDS[command];if (!load) return unknownCommand(io, command);diff --git a/src/commands/add.js b/src/commands/add.jsindex 0d743907..df5b281d 100644--- a/src/commands/add.js+++ b/src/commands/add.js@@ -30,6 +30,7 @@ import {idList,launchBaseline,ordered,+ personMode,} from '../cli.js';/** Run `pullboard add` and return its exit code. */@@ -71,7 +72,7 @@ export async function run(io, args) {const { command } = store.validateItemAddition(board, item);if (command) refuseCheckSyntax(command);if (command) item.checkBaseline = values.wait ? checkBaseline(ctx.info.root, command) : prepareCheckBaseline(ctx.info.root, command);- item.barActor = barActorForCommand(ctx, board);+ item.barActor = barActorForCommand(ctx, board, { asPerson: personMode(ctx, me, values) });const id = await ordered(ctx, board, 'addItem', [item]);if (item.checkBaseline?.result === 'pending') await launchBaseline(ctx, board, id, item.checkBaseline);io.result?.({ item: store.getItem(board, id) });diff --git a/src/commands/bar.js b/src/commands/bar.jsindex 81aee12a..b8a09255 100644--- a/src/commands/bar.js+++ b/src/commands/bar.js@@ -3,7 +3,7 @@ import { mainPolicy } from '../trusted-policy.js';/** Inspect, enable and independently sign acceptance bars [B4,V1,V2,H16]. */import { getItem } from '../board.js';import { barReadiness, barReadySetting } from '../bar-readiness.js';-import { actOn, barActorForCommand, idArg, ordered } from '../cli.js';+import { actOn, barActorForCommand, idArg, ordered, personMode } from '../cli.js';import { Refused } from '../refused.js';/** Run the board-scoped readiness setting or show/sign one exact revision. */@@ -28,7 +28,7 @@ export async function run(io, { first, second, rest, values }) {}io.say(`Sign-off asks: can the builder meet this bar, and would two reviewers grade it the same? Check the named baseline, every measurement method, coverage and reviewer edges in pullboard show ${id}.`);const coverage = prepareBarCoverage(ctx.info.root, item, mainPolicy(ctx.info.root), values['coverage-file']);- const signed = await ordered(ctx, board, 'signBar', [id, { agentId: me.id, revision: status.revision?.revision, digest: status.revision?.digest, note: values.note, coverage, barActor: barActorForCommand(ctx, board) }]);+ const signed = await ordered(ctx, board, 'signBar', [id, { agentId: me.id, revision: status.revision?.revision, digest: status.revision?.digest, note: values.note, coverage, barActor: barActorForCommand(ctx, board, { asPerson: personMode(ctx, me, values) }) }]);io.result?.({ signed });io.say(`signed #${id} revision ${signed.revision}; any bar edit needs a fresh signature`);return 0;diff --git a/src/commands/edit.js b/src/commands/edit.jsindex 5fed8790..d41d081a 100644--- a/src/commands/edit.js+++ b/src/commands/edit.js@@ -20,6 +20,7 @@ import {idArg,launchBaseline,ordered,+ personMode,} from '../cli.js';/** Run `pullboard edit` and return its exit code. */@@ -51,7 +52,7 @@ export async function run(io, args) {const { item, command } = store.validateItemEdit(board, id, change);if (command && command !== item.item_check) refuseCheckSyntax(command);if (command && (command !== item.item_check || barReadySetting(board).enabled)) change.checkBaseline = values.wait ? checkBaseline(ctx.info.root, command) : prepareCheckBaseline(ctx.info.root, command);- change.barActor = barActorForCommand(ctx, board);+ change.barActor = barActorForCommand(ctx, board, { asPerson: personMode(ctx, me, values) });await ordered(ctx, board, 'editItem', [id, change]);if (change.checkBaseline?.result === 'pending') await launchBaseline(ctx, board, id, change.checkBaseline);io.result?.({ item: store.getItem(board, id) });diff --git a/src/relay-sender.js b/src/relay-sender.jsindex 9ade2052..921fb0ea 100644--- a/src/relay-sender.js+++ b/src/relay-sender.js@@ -32,13 +32,19 @@ export function validRelaySender(sender) {(sender.engine === undefined || Number.isSafeInteger(sender.engine) && sender.engine > 0));}+/** Person bar provenance follows the same authenticated authority as existing person moves. */+function personBarMove(move) {+ const at = move?.operation === 'addItem' ? 0 : ['editItem', 'signBar'].includes(move?.operation) ? 1 : null;+ return at !== null && move.args?.[at]?.barActor?.authority === 'person';+}+/*** True for a move only the person may make: a row decision, a sentinel decision, an answer or hold as the person, a* person fact or request, or any move whose actor is the person. On a board that names approvers, only an approver's* session makes one [E4].*/function personAuthority(move) {- return personFact(move) || ['recordRowDecisions', 'decideSentinel'].includes(move?.operation) || move?.operation === 'answerDecision' && Boolean(move.args?.[1]?.asPerson) ||+ return personBarMove(move) || personFact(move) || ['recordRowDecisions', 'decideSentinel'].includes(move?.operation) || move?.operation === 'answerDecision' && Boolean(move.args?.[1]?.asPerson) ||move?.operation === 'shout' && Boolean(move.args?.[0]?.request) || relayMoveActor(move) === 'person';}@@ -80,7 +86,7 @@ export function relaySenderProblem(move, sender, kind, { phoneReceipt = false }move.operation === 'ensureCoordinator' && typeof move.args?.[0] === 'string')) return null;return new Refused('RELAY_PERSON_ONLY', 'a machine cannot act as the person; approve this action on the paired phone');}- if (kind === 'snapshot' || move?.operation === 'recordRowDecisions' || move?.operation === 'decideSentinel' || move?.operation === 'answerDecision' && move.args?.[1]?.asPerson ||+ if (personBarMove(move) || kind === 'snapshot' || move?.operation === 'recordRowDecisions' || move?.operation === 'decideSentinel' || move?.operation === 'answerDecision' && move.args?.[1]?.asPerson ||move?.operation === 'shout' && move.args?.[0]?.request || relayMoveActor(move) === 'person') {return new Refused('RELAY_PERSON_ONLY', `agent ${sender.agent} cannot make a person-only relay ${kind}; use the person's authenticated session`);}@@ -97,7 +103,7 @@ export function credentialActor(move) {return typeof creator === 'string' && creator !== 'machine' ? creator : 'machine';}if (move.personRequest || ['register', 'ensureCoordinator'].includes(move.operation)) return 'machine';- if (['recordRowDecisions', 'recordLandingWaiver'].includes(move.operation)+ if (personBarMove(move) || ['recordRowDecisions', 'recordLandingWaiver'].includes(move.operation)|| move.operation === 'answerDecision' && args[1]?.asPerson|| move.operation === 'shout' && args[0]?.request) return 'person';return relayMoveActor(move);diff --git a/test/relay-credential.test.js b/test/relay-credential.test.jsindex 3ed5d009..f8da1e75 100644--- a/test/relay-credential.test.js+++ b/test/relay-credential.test.js@@ -24,6 +24,7 @@ test('every current operation selects its native actor credential without a secoif (operation === 'release') args = [999999, actor];if (['claim', 'refreeze'].includes(operation)) args = [box.before.tables.item[0].item_id, options];if (operation === 'reserveNextReview') args = [options];+ if (operation === 'setBarReady') args = [{ agentId: actor, enabled: false }];if (operation === 'recordHealthFindings') args = [{ agentId: actor, observedRevision: 0, findings: [] }];if (operation === 'recordSpecApprovalBaseline') args = [{ agentId: actor, baseline: { version: 1, file: 'SPEC.md', anchor: null, rows: [] } }];if (operation === 'recordFlakeObservation') args = [{ agentId: actor, lane: box.lane, observation: syntheticFlakeObservation('credential-fixture') }];@@ -176,6 +177,9 @@ test('a person-only move is refused before the relay is asked [H2,H9,H16]', asynwriteFileSync(box.linkFile, JSON.stringify(state), { mode: 0o600 });const personCases = [+ ['addItem', [{ by: 'coordinator', lane: box.lane, title: 'Person-authored bar', barActor: { authority: 'person', session: null, parent: null } }]],+ ['editItem', [1, { agentId: 'coordinator', brief: 'Person correction', barActor: { authority: 'person', session: null, parent: null } }]],+ ['signBar', [1, { agentId: 'coordinator', barActor: { authority: 'person', session: null, parent: null } }]],['recordLandingWaiver', [{ agentId: 'person', channel: 'terminal', reason: 'fixture' }]],['recordRowDecisions', [{ agentId: 'person', channel: 'terminal', decisions: [] }]],['answerDecision', [1, { agentId: 'person', asPerson: true, channel: 'terminal' }]],