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): sync main for waiver gates [B3,R3,C7]
Corey Olson1e9b842229bc
diff --cc src/board.jsindex c63980ab,c62b46bf..f49282ad--- a/src/board.js+++ b/src/board.js@@@ -17,9 -17,8 +17,10 @@@ import { ENGINE_VERSION, GUARDS, IN_STAimport { Refused } from './refused.js';import { barCorrectionFields } from './bar-corrections.js';import { factFromEvent, requestAnswerRefusal, tellAnswerImplications, tellFactImplications, tellVerdictImplications } from './implies.js';+import { landingFlakes, landingWaiverCovers, landingWaiverKind } from './landing-exceptions.js';import { parseSpec } from './spec.js';+export { landingFlakes, landingWaiverCovers, landingWaiverKind };+ export { acceptCheck } from './check-accept.js';export const ACCEPT_REASON = 'CRITERION_MET';export const PERSON = 'person';diff --cc src/cli.jsindex 0fad24fb,fedacbbd..1c3ce34a--- a/src/cli.js+++ b/src/cli.js@@@ -16,12 -16,11 +16,12 @@@ import { displayAgentName } from './ageimport { doctrineHistory, loadDoctrine } from './doctrine.js';import { agentDoctrine, proposeDoctrine, resumeDoctrineNotes, staleDoctrineRows } from './doctrine-rulings.js';import { checkRulesAt, doctrineReport, hasSubmitRules, holdDoctrine, ruleLine } from './doctrine-checks.js';- import { agentSessionDigest, requirePersonChannel } from './person.js';- import { bindLocalSession, localSessionMatches } from './agent-session.js';+ import { AGENT_SESSION_IDS, agentSessionDigest, requirePersonChannel } from './person.js';+ import { bindLocalSession, localSessionMatches, localSessionSeats } from './agent-session.js';import { decisionAnswer, decisionProjection, handAnsweredQuestions, pendingAnswers, planRowApply, prepareRowDecisions, restoreRowApply, writeRowApply } from './row-decisions.js';import { digestOf, gateReport, refuseSandboxBlocked, runGate, runProfiledShell, runSubmitGate, submitGateReport, timingDigest, withGateSlot } from './gate.js';+import { gateWaitReporter } from './gate-wait.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,@@@ -2344,10 -2328,8 +2330,10 @@@ async function submitHere(ctx, id)submitInvariants: acceptedMain.config.submitInvariants,// The accepted project runner interprets its current invariant files; candidate config cannot replace it....(acceptedMain.config.submitInvariants.length ? { affectedTests: acceptedMain.config.affectedTests } : {}) };- const gate = await runSubmitGate(root, submitConfig, { base: claimHead, trunk: acceptedMain.commit, check: frozenCheck(held), agent: me.id, item: String(id), onWait: gateWaitReporter(ctx.io), onBrowserFallback: browserAdmissionReporter(ctx.io, ctx.io.relayJson) });+ const gate = await runSubmitGate(root, submitConfig, { base: claimHead, trunk: acceptedMain.commit, check: frozenCheck(held), agent: me.id, item: String(id), onWait: queuedItemLease(ctx, held, me.id, 'build'), onBrowserFallback: browserAdmissionReporter(ctx.io, ctx.io.relayJson) });- if (!gate.isGreen) {+ // Only the person's live waivers can pass a red proof, failure by failure; the item's own check is never waived [B3].+ const waived = !gate.isGreen && gate.check?.green ? withBoard(ctx, (board) => waivedFailures(board, accountedFailures(gate, root))) : null;+ if (!gate.isGreen && !waived) {const message = `the submission proof is red at ${commit.slice(0, 12)}; fix it, commit, submit again. ${submitGateReport(gate)}`;// No submission can follow this verdict. Read-only main comparisons must not retain the seat's write lease.CHECKOUT_LEASES.get(ctx.io)?.release();diff --cc src/gate.jsindex 59f282ed,39192b48..a9504b4d--- a/src/gate.js+++ b/src/gate.js@@@ -296,158 -171,14 +300,25 @@@ export function runShell(root, commandthrow new Refused('PIPEFAIL_UNAVAILABLE', 'the repo gate shell cannot enable pipefail; rewrite the gate without a pipe');}}+ const split = stages ? gateStages(command) : null;+ const marker = `PULLBOARD_STAGE_${randomUUID().replaceAll('-', '')}`;+ const pipes = split?.some((stage) => stage.pipeline.length > 1) ? mkdtempSync(join(tmpdir(), 'pullboard-pipes-')) : null;// Newlines, not spaces, around the command, so a trailing comment in it cannot swallow the `)`.- const result = spawnSync(`${prefix}(\n${command}\n) 2>&1`, options);+ const result = spawnSync(`${prefix}(\n${split ? stagedScript(split, marker, pipes) : command}\n) 2>&1`, options);invalidateGitFacts();- const output = `${result.stdout ?? ''}${result.stderr ?? ''}`;- return { isGreen: result.status === 0, output, seconds: Math.round((Date.now() - started) / 1000),- sandboxBlocked: result.status === 0 ? null : sandboxBlockedOperation(root, output) };+ const pipeStatuses = pipes ? readPipes(split, pipes) : null;+ if (pipes) rmSync(pipes, { recursive: true, force: true });+ const raw = `${result.stdout ?? ''}${result.stderr ?? ''}`;+ const seconds = Math.round((Date.now() - started) / 1000);+ const blocked = (output) => (result.status === 0 ? null : sandboxBlockedOperation(root, output));+ if (!stages) return { isGreen: result.status === 0, output: raw, seconds, sandboxBlocked: blocked(raw) };+ if (!split) return { isGreen: result.status === 0, output: raw, seconds, stages: null, sandboxBlocked: blocked(raw) };+ const staged = readStages(raw, marker, split.length);+ // Each pipeline component's own status rides on its stage, so no failing producer hides behind a later one.+ const withPipes = staged.stages.map((stage, index) => (pipeStatuses?.[index] ? { ...stage, pipeline: pipeStatuses[index] } : stage));+ return { isGreen: result.status === 0, seconds, ...staged, stages: withPipes, sandboxBlocked: blocked(staged.output) };}- /** Resolve existing path prefixes so a symlink cannot hide an outside-worktree operation. */- function diagnosticPath(path) {- let current = resolve(path);- const missing = [];- for (;;) {- try { return resolve(realpathSync(current), ...missing); }- catch (error) {- if (!['ENOENT', 'ENOTDIR'].includes(error.code)) return null;- const parent = dirname(current);- if (parent === current) return null;- missing.unshift(relative(parent, current));- current = parent;- }- }- }-- /** Describe one OS permission message, resolving file targets against the command's worktree. */- function permissionOperation(root, message, { includeFilePaths = true } = {}) {- const network = /^(listen|bind) (EPERM|EACCES)\b/u.exec(message);- if (network) return { code: network[2], syscall: network[1], operation: `${network[1]} (${network[2]})` };- if (!includeFilePaths) return null;- const file = /^(EPERM|EACCES): [^\n]*?, (open|mkdir|read|write|rename|unlink|scandir|access) (['"])([^\n]+?)\3(?= -> |$)/u.exec(message);- const python = /^PermissionError: \[Errno (?:1|13)\] [^\n]*?: ['"]([^'"\n]+)['"]/u.exec(message);- if (!file && !python) return null;- const path = diagnosticPath(resolve(root, file ? file[4] : python[1]));- const tree = diagnosticPath(root);- if (!path || !tree) return null;- const within = relative(tree, path);- if (within !== '..' && !within.startsWith('../') && !isAbsolute(within)) return null;- const code = file ? file[1] : 'EACCES';- return { code, path, syscall: file ? file[2] : null,- operation: `${file ? file[2] : 'file access'} ${JSON.stringify(path)} (${code})` };- }-- /** Decode the single-line quoted YAML scalars emitted by Node's TAP reporter. */- function tapScalar(value) {- if (value.startsWith('"')) {- try { return JSON.parse(value); } catch { return null; }- }- if (value.startsWith("'") && value.endsWith("'")) return value.slice(1, -1).replace(/''/gu, "'");- return /^[A-Z_]+$/u.test(value) ? value : null;- }-- /** Scan complete lines with bounded TAP state so assertion messages cannot impersonate OS codes. */- export function sandboxBlockedScanner(root, { includeFilePaths = true } = {}) {- let failureIndent = null;- let fieldIndent = null;- let permission = null;- let code = null;- let comment = null;- let startup = null;- let failureMessage = null;- let failureType = false;- let exitCode = null;- /** Retain one pending fatal diagnostic and the current failed TAP record. */- return (raw) => {- const line = raw.trim().replace(/^#\s*/u, '');- const indent = raw.length - raw.trimStart().length;- // Node's TAP reporter prints test-console output as comments and assertion details- // as indented YAML. Neither is a standalone gate diagnostic, even when it contains- // text that looks exactly like an operating-system denial.- if (indent === 0 && !raw.startsWith('#') && /^(?:Error: |PermissionError: )/u.test(line)) {- const direct = permissionOperation(root, line.replace(/^Error: /u, ''), { includeFilePaths });- if (direct) return direct.operation;- }- if (/^TAP version \d+$/u.test(raw)) {- comment = null; startup = null;- failureIndent = null; fieldIndent = null; permission = null; code = null;- failureMessage = null; failureType = false; exitCode = null;- }- // Uncaught module-load errors are comments too. Keep their complete Node fatal- // diagnostic pending; it is evidence only if the following file record failed- // to start. A test logging a caught error and then asserting is not that record.- if (indent === 0 && raw.startsWith('#')) {- if (line.startsWith('Error: ')) {- const operation = permissionOperation(root, line.slice('Error: '.length), { includeFilePaths });- comment = operation ? { operation, code: null, syscall: null, path: null, closed: false, fatal: false } : null;- } else if (comment) {- const field = /^(code|syscall|path): (.*)$/u.exec(line);- if (field) comment[field[1]] = tapScalar(field[2].replace(/,$/u, ''));- else if (line === '}') comment.closed = true;- else if (/^Node\.js v\d+\./u.test(line)) comment.fatal = true;- else if (line && !/^at |^errno: |^address: |^port: /u.test(line)- && !(comment.closed && comment.fatal && line.startsWith('Subtest: '))) comment = null;- }- }- if (/^(?:not )?ok \d+\b/u.test(line)) {- failureIndent = /^not ok /u.test(line) ? indent : null;- const operation = comment?.operation;- startup = failureIndent !== null && comment?.closed && comment.fatal- && comment.code === operation.code && comment.syscall === operation.syscall- && (!operation.path || (typeof comment.path === 'string'- && diagnosticPath(resolve(root, comment.path)) === operation.path)) ? operation : null;- comment = null;- fieldIndent = null; permission = null; code = null;- failureMessage = null; failureType = false; exitCode = null;- } else if (line === '---' && failureIndent !== null && indent === failureIndent + 2) {- fieldIndent = indent;- } else if (line === '...' && indent === fieldIndent) {- failureIndent = null; fieldIndent = null; permission = null; code = null;- startup = null; comment = null;- failureMessage = null; failureType = false; exitCode = null;- } else if (fieldIndent !== null && indent === fieldIndent) {- const field = /^(error|code|failureType|exitCode): (.*)$/u.exec(line);- if (field) {- const value = tapScalar(field[2]);- if (field[1] === 'error') {- failureMessage = value;- permission = typeof value === 'string' ? permissionOperation(root, value, { includeFilePaths }) : null;- } else if (field[1] === 'code') {- code = value;- if (code !== 'ERR_TEST_FAILURE') startup = null;- } else if (field[1] === 'failureType') failureType = value === 'testCodeFailure' || field[2] === 'testCodeFailure';- else exitCode = /^[1-9]\d*$/u.test(field[2]) && Number.isSafeInteger(Number(field[2])) ? Number(field[2]) : null;- if (permission && permission.code === code) return permission.operation;- if (startup && code === 'ERR_TEST_FAILURE' && failureMessage === 'test failed'- && failureType && exitCode !== null) return startup.operation;- }- }- return null;- };- }-- /** Recognize concrete OS permission diagnostics, keeping ordinary assertion failures ordinary. */- export function sandboxBlockedOperation(root, output, options) {- const scan = sandboxBlockedScanner(root, options);- for (const line of output.split('\n')) {- const operation = scan(line);- if (operation) return operation;- }- return null;- }-/** Refuse an environment-blocked proof after its ordinary raw logs and timings are persisted. */export function refuseSandboxBlocked(run) {if (run.sandboxBlocked) throw new Refused('SANDBOX_BLOCKED',