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(review): give newcomers an independent reviewer start [V1,B26]
Corey Olson938eed038045
diff --git a/src/cli.js b/src/cli.jsindex acfdd3b7..f857f188 100644--- a/src/cli.js+++ b/src/cli.js@@ -35,6 +35,7 @@ import {import { performance } from 'node:perf_hooks';import { pathToFileURL } from 'node:url';import { parseArgs } from 'node:util';+import { reviewerStartup } from './next-steps.js';import * as store from './board.js';import {CONFIG_FILE,@@ -761,10 +762,9 @@ function checkMainVerifier(ctx, board, values) {const agents = store.listAgents(board).filter((agent) => agent.agent_id !== COORDINATOR);const listed = agents.length ? ` Agent worktrees: ${agents.slice(0, 6).map((agent) => `${displayAgentName(agent, ctx.config.agents.names)} at ${agent.agent_path}`).join('; ')}.` : '';const detached = tryGit(ctx.info.root, ['symbolic-ref', '-q', 'HEAD']).status !== 0 ? ' The main checkout is not on its branch; whoever switched it puts it back.' : '';- throw new Refused(- 'MAIN_IS_COORDINATOR',+ throw new Refused('MAIN_IS_COORDINATOR',`this is the main checkout, so this verdict would be the coordinator's.${listed}${detached}`,- 'create a new reviewer worktree with git worktree add --detach .claude/worktrees/<reviewer-name> HEAD, using an unused folder; then cd there and run pullboard join <lane> --model "<model name>" and pullboard next --verify <id>. The reviewer must not be the builder. The coordinator instead adds --as coordinator',+ reviewerStartup(ctx.info.root, ctx.config, values.verifyId),);}@@ -2787,7 +2787,7 @@ function reportSubmission(ctx, id, commit, gate, doctrine = []) {ctx.io.result?.({ id, commit, pin, gate, ...(doctrine.length ? { doctrine } : {}) });ctx.io.say(`submitted #${id} at ${commit.slice(0, 12)}; ${gate.report}`);ctx.io.say(`pinned as ${pin}, so this work can't be lost; keep your worktree until it is merged`);- ctx.io.say(`next: another agent checks out ${commit.slice(0, 12)} and runs: pullboard verify ${id} accept|reject`);+ ctx.io.say(`next: ${reviewerStartup(primaryCheckoutRoot(ctx.info), ctx.config, id)}`);return 0;}diff --git a/src/init.js b/src/init.jsindex 72f61545..2fb611d2 100644--- a/src/init.js+++ b/src/init.js@@ -39,6 +39,7 @@ import { loadDoctrine } from './doctrine.js';import { installHooks } from './hooks.js';import { machineHome } from './machine-home.js';import { Refused } from './refused.js';+import { reviewerStartup } from './next-steps.js';import {AGENT_SHELL_MARKERS,remoteShell,@@ -613,6 +614,7 @@ export function initRepo({ info, openBoardHere, register, closeBoard, model, percloseBoard(board);}notes.push('opened the board in the git dir; this checkout is the coordinator');+ notes.push(reviewerStartup(root, loadConfig(root)));notes.push(...laneProposalNotes(proposeLanes(root)));if (!configuredGate(root)) {notes.push(gatediff --git a/src/next-steps.js b/src/next-steps.jsindex ccc1f36d..bb3f3ac8 100644--- a/src/next-steps.js+++ b/src/next-steps.js@@ -8,6 +8,31 @@* every code raised in src/ has a row here.*/import { RECORDED_GENERIC_NEXT } from './recorded-refusal.js';+import { existsSync } from 'node:fs';+import {+ basename,+ dirname,+ join,+} from 'node:path';++/** Give a separate agent session one pasteable startup line, without claiming or verifying for it [V1,B26]. */+export function reviewerStartup(root, config, id) {+ if (!root) return 'ask the coordinator to locate the main checkout for a different agent session; the reviewer must not be the builder';+ const lanes = Object.entries(config.lanes).filter(([name]) => name !== 'coordinator');+ const lane = lanes.find(([, value]) => !value.owns.length)?.[0] ?? lanes[0]?.[0];+ if (!lane) return 'ask the coordinator to declare a reviewer lane for a different agent session; the reviewer must not be the builder';+ /** Quote the whole path so spaces, apostrophes and dollar signs remain literal. */+ const quote = value => "'" + value.replaceAll("'", "'\\''") + "'";+ /** Respect the configured placement while avoiding an existing checkout. */+ const location = number => config.worktrees === 'inside'+ ? join(root, '.claude', 'worktrees', `reviewer-${number}`)+ : join(dirname(root), `${basename(root)}-reviewer-${number}`);+ let number = 1;+ while (existsSync(location(number))) number++;+ const path = location(number);+ const command = `cd ${quote(root)} && mkdir -p ${quote(dirname(path))} && git worktree add --detach ${quote(path)} HEAD && cd ${quote(path)} && pullboard join ${lane} --model "<model name>" && pullboard next --verify${id ? ' ' + id : ''}`;+ return `Use a different agent session; the reviewer must not be the builder. Run: ${command}`;+}/** The coordinator carries every seat's request for a person decision [B26]. */export const COORDINATOR_PERSON_REQUEST = 'ask the coordinator to bring it to the person: pullboard shout coordinator "<what is needed>" --decision';diff --git a/test/next-verify.test.js b/test/next-verify.test.jsindex 8edcfc27..740848b8 100644--- a/test/next-verify.test.js+++ b/test/next-verify.test.js@@ -2,14 +2,15 @@import { submitFixture } from './board-submit-fixture.js';import assert from 'node:assert/strict';import { createHash } from 'node:crypto';-import { chmodSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { chmodSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { test } from 'node:test';import * as store from '../src/board.js';import { main } from '../src/cli.js';import { loadConfig } from '../src/config.js';-import { runFixtureGit } from './fixture-child.js';+import { runFixtureChild, runFixtureGit } from './fixture-child.js';+import { createE2eHelpers } from './e2e-helpers.js';const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');const HOUR = 3_600_000;@@ -90,3 +91,56 @@ test('[C7,P4] next --verify with nothing submitted yet says the builder is stillassert.match(ready.stdout, new RegExp(`next to verify: #${id} Being built`, 'u'));assert.equal(store.getItem(box.board, id).item_review_by, box.reviewerId, 'a submitted item is reserved as before');});++test('a lone newcomer starts a reviewer with one command [V1,B26]', t => {+ const helpers = createE2eHelpers();+ t.after(helpers.cleanup);+ const machine = helpers.sandbox();+ machine.dir = join(machine.dir, "reviewer's board $dollar");+ mkdirSync(machine.dir);+ const box = helpers.project('true', machine);+ const configFile = join(box.repo, 'pullboard.json');+ const config = JSON.parse(readFileSync(configFile, 'utf8'));+ config.lanes.review = { owns: [] };+ writeFileSync(configFile, JSON.stringify(config, null, 2));+ box.git(box.repo, 'add', 'pullboard.json');+ box.git(box.repo, 'commit', '-q', '-m', 'chore: keep a dedicated reviewer lane');+ box.git(box.web, 'merge', '-q', '--ff-only', 'main');+ const model = box.env.PULLBOARD_MODEL;+ delete box.env.PULLBOARD_MODEL;+ const initialized = box.run(box.repo, 'init');+ if (model !== undefined) box.env.PULLBOARD_MODEL = model;+ assert.equal(initialized.code, 0, initialized.err);+ const added = box.run(box.repo, 'add', 'web', 'Ready for review', '--specs', 'G1',+ '--criterion', 'The readiness marker exists.', '--check', 'test -f web/ready');+ assert.equal(added.code, 0, added.err);+ assert.equal(box.run(box.web, 'claim', '1').code, 0);+ const committed = helpers.commitFile(box, box.web, 'web/ready', 'ready\n', 'feat(web): readiness marker [G1]');+ assert.equal(committed.status, 0, committed.stderr);+ const submitted = box.run(box.web, 'submit', '1');+ assert.equal(submitted.code, 0, submitted.err);+ assert.match(submitted.out, /different agent session/iu);+ const startup = submitted.out.split('\n').find(line => line.includes('git worktree add --detach'));+ assert.ok(startup, 'submit prints the complete reviewer startup on one line');+ assert.match(startup, /&&.*pullboard join review.*&&.*pullboard next --verify 1/u);+ assert.equal(initialized.out.split('\n').filter(line => line.includes('git worktree add --detach')).length, 1,+ 'init explains the same reviewer path once');+ const mainRefusal = JSON.parse(box.run(box.repo, 'next', '--verify', '1', '--json').out).error;+ assert.equal(mainRefusal.code, 'MAIN_IS_COORDINATOR');+ assert.match(mainRefusal.next, /different agent session/iu);+ assert.match(mainRefusal.next, /git worktree add --detach.*&&.*pullboard join review.*&&.*pullboard next --verify 1/u);+ const self = JSON.parse(box.run(box.web, 'next', '--verify', '1', '--json').out).error;+ assert.equal(self.code, 'SELF_VERIFY', 'the startup guidance does not give the builder a verdict');+ const command = startup.slice(startup.indexOf('cd ')).replaceAll('"<model name>"', "'Independent Reviewer Model'");+ const independent = runFixtureChild('/bin/sh', ['-c', command], { cwd: box.repo,+ env: { ...box.env, CODEX_THREAD_ID: 'independent-review-fixture' }, encoding: 'utf8' });+ assert.equal(independent.status, 0, independent.context);+ assert.match(independent.stdout, /next to verify: #1 Ready for review/u,+ 'the printed line reserves the submitted item from the new independent fixture session');+ const board = store.openBoard(join(box.repo, '.git', 'pullboard', 'board.sqlite'));+ try {+ const item = store.getItem(board, 1);+ assert.equal(item.item_status, 'submitted', 'startup reserves a review without writing a verdict');+ assert.notEqual(item.item_review_by, item.item_built_by);+ } finally { store.closeBoard(board); }+});