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
Merge remote-tracking branch 'origin/main' into core/718-claude
Corey Olson62361c60de19
diff --cc docs/api.mdindex 2ec55359,282435fa..e003229b--- a/docs/api.md+++ b/docs/api.md@@@ -14,8 -14,8 +14,10 @@@ Browser-free check admission is opt-inThe 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. While the floor is set, `pullboard resources` prints the same line and returns it as `memory` in JSON; with no floor it reads no memory and `memory` is `null`. Where memory cannot be read, the pool admits by slots alone and prints one warning that memory is not checked there.++Short gate slots are opt-in per machine with `pullboard settings gate.shortSlots <n>`, stored as `"gate": { "shortSlots": n }`; the default `0` keeps them off and the pool behaves as before. With `n` above `0`, up to `n` runs that name their test files (a `pullboard check` or a review whose check is a literal `node bin/run-tests.js` call over test files, or a direct `node bin/run-tests.js <files>`) are admitted on short slots while every gate slot is held. Whole suites, directories, landings, diagnostics and anything the parser cannot read never use them, and a child that does not name its files cannot reuse a short lease (`SHORT_SLOT_FULL_SUITE`). Short slots do not add to `gateSlots`, and browser runs still count against `browserSlots`. `pullboard settings` prints `gate.shortSlots`; `pullboard resources --json` reports `shortSlots`, each gate holder's `slot` (`gate` or `short`), and `requestedSlot: "short-eligible"` on a waiting run that may take one.+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 c7d4220a,8e575399..f82b19cd--- a/src/cli.js+++ b/src/cli.js@@@ -17,9 -17,9 +17,9 @@@ import { doctrineHistory, loadDoctrineimport { checkRulesAt, doctrineReport, hasSubmitRules, holdDoctrine, ruleLine } from './doctrine-checks.js';import { agentSessionDigest, requirePersonChannel } from './person.js';import { bindLocalSession, localSessionMatches } from './agent-session.js';- import { decisionProjection, planRowApply, prepareRowDecisions, restoreRowApply, writeRowApply } from './row-decisions.js';+ import { decisionAnswer, decisionProjection, handAnsweredQuestions, planRowApply, prepareRowDecisions, restoreRowApply, writeRowApply } from './row-decisions.js';import { digestOf, gateReport, refuseSandboxBlocked, runGate, runProfiledShell, runSubmitGate, submitGateReport, timingDigest, withGateSlot } from './gate.js';-import { checkNeedsBrowser } from './browser-admission.js';+import { checkNeedsBrowser, explicitCheckFiles } from './browser-admission.js';import { bareWorktreeFinding, codeIsFromMain, contains, differFromHead, git, gitChildEnv, headCommit, headTree, invalidateGitFacts, isClean, mainCheckout, patchId, repoInfo, resolveCommit, tryGit, untracked, withGitFacts } from './git.js';import {FIX_NOTE,@@@ -85,7 -85,7 +85,7 @@@ import { flowLines, flowAlertLine } froimport { releaseHeadlinesBetween } from './changelog.js';import { exportBoard, importBoard } from './exchange.js';import { addSigner, assertRequiredSigners, defaultPrincipal, hasSignerFile } from './signature.js';- import { addRunner, browserFreeChecksEnabled, gateQueueSettings, gateShortSlots, loadMachineSettings, setBrowserSlots, setGateShortSlots, setGateSlots } from './settings.js';-import { addRunner, browserFreeChecksEnabled, gateQueueSettings, loadMachineSettings, memoryFloorMB, setBrowserSlots, setGateSlots } from './settings.js';++import { addRunner, browserFreeChecksEnabled, gateQueueSettings, gateShortSlots, loadMachineSettings, memoryFloorMB, setBrowserSlots, setGateShortSlots, 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';@@@ -1932,11 -1959,10 +1959,12 @@@ function readCommands(io, { first, seco];const runners = runnerResourceStatus(loadMachineSettings().runners ?? []);const queue = gateQueueSettings();- io.result?.({ resources, runners, browserSlots, queue, memory });+ const shortSlots = gateShortSlots();- io.result?.({ resources, runners, browserSlots, queue, shortSlots });++ io.result?.({ resources, runners, browserSlots, queue, memory, shortSlots });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'}`);+ if (shortSlots) io.say(`gate.shortSlots (machine setting): ${shortSlots}; runs that name their test files may use them while every gate slot is busy`);+ if (memory) 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})${resource.order === 'arrival' ? '; an older pullboard is waiting, so this line is in arrival order, landings first' : ''}`);@@@ -3183,26 -3225,16 +3232,27 @@@ function settingsCommand(io, { first, sconst settings = loadMachineSettings();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 } } }, memoryFloorMB: memoryFloorMB() });+ const shortSlots = gateShortSlots();- io.result?.({ settings: { ...settings, gate: { ...settings.gate, queue: { ...settings.gate?.queue, ...queue }, shortSlots } } });++ io.result?.({ settings: { ...settings, gate: { ...settings.gate, queue: { ...settings.gate?.queue, ...queue }, shortSlots } }, 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)'}`);+ io.say(`gate.shortSlots: ${shortSlots}${shortSlots ? '' : ' (off; runs that name their test files wait for a gate slot)'}`);return 0;}- if (!['gateSlots', 'browserSlots'].includes(first) || !second || rest.length) {- throw new Refused('USAGE', 'pullboard settings gateSlots <n> | browserSlots <n>');+ if (!['gateSlots', 'browserSlots', 'gate.shortSlots'].includes(first) || !second || rest.length) {+ throw new Refused('USAGE', 'pullboard settings gateSlots <n> | browserSlots <n> | gate.shortSlots <n>');+ }+ if (first === 'gate.shortSlots') {+ if (!/^(?:0|[1-9]\d*)$/u.test(second) || !Number.isSafeInteger(Number(second))) {+ throw new Refused('BAD_SHORT_SLOTS', 'gate.shortSlots must be a whole number, 0 or more; run pullboard settings gate.shortSlots <n>');+ }+ const settings = setGateShortSlots(Number(second));+ io.result?.({ settings });+ io.say(`gate.shortSlots set to ${settings.gate.shortSlots}`);+ return 0;}if (!/^[1-9]\d*$/u.test(second) || !Number.isSafeInteger(Number(second))) {if (first === 'gateSlots') throw new Refused('USAGE', 'pullboard settings gateSlots <positive integer>');diff --cc src/gate.jsindex 91999c9b,cf33501f..d0fb0759--- a/src/gate.js+++ b/src/gate.js@@@ -13,8 -13,8 +13,8 @@@ import { fileURLToPath } from 'node:urlimport { gitChildEnv, gitPath, headTree, invalidateGitFacts, isClean, untracked } from './git.js';import { secretsIn } from './hooks.js';import { Refused } from './refused.js';- import { GATE_SLOT_HELD_ENV, gateSlotEnvironment, inheritedGateSlot, takeResource } from './resources.js';- import { browserFreeChecksEnabled, gateShortSlots, loadMachineSettings } from './settings.js';+ import { GATE_SLOT_HELD_ENV, gateSlotEnvironment, inheritedGateSlot, memoryAdmission, readMachineMemory, takeResource } from './resources.js';-import { browserFreeChecksEnabled, loadMachineSettings, memoryFloorMB } from './settings.js';++import { browserFreeChecksEnabled, gateShortSlots, loadMachineSettings, memoryFloorMB } from './settings.js';import { selectAffectedTests } from './affected-tests.js';import { checkNeedsBrowser, testsNeedBrowser } from './browser-admission.js';import { timingFromOutput, timingRunner } from './timing.js';@@@ -496,17 -496,15 +496,19 @@@ function hasPipeline(command)}/** Run work under the machine queue: landings first, then every other eligible waiter in arrival order.+ * The whole queue waits while the machine is out of memory, so a run never starts into swap.** @param {string} root - Checkout used to locate the machine resource database.- * @param {(lease: { waitMs: number, token?: string, pool?: string, browser?: boolean, release: () => void }) => any | Promise<any>} action - Work to perform while holding a slot.- * @param {{ landing?: boolean, itemCheck?: boolean, diagnostic?: boolean, browser?: boolean, remote?: boolean, agent?: string, item?: string|number, kind?: string, onWait?: (state: object) => void, readMemory?: typeof readMachineMemory }} [options] - Queue class, remote eligibility, progress reporter and, for tests, the machine memory reader.+ * shortEligible marks a run that names its test files: with gate.shortSlots above 0 it may take a- * short slot when every ordinary slot is held, and a full suite can never inherit that slot.++ * short slot when every ordinary slot is held, and a full suite can never inherit that slot. A memory++ * hold (gate.memoryFloorMB) holds short slots too, since a short run uses the same machine memory.+ *+ * @param {(lease: { waitMs: number, token?: string, pool?: string, browser?: boolean, slotClass?: 'gate'|'short', release: () => void }) => any | Promise<any>} action - Work to perform while holding a slot.- * @param {{ landing?: boolean, itemCheck?: boolean, shortEligible?: boolean, diagnostic?: boolean, browser?: boolean, agent?: string, item?: string|number, kind?: string, onWait?: (state: object) => void }} [options] - Queue class and progress reporter.++ * @param {{ landing?: boolean, itemCheck?: boolean, shortEligible?: boolean, diagnostic?: boolean, browser?: boolean, remote?: boolean, agent?: string, item?: string|number, kind?: string, onWait?: (state: object) => void, readMemory?: typeof readMachineMemory }} [options] - Queue class, short-slot eligibility, remote eligibility, progress reporter and, for tests, the machine memory reader.* @returns {Promise<any>} The action's result after releasing its lease.*/- export async function withGateSlot(root, action, { landing = false, itemCheck = false, shortEligible = false, diagnostic = false, browser = false, remote = true, agent, item = '', kind = '', onWait } = {}) {-export async function withGateSlot(root, action, { landing = false, itemCheck = false, diagnostic = false, browser = false, remote = true, agent, item = '', kind = '', onWait, readMemory = readMachineMemory } = {}) {- const inherited = inheritedGateSlot({ root, browser });++export async function withGateSlot(root, action, { landing = false, itemCheck = false, shortEligible = false, diagnostic = false, browser = false, remote = true, agent, item = '', kind = '', onWait, readMemory = readMachineMemory } = {}) {+ const inherited = inheritedGateSlot({ root, browser, namedFiles: shortEligible });if (inherited) {try { return await action(inherited); }finally { inherited.release(); }diff --cc src/help.jsindex d78bfcaa,ce71173b..015925b0--- a/src/help.js+++ b/src/help.js@@@ -24,7 -25,7 +25,8 @@@ Set upullboard 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)+ short slots for runs that name their test files are opt-in: pullboard settings gate.shortSlots <n> (default 0)pullboard runner add <ssh-host> --slots <n> --browser <n> [--node <remote-path>] [--root <remote-path>]register SSH test capacity; no runner sign-in; root defaults to ~/.pullboard-runnerpullboard view [--project] [--port N] [--no-open] every project on this machine in your browser; default http://127.0.0.1:${DEFAULT_VIEW_PORT}diff --cc src/resources.jsindex 0181c658,3057ff88..0992b20f--- a/src/resources.js+++ b/src/resources.js@@@ -483,8 -598,11 +616,11 @@@ function pause(ms) { return new Promise/*** 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, shortCapacityProvider?: () => number, browserCapacityProvider?: () => number, scope?: 'machine'|'repo'|'board', root?: string, agent?: string, repo?: string, landing?: boolean, itemCheck?: boolean, shortEligible?: boolean, diagnostic?: boolean, browser?: boolean, remote?: boolean, runnerProvider?: () => Array<{host:string,slots:number,browser:number}>, item?: string, kind?: string, onWait?: (state: object) => void, allowIdleCapacityUpdate?: boolean, _resume?: object }} options - Resource identity, queue class and optional remote executor pool.- * @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, remote?: boolean, runnerProvider?: () => Array<{host:string,slots:number,browser:number}>, item?: string, kind?: string, onWait?: (state: object) => void, allowIdleCapacityUpdate?: boolean, memory?: () => Promise<{ checked: boolean, held: boolean, line: string, warning?: string }>, _resume?: object }} options - Resource identity, queue class, optional remote executor pool and memory check.++ * @param {{ name: string, capacity: number, capacityProvider?: () => number, shortCapacityProvider?: () => number, browserCapacityProvider?: () => number, scope?: 'machine'|'repo'|'board', root?: string, agent?: string, repo?: string, landing?: boolean, itemCheck?: boolean, shortEligible?: boolean, diagnostic?: boolean, browser?: boolean, remote?: boolean, runnerProvider?: () => Array<{host:string,slots:number,browser:number}>, item?: string, kind?: string, onWait?: (state: object) => void, allowIdleCapacityUpdate?: boolean, memory?: () => Promise<{ checked: boolean, held: boolean, line: string, warning?: string }>, _resume?: object }} options - Resource identity, queue class, short-slot eligibility, optional remote executor pool and memory check.+ * memory, when given, is read before each admission: a held verdict keeps the whole queue- * waiting in place, local and remote slots alike, and an unchecked one is passed to onWait once++ * waiting in place, local, remote and short slots alike, 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, runner?: {host:string,slots:number,browser:number}, waitMs: number, release: () => void, renew: () => void, requeueRunner?: () => Promise<object> }>}+ * @returns {Promise<{ name: string, scope: string, token: string, pool: string, browser: boolean, slotClass: 'gate'|'short', runner?: {host:string,slots:number,browser:number}, waitMs: number, release: () => void, renew: () => void, requeueRunner?: () => Promise<object> }>}*/export async function takeResource(options) {const { name, capacity, scope = 'machine', root = process.cwd(), allowIdleCapacityUpdate = false } = options;@@@ -585,10 -705,12 +727,12 @@@// The marker follows this poll's setting, so a change mid-wait reaches every process's ranking.db.prepare('UPDATE waiter SET heartbeat = ?, classed = ? WHERE token = ?').run(Date.now(), classedMarker(order), token);const spot = snapshot(db, name, order);- const reportPosition = waiterPosition(db, name, waiter.ticket, { order });+ const reportPosition = waiterPosition(db, name, waiter.ticket, { order, shortCapacity: options.shortCapacityProvider?.() ?? 0 });const limit = db.prepare('SELECT capacity FROM resource WHERE name = ?').get(name).capacity;+ // 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 } };const executor = name === 'gate'- ? gateAdmission(db, waiter.ticket, limit, runners, order)+ ? gateAdmission(db, waiter.ticket, limit, options.shortCapacityProvider?.() ?? 0, runners, order): (waiterPosition(db, name, waiter.ticket, { eligibleOnly: true, order }) === 1 && spot.holders.length < limit ? { host: '' } : null);if (executor) {db.prepare('DELETE FROM waiter WHERE token = ?').run(token);