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
chore: merge accepted #697 into #641 [C7]
Corey Olson63f858cf1f43
diff --cc docs/api.mdindex 699ab462,abe42911..42e163b1--- a/docs/api.md+++ b/docs/api.md@@@ -12,8 -12,8 +12,10 @@@ A successful command returns the fieldBrowser-free check admission is opt-in per machine with `"gate": { "browserFreeChecks": true }` in `~/.pullboard/settings.json`; it defaults to `false`. When enabled, the reviewed test classifier can let checks use a CPU-only gate slot. An absent or false setting keeps every check browser-gated, and uncertain or unsupported test commands remain browser-gated even when enabled. The same setting controls the wider frozen-check classification introduced in 0.8.26.+ The machine gate pool admits landings first and then everything else in arrival order. A machine opts in to reviews first with `"gate": { "queue": { "reviewsFirst": true } }` in `~/.pullboard/settings.json`: the pool then admits landing runs, then reviews, then submits and item checks, then focused and other runs, first come first served within each class. `gate.queue.agingMinutes` (a positive whole number, default `30`) is how long a waiting run waits before it moves up one class, so no class starves; it is used only while `reviewsFirst` is true. `pullboard settings` prints both values, and `pullboard resources` names the order in effect.++The memory hold is opt-in per machine with `"gate": { "memoryFloorMB": <n> }` in `~/.pullboard/settings.json`; absent, it is off and the pool admits by slots alone, as before. When set, before admitting a run the machine gate pool reads the machine's memory: on macOS the kernel's memory pressure level and free percentage, on Linux `MemAvailable` and the pressure stall averages in `/proc/pressure/memory`. The whole queue, landings included, waits in place while pressure is critical or free memory is under that many megabytes (`0` leaves only the pressure check). A held run prints one line naming why and the three biggest processes by memory, with pid, size and working directory, and starts once memory recovers. `pullboard resources` prints the same line and returns it as `memory` in JSON. Where memory cannot be read, the pool admits by slots alone and prints one warning that memory is not checked there.+When `add` or `edit` supplies a new nonempty check, it records the item before measuring that check in a background temporary checkout of the captured `main` commit. Use `--wait` to wait for the measurement before returning, or `args.wait: true` for an HTTP add/edit move. The item returned by `add`, `edit`, `show`, and `next --verify` may include `item_check_baseline`: `{command, main, result, request?, seconds?, reason?, warning?}`. `main` is the commit id or `null`, and `result` is `pending`, `green`, `red`, or `unavailable`. A background request carries an opaque `request` identity; an older completion cannot overwrite a newly edited or cleared check.An item's HTTP detail, and each item in the full board state, include `check` and, when recorded, `checkBaseline` with the same observation fields. A green result carries `warning: "CRITERION_PROVES_NOTHING"`; text output names that warning when showing or reserving the item for review, and when filing it with `--wait`. An exact match with the project gate configured at that main commit records green with `reason: "repo gate"` without running it again. A missing main records unavailable with `reason: "no main"` and still files the item. Changing the check replaces this observation; clearing it removes the observation. Captured observations and completions travel through ordered board moves, so replicas store results without executing commands. A completed result awaiting relay delivery stays on the measuring device and is retried by the next normal CLI command.diff --cc src/cli.jsindex dc73c0cb,d7916cd8..45d4ebbc--- a/src/cli.js+++ b/src/cli.js@@@ -78,7 -78,7 +78,7 @@@ import { flowLines, flowAlertLine } froimport { releaseHeadlinesBetween } from './changelog.js';import { exportBoard, importBoard } from './exchange.js';import { addSigner, assertRequiredSigners, defaultPrincipal, hasSignerFile } from './signature.js';- import { browserFreeChecksEnabled, loadMachineSettings, memoryFloorMB, setBrowserSlots, setGateSlots } from './settings.js';-import { browserFreeChecksEnabled, gateQueueSettings, loadMachineSettings, setBrowserSlots, setGateSlots } from './settings.js';++import { browserFreeChecksEnabled, gateQueueSettings, loadMachineSettings, memoryFloorMB, setBrowserSlots, setGateSlots } from './settings.js';import { formatSnapshotLimit, pendingSnapshotSize, pendingCheckpointProblem, relayCommandReceipt, relayCommandReceiptReported, relayLinked, relayOff, relayOn, relayOperation, relayRecover, relayRecovered, relayRevoke, relayStatus, relayTokens, syncRelay } from './relay.js';import { autoLinkProject, relayOnAll, revokeRelayDevice, unlinkedRelayProjects } from './relay-setup.js';import { readRelayMachine } from './relay-machine.js';@@@ -1819,14 -1817,15 +1819,16 @@@ function readCommands(io, { first, seco...listResources({ scope: 'machine' }).map((resource) => ({ ...resource, scope: 'machine' })),...listResources({ scope: 'repo', root: ctx.info.root }).map((resource) => ({ ...resource, scope: 'repo' })),];- io.result?.({ resources, browserSlots, memory });+ const queue = gateQueueSettings();- io.result?.({ resources, browserSlots, queue });++ io.result?.({ resources, browserSlots, queue, memory });io.say(`browserSlots (machine setting): ${browserSlots}`);+ io.say(`machine queue order (gate.queue.reviewsFirst ${queue.reviewsFirst}): ${queue.reviewsFirst ? `landing, review, submit, other; a waiting run moves up one class every ${queue.agingMinutes} minutes` : 'landings first, then arrival'}`);+ io.say(memory.line);if (!resources.length) io.say('no resources have been used');for (const resource of resources) {- io.say(`${resource.name} (${resource.scope}, capacity ${resource.capacity})`);+ io.say(`${resource.name} (${resource.scope}, capacity ${resource.capacity})${resource.order === 'arrival' ? '; an older pullboard is waiting, so this line is in arrival order, landings first' : ''}`);for (const holder of resource.holders) io.say(` held by ${agentDisplayName(agents, ctx.config, holder.agent)}${holder.repo ? ` in ${holder.repo}` : ''}${resourceRunLabel(holder)} since ${holder.since}`);- resource.line.forEach((waiter, index) => io.say(` ${index + 1}. waiting: ${agentDisplayName(agents, ctx.config, waiter.agent)}${waiter.repo ? ` in ${waiter.repo}` : ''}${resourceRunLabel(waiter)}`));+ resource.line.forEach((waiter, index) => io.say(` ${index + 1}. waiting: ${agentDisplayName(agents, ctx.config, waiter.agent)}${waiter.repo ? ` in ${waiter.repo}` : ''}${resourceRunLabel(waiter)}; class ${waiter.queueClass}${waiter.agedFrom ? `, aged up from ${waiter.agedFrom}` : ''}`));}return 0;},@@@ -2870,10 -2854,13 +2872,14 @@@ export function gateWaitReporter(io)function settingsCommand(io, { first, second, rest }) {if (!first && !second && !rest.length) {const settings = loadMachineSettings();- io.result?.({ settings, memoryFloorMB: memoryFloorMB() });+ const queue = gateQueueSettings();+ // The result names the queue order in effect, defaults included; the file keeps only what was set.- io.result?.({ settings: { ...settings, gate: { ...settings.gate, queue: { ...settings.gate?.queue, ...queue } } } });++ io.result?.({ settings: { ...settings, gate: { ...settings.gate, queue: { ...settings.gate?.queue, ...queue } } }, memoryFloorMB: memoryFloorMB() });io.say(`gateSlots: ${settings.gateSlots}`);io.say(`browserSlots: ${settings.browserSlots}`);+ io.say(`gate.queue.reviewsFirst: ${queue.reviewsFirst}${queue.reviewsFirst ? '' : ' (landings first, then arrival order)'}`);+ io.say(`gate.queue.agingMinutes: ${queue.agingMinutes}${queue.reviewsFirst ? '' : ' (used only while reviewsFirst is true)'}`);+ io.say(`gate.memoryFloorMB: ${memoryFloorMB() ?? 'off (the gate queue does not wait for memory)'}`);return 0;}if (!['gateSlots', 'browserSlots'].includes(first) || !second || rest.length) {diff --cc src/help.jsindex 912dad74,4e2fbe0e..fc5da6e2--- a/src/help.js+++ b/src/help.js@@@ -21,7 -21,7 +21,8 @@@ Set upullboard resources local resource holders and their FIFO queuespullboard settings [gateSlots <n> | browserSlots <n>] view or set machine capacity (gate default 2; browser default 1)browser-free check slots are opt-in: gate.browserFreeChecks in ~/.pullboard/settings.json (default false)+ reviews-first queue order is opt-in: gate.queue.reviewsFirst (default false), gate.queue.agingMinutes (default 30)+ memory hold is opt-in: gate.memoryFloorMB in ~/.pullboard/settings.json holds the queue under that many MB free or critical pressure (default off)pullboard view [--project] [--port N] [--no-open] every project on this machine in your browser; default http://127.0.0.1:${DEFAULT_VIEW_PORT}items, shouts, doctrine, agents and activity; --port 0 chooses a free port--project limits this view to the registered project for this repositorydiff --cc src/resources.jsindex 8a89ede6,b2fdb2be..5d6b7984--- a/src/resources.js+++ b/src/resources.js@@@ -1,7 -1,6 +1,7 @@@- /** Machine and repository queues persist leases; landings go first, then eligible waiters in arrival order [Q1,Q2,Q3]. */+ /** Machine and repository queues persist leases; landings first, then arrival order, or by class (landing, review, submit, other) aging up over time where the machine opts in [Q1,Q2,Q3]. */import { mkdirSync, realpathSync } from 'node:fs';-import { execFileSync } from 'node:child_process';+import { execFile, execFileSync } from 'node:child_process';+import { readFile, readlink } from 'node:fs/promises';import { basename, dirname, join, resolve } from 'node:path';import { randomUUID } from 'node:crypto';import { DatabaseSync } from 'node:sqlite';@@@ -348,11 -289,9 +422,11 @@@ export function memoryAdmission({ floorfunction pause(ms) { return new Promise((resolvePromise) => setTimeout(resolvePromise, ms)); }/**- * Join the landing-first queue; every other kind keeps its original FIFO ticket.+ * Join the queue in its admission class (landing, review, submit, other), aging up over time; FIFO by ticket within a class.*- * @param {{ name: string, capacity: number, capacityProvider?: () => number, browserCapacityProvider?: () => number, scope?: 'machine'|'repo'|'board', root?: string, agent?: string, repo?: string, landing?: boolean, itemCheck?: boolean, diagnostic?: boolean, browser?: boolean, item?: string, kind?: string, onWait?: (state: object) => void, allowIdleCapacityUpdate?: boolean }} options - Resource identity and queue class.+ * @param {{ name: string, capacity: number, capacityProvider?: () => number, browserCapacityProvider?: () => number, scope?: 'machine'|'repo'|'board', root?: string, agent?: string, repo?: string, landing?: boolean, itemCheck?: boolean, diagnostic?: boolean, browser?: boolean, item?: string, kind?: string, onWait?: (state: object) => void, allowIdleCapacityUpdate?: boolean, memory?: () => Promise<{ checked: boolean, held: boolean, line: string, warning?: string }> }} options - Resource identity and queue class.+ * memory, when given, is read before each admission: a held verdict keeps the whole queue+ * waiting in place, and an unchecked one is passed to onWait once so the caller can warn.* @returns {Promise<{ name: string, scope: string, token: string, pool: string, browser: boolean, waitMs: number, release: () => void, renew: () => void }>}*/export async function takeResource(options) {@@@ -410,33 -349,26 +484,34 @@@}db.prepare("INSERT INTO resource(name, capacity) VALUES ('browser', ?) ON CONFLICT(name) DO NOTHING").run(browserCapacity);}- // Retain queue metadata for older readers; admission uses landing priority and arrival only.- db.prepare('INSERT INTO waiter(token, name, pid, started, agent, repo, since, heartbeat, landing, item_check, diagnostic, browser, item, kind) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)').run(token, name, pid, started, agent, repo, queuedAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind);+ // The kind and flags decide the admission class; the ticket keeps arrival order within it.+ db.prepare('INSERT INTO waiter(token, name, pid, started, agent, repo, since, heartbeat, landing, item_check, diagnostic, browser, item, kind, classed) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)').run(token, name, pid, started, agent, repo, queuedAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind);});+ let memoryWarned = false;while (true) {+ const memory = options.memory ? await options.memory() : null;+ if (memory && !memory.checked && !memoryWarned) {+ memoryWarned = true;+ options.onWait?.({ holders: [], line: [], position: 0, memory });+ }+ const order = queueOrder(scope);const acquired = update(db, () => {const waiter = db.prepare('SELECT ticket FROM waiter WHERE token = ?').get(token);if (!waiter) {queuedAt = new Date().toISOString();- const rejoined = db.prepare('INSERT INTO waiter(token, name, pid, started, agent, repo, since, heartbeat, landing, item_check, diagnostic, browser, item, kind) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)').run(token, name, pid, started, agent, repo, queuedAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind);- return { acquired: false, state: { ...snapshot(db, name), position: waiterPosition(db, name, Number(rejoined.lastInsertRowid)), rejoined: true } };+ const rejoined = db.prepare('INSERT INTO waiter(token, name, pid, started, agent, repo, since, heartbeat, landing, item_check, diagnostic, browser, item, kind, classed) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)').run(token, name, pid, started, agent, repo, queuedAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind);+ return { acquired: false, state: { ...snapshot(db, name, order), position: waiterPosition(db, name, Number(rejoined.lastInsertRowid), { order }), rejoined: true } };}db.prepare('UPDATE waiter SET heartbeat = ? WHERE token = ?').run(Date.now(), token);- const spot = snapshot(db, name);- const reportPosition = waiterPosition(db, name, waiter.ticket);- const admissionPosition = waiterPosition(db, name, waiter.ticket, { eligibleOnly: true });+ const spot = snapshot(db, name, order);+ const reportPosition = waiterPosition(db, name, waiter.ticket, { order });+ const admissionPosition = waiterPosition(db, name, waiter.ticket, { eligibleOnly: true, order });const limit = db.prepare('SELECT capacity FROM resource WHERE name = ?').get(name).capacity;- const browserAdmissionPosition = browser ? waiterPosition(db, 'browser', waiter.ticket, { eligibleOnly: true }) : 0;+ const browserAdmissionPosition = browser ? waiterPosition(db, 'browser', waiter.ticket, { eligibleOnly: true, order }) : 0;const browserHolders = browser ? db.prepare("SELECT COUNT(*) AS count FROM holder WHERE name = 'gate' AND browser = 1").get().count : 0;const browserLimit = browser ? db.prepare("SELECT capacity FROM resource WHERE name = 'browser'").get().capacity : 0;+ // A machine short of memory holds the whole line in place; recovery admits it in order.+ if (memory?.held) return { acquired: false, state: { ...spot, position: reportPosition, memory } };if (admissionPosition === 1 && spot.holders.length < limit && (!browser || (browserAdmissionPosition === 1 && browserHolders < browserLimit))) {db.prepare('DELETE FROM waiter WHERE token = ?').run(token);const acquiredAt = new Date().toISOString();diff --cc src/settings.jsindex b398773c,9948416c..427f32d5--- a/src/settings.js+++ b/src/settings.js@@@ -30,9 -31,16 +31,19 @@@ export function loadMachineSettings()if (value.gate?.browserFreeChecks !== undefined && typeof value.gate.browserFreeChecks !== 'boolean') {throw new Refused('BAD_MACHINE_SETTINGS', `gate.browserFreeChecks in ${file} must be true or false`);}+ const queue = value.gate?.queue;+ if (queue !== undefined && (!queue || typeof queue !== 'object' || Array.isArray(queue))) {+ throw new Refused('BAD_MACHINE_SETTINGS', `gate.queue in ${file} must be an object; fix it before running Pullboard`);+ }+ if (queue?.reviewsFirst !== undefined && typeof queue.reviewsFirst !== 'boolean') {+ throw new Refused('BAD_MACHINE_SETTINGS', `gate.queue.reviewsFirst in ${file} must be true or false`);+ }+ if (queue?.agingMinutes !== undefined && (!Number.isSafeInteger(queue.agingMinutes) || queue.agingMinutes < 1)) {+ throw new Refused('BAD_MACHINE_SETTINGS', `gate.queue.agingMinutes in ${file} must be a positive whole number of minutes; fix it or remove it for the default ${DEFAULT_QUEUE_AGING_MINUTES}`);+ }+ if (value.gate?.memoryFloorMB !== undefined && (!Number.isSafeInteger(value.gate.memoryFloorMB) || value.gate.memoryFloorMB < 0)) {+ throw new Refused('BAD_MACHINE_SETTINGS', `gate.memoryFloorMB in ${file} must be a whole number of megabytes, 0 or more; fix it before running Pullboard`);+ }const gateSlots = value.gateSlots ?? DEFAULT_GATE_SLOTS;if (!Number.isSafeInteger(gateSlots) || gateSlots < 1) {throw new Refused('BAD_GATE_SLOTS', `gateSlots in ${file} must be a positive integer; run pullboard settings gateSlots <n>`);@@@ -49,15 -57,18 +60,27 @@@ export function browserFreeChecksEnablereturn loadMachineSettings().gate?.browserFreeChecks === true;}+ /**+ * The gate pool's admission order. Reviews-first class order is opt-in per machine because it+ * changes who waits for whom on every board sharing the pool; absent or false keeps landings+ * first, then arrival. agingMinutes only matters while class order is on.+ *+ * @returns {{ reviewsFirst: boolean, agingMinutes: number }}+ */+ export function gateQueueSettings() {+ const queue = loadMachineSettings().gate?.queue;+ return { reviewsFirst: queue?.reviewsFirst === true, agingMinutes: queue?.agingMinutes ?? DEFAULT_QUEUE_AGING_MINUTES };+ }++/**+ * The free-memory floor, in megabytes, below which the machine gate pool holds its queue, or null+ * when the hold is off. Gate and queue behavior is off by default, the person's rule, so an absent+ * floor keeps today's admission by slots alone.+ */+export function memoryFloorMB() {+ return loadMachineSettings().gate?.memoryFloorMB ?? null;+}+/** Atomically replace machine settings without exposing a partial JSON file. */function writeMachineSettings(settings) {const file = machineSettingsFile();