Skip to content

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.

feat(next): a reviewer is told the builder is still working [C7,P4]

Corey Olson12ccb2819fd7
diff --git a/src/cli.js b/src/cli.js
index be1e8c61..fde80d62 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -2737,6 +2737,22 @@ function sayReviewOffer(ctx, found) {
else ctx.io.say('no build is currently free in your lane; this review is available');
}
+/**
+ * A review search that found nothing while another agent is still building: say so, with the wait,
+ * so a reviewer who starts first is not told NOTHING_FREE as if the board were idle [C7,P4].
+ *
+ * @param {any} ctx
+ */
+function refuseWhileBuilding(ctx) {
+ const building = withBoard(ctx, (board) => {
+ const me = whoAmI(ctx, board).id;
+ const items = store.listItems(board);
+ if (items.some((item) => item.item_status === 'submitted' && item.item_built_by !== me)) return [];
+ return items.filter((item) => item.item_status === 'claimed' && item.item_owner !== me).map((item) => `#${item.item_id}`).reverse();
+ });
+ if (building.length) throw new Refused('REVIEW_NOT_READY', `nothing to review yet; the builder is still working on ${building.join(', ')}`);
+}
+
/**
* `pullboard next` (N2): the whole start of an agent's loop in one command. With --wait, it keeps
* looking until something is free, so an agent blocked on other work needs no polling of its own.
@@ -2791,6 +2807,7 @@ async function nextHere(io, values) {
return 0;
}
if (!found.retry && Date.now() >= deadline) {
+ if (values.verify) refuseWhileBuilding(ctx);
const waited = minutes ? ` after ${minutes} minutes` : '';
const agents = withBoard(ctx, (board) => store.listAgents(board));
const repair = `${waited}. To keep looking: pullboard next --wait 9${values.verify ? ' --verify' : ''} (minutes; give the command a ten-minute timeout)`;
diff --git a/src/next-steps.js b/src/next-steps.js
index 4bc1f143..aa3b8a5d 100644
--- a/src/next-steps.js
+++ b/src/next-steps.js
@@ -322,6 +322,7 @@ export const NEXT_STEPS = Object.freeze({
RESOURCE_CAPACITY_MISMATCH: 'check the configured capacity with pullboard settings, then retry using that capacity',
RESOURCE_LEASE_LOST: 'take the resource again, then retry',
REVIEW_COOLDOWN: 'take another review: pullboard next --verify',
+ REVIEW_NOT_READY: 'wait for the submit with pullboard watch, or check back: pullboard next --verify',
REVIEW_HELD: 'take another review: pullboard next --verify',
RUNNER_BUSY: 'wait for the named runner\'s active tests to finish, then retry its settings change',
RUNNER_CAPACITY_MISMATCH: 'wait for active runner leases to fit the configured capacity, then retry the run',
diff --git a/test/next-verify.test.js b/test/next-verify.test.js
new file mode 100644
index 00000000..5147dcf0
--- /dev/null
+++ b/test/next-verify.test.js
@@ -0,0 +1,84 @@
+/** A reviewer who starts before the builder submits is told the builder is still working [C7,P4]. */
+import assert from 'node:assert/strict';
+import { createHash } from 'node:crypto';
+import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } 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';
+
+const HOUR = 3_600_000;
+
+/** Run the actual CLI in one worktree with the fixture's board clock. */
+async function run(box, cwd, args) {
+ let stdout = '';
+ let stderr = '';
+ const code = await main(args, { cwd, clock: box.clock,
+ stdout: { isTTY: false, write: (part) => { stdout += part; } },
+ stderr: { write: (part) => { stderr += part; } } });
+ return { code, stdout, stderr };
+}
+
+/** A real repo with a builder and a reviewer worktree, each joined to the board. */
+async function project(t) {
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-next-verify-')));
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
+ const root = join(dir, 'repo');
+ mkdirSync(root);
+ const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => !name.startsWith('GIT_')));
+ Object.assign(env, { GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1',
+ GIT_AUTHOR_NAME: 'Verify fixture', GIT_AUTHOR_EMAIL: '[email protected]',
+ GIT_COMMITTER_NAME: 'Verify fixture', GIT_COMMITTER_EMAIL: '[email protected]' });
+ /** Git in the fixture, with a synthetic identity and no inherited GIT_* variables. */
+ const git = (cwd, ...args) => runFixtureGit(args, { cwd, env, stdio: 'pipe', encoding: 'utf8' });
+ let at = Date.parse('2026-10-17T12:00:00.000Z');
+ const clock = { now: () => new Date(at) };
+ const box = { root, clock };
+ git(root, 'init', '-q', '-b', 'main');
+ const initialized = await run(box, root, ['init']);
+ assert.equal(initialized.code, 0, initialized.stderr);
+ writeFileSync(join(root, 'pullboard.json'), JSON.stringify({ gate: 'true',
+ lanes: { web: { owns: ['web/'], specs: ['G1'] }, review: { owns: [], specs: ['G1'] } }, shared: [] }));
+ writeFileSync(join(root, 'SPEC.md'), '# Verify fixture\n## G\n- G1 [approved, must] Every move keeps its evidence. | gate: true\n');
+ writeFileSync(join(root, loadConfig(root).practice), '');
+ git(root, 'add', '-A'); git(root, 'commit', '-q', '-m', 'chore: initialize verify fixture');
+ box.builder = join(dir, 'builder'); box.reviewer = join(dir, 'reviewer');
+ git(root, 'worktree', 'add', '-q', box.builder, '-b', 'web/one');
+ git(root, 'worktree', 'add', '-q', box.reviewer, '-b', 'review/one');
+ box.board = store.openBoard(join(root, '.git', 'pullboard', 'board.sqlite'), clock);
+ t.after(() => store.closeBoard(box.board));
+ box.builderId = store.register(box.board, { lane: 'web', path: box.builder });
+ box.reviewerId = store.register(box.board, { lane: 'review', path: box.reviewer });
+ return box;
+}
+
+/** File an item and have the builder claim it, with a frozen criterion as a real claim has. */
+function claimed(box) {
+ const id = store.addItem(box.board, { by: 'coordinator', lane: 'web', title: 'Being built', specs: 'G1', criterion: 'The move keeps evidence.', check: 'true' });
+ const text = JSON.stringify({ rows: [{ id: 'G1', text: 'Every move keeps its evidence.', gate: 'true' }] });
+ store.claim(box.board, id, { agentId: box.builderId, lane: 'web', leaseMs: HOUR,
+ freeze: () => ({ text, digest: createHash('sha256').update(text).digest('hex') }) });
+ return id;
+}
+
+test('[C7,P4] next --verify with nothing submitted yet says the builder is still working', async (t) => {
+ const box = await project(t);
+ const id = claimed(box);
+ const early = await run(box, box.reviewer, ['next', '--verify']);
+ assert.equal(early.code, 1, 'nothing is reserved, so the command still exits 1');
+ const said = early.stdout + early.stderr;
+ assert.match(said, new RegExp(`nothing to review yet; the builder is still working on #${id}`, 'u'));
+ assert.match(said, /pullboard watch/u, 'the next step names pullboard watch');
+ assert.match(said, /check back: pullboard next --verify/u, 'or check back with the same command');
+ assert.doesNotMatch(said, /NOTHING_FREE/u, 'no NOTHING_FREE when work is in progress');
+ assert.equal(store.getItem(box.board, id).item_review_by, null, 'nothing is reserved');
+
+ store.submit(box.board, id, { agentId: box.builderId, commit: String(id).padStart(40, 'a'), tree: String(id).padStart(40, 'b') });
+ const ready = await run(box, box.reviewer, ['next', '--verify']);
+ assert.equal(ready.code, 0, ready.stderr);
+ assert.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');
+});