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(cli): allow linked coordinator model declarations [O8,O3]
Corey Olsone01f74c31558
diff --git a/src/cli.js b/src/cli.jsindex f77def69..688d9f1a 100644--- a/src/cli.js+++ b/src/cli.js@@ -552,6 +552,7 @@ function optionalModel(value, env = process.env) {function refuseRemoteCoordinatorModel(ctx, command) {const coordinator = withBoard(ctx, (board) => store.listAgents(board).find((agent) => agent.agent_id === COORDINATOR));if (!coordinator) throw new Refused('NO_AGENT', 'the linked snapshot has no coordinator; restore a consistent relay snapshot before initializing');+ if (ctx.info.isMain && coordinator.agent_path === ctx.info.root) return;const name = displayAgentName(coordinator, ctx.config.agents.names);throw new Refused('REMOTE_COORDINATOR_MODEL', `the coordinator's model is declared on the coordinator's own checkout (${name}); run pullboard ${command} there`);}@@ -1204,14 +1205,16 @@ function setupCommands(io, { first, values }) {init: async () => {const info = repoInfo(io.cwd);const model = optionalModel(values.model);- if (model !== undefined && relayLinked(info.root)) refuseRemoteCoordinatorModel(context(io), 'init');+ const linked = relayLinked(info.root);+ const ctx = linked && model !== undefined ? context(io) : null;+ if (model !== undefined && linked) refuseRemoteCoordinatorModel(ctx, 'init');const notes = initRepo({info,model,openBoardHere: () => store.openBoard(join(info.commonDir, 'pullboard', 'board.sqlite'), io.clock),/** Keep a linked coordinator's canonical identity without writing a clone-local path. */register: (board, options) => {- if (!relayLinked(info.root)) return store.register(board, options);+ if (!linked) return store.register(board, options);if (!board.db.prepare('SELECT 1 FROM agent WHERE agent_id=?').get(COORDINATOR)) {throw new Refused('NO_AGENT', 'the linked snapshot has no coordinator; restore a consistent relay snapshot before initializing');}@@ -1219,6 +1222,9 @@ function setupCommands(io, { first, values }) {},closeBoard: store.closeBoard,});+ if (linked && model !== undefined) await withBoard(ctx, (board) => ordered(ctx, board, 'register', [+ { lane: COORDINATOR, path: info.root, model },+ ]));io.result?.({ root: info.root, notes });const staging = notes.at(-1)?.startsWith('git add -f -- ') ? notes.at(-1) : null;(staging ? notes.slice(0, -1) : notes).forEach((note) => io.say(note));diff --git a/test/e2e-model-names.test.js b/test/e2e-model-names.test.jsindex 413b2346..fe6c3705 100644--- a/test/e2e-model-names.test.js+++ b/test/e2e-model-names.test.js@@ -104,12 +104,36 @@ test('the coordinator declares its model [O8,O3]', async (t) => {assert.equal(JSON.parse(modelEvent.event_detail).model, 'Later Coordinator');assert.equal(JSON.parse(shoutEvent.event_detail).model, 'Later Coordinator');+ const canonicalRelay = await relayClientFixture(t, { coordinatorModel: null });+ assert.equal(coordinatorModel(canonicalRelay.root), null, 'the canonical coordinator begins unknown');+ await canonicalRelay.link();+ /** Count real sealed model moves, excluding checkpoint and token requests. */+ const sealedMoves = () => canonicalRelay.calls.filter(call => call.method === 'POST' && /\/moves$/u.test(call.path)).length;+ for (const [command, model] of [['join', 'Linked Join Coordinator'], ['init', 'Linked Init Coordinator']]) {+ const movesBefore = sealedMoves();+ const declared = command === 'join'+ ? await canonicalRelay.cli('join', 'coordinator', '--model', model)+ : await canonicalRelay.cli('init', '--model', model);+ assert.equal(declared.code, 0, declared.failure);+ assert.equal(sealedMoves(), movesBefore + 1, `${command}: canonical linked declaration is one sealed move`);+ const registered = coordinatorEvents(canonicalRelay.root).filter(event => event.event_kind === 'model' && JSON.parse(event.event_detail).model === model);+ assert.equal(registered.length, 1, `${command}: the linked declaration records one model event`);+ assert.equal(coordinatorModel(canonicalRelay.root), model, `${command}: the model is persisted on the linked board`);+ const acted = await canonicalRelay.cli('shout', 'all', `${model} acts`);+ assert.equal(acted.code, 0, acted.failure);+ const latestShout = coordinatorEvents(canonicalRelay.root).filter(event => event.event_kind === 'shout').at(-1);+ assert.equal(JSON.parse(latestShout.event_detail).model, model, `${command}: later linked moves carry the declared model`);+ const exported = await canonicalRelay.cli('export');+ assert.equal(exported.code, 0, exported.failure);+ const canonical = exported.document.tables.agent.find(agent => agent.agent_id === 'coordinator');+ assert.equal(canonical.agent_path, canonicalRelay.root, `${command}: the canonical coordinator retains its own checkout`);+ }const relay = await relayClientFixture(t);const remoteDeclaration = await relay.cli('join', 'coordinator', '--model', 'Remote Coordinator');assert.equal(remoteDeclaration.code, 0, remoteDeclaration.failure);await relay.link();const pairing = await relay.cli('relay', 'pair');- assert.equal(pairing.code, 0, pairing.failure);+ assert.equal(pairing.code, 0, `${pairing.failure}; ${pairing.document.error?.code ?? ''}`);delete relay.env.PULLBOARD_MODEL;const paired = await relay.otherDeviceJoin(pairing.document.code);const before = await paired.cli('export');diff --git a/test/relay-client-fixture.js b/test/relay-client-fixture.jsindex 6448b355..5d5ba067 100644--- a/test/relay-client-fixture.js+++ b/test/relay-client-fixture.js@@ -111,8 +111,8 @@ function childResult(root, env, argv, observedSnapshotUploads, initialSnapshotUp});}-/** Start an isolated board with fallback-file keys and a real authorized loopback relay. */-export async function relayClientFixture(t, { cliChildren } = {}) {+/** Start an isolated board and authorized loopback relay; a null coordinatorModel keeps its initial identity unknown. */+export async function relayClientFixture(t, { cliChildren, coordinatorModel } = {}) {const scratch = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-relay-cleanup-')));const root = join(scratch, 'repo');const home = join(scratch, 'home');@@ -133,6 +133,8 @@ export async function relayClientFixture(t, { cliChildren } = {}) {GIT_AUTHOR_NAME: 'Relay Fixture', GIT_AUTHOR_EMAIL: '[email protected]',GIT_COMMITTER_NAME: 'Relay Fixture', GIT_COMMITTER_EMAIL: '[email protected]',};+ if (coordinatorModel === null) delete env.PULLBOARD_MODEL;+ else if (coordinatorModel !== undefined) env.PULLBOARD_MODEL = coordinatorModel;writeFileSync(tracePreload, `import { appendFileSync } from 'node:fs';import { createHash } from 'node:crypto';