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.

Merge commit '28a0c59ebc0f83153bd789161592c9ca17772f28' into core/215

Corey Olson2ad33e0dc9aa
diff --cc src/engine.js
index 51e133df,be957778..61cb0a07
--- a/src/engine.js
+++ b/src/engine.js
@@@ -79,9 -79,9 +81,9 @@@ export const ENGINE_OPERATIONS = Object
'withdraw', 'refreeze', 'reopen', 'shout', 'passDecision', 'answerDecision', 'holdLane', 'releaseLane', 'holdItem', 'releaseItemHold',
'addMilestone', 'editMilestoneItems', 'orderMilestoneItems', 'moveMilestone', 'editMilestone', 'removeMilestone', 'shipMilestone',
'recordRowDecisions', 'applyRowDecisions', 'draftSpecRow', 'appendFact', 'recordSpecApprovalBaseline',
- 'recordLandingBatch', 'recordLandingWaiver', 'recordLandingFlake', 'finishLandingBatch', 'acceptCheck',
+ 'recordLandingBatch', 'recordLandingWaiver', 'recordLandingFlake', 'recordLandingTestDefect', 'finishLandingBatch', 'acceptCheck',
'recordHealthFindings', 'proposeSentinel', 'decideSentinel', 'beginSentinelRun', 'finishSentinelRun',
- 'recordFlakeObservation', 'recordGateRun', 'declareJob', 'recordJobRun', 'takeCoordinator', 'landingLeaseMove',
+ 'recordFlakeObservation', 'recordGateRun', 'recordProofRun', 'declareJob', 'recordJobRun', 'takeCoordinator', 'landingLeaseMove',
]);
/** Engine version at which each ordered operation first has stable replay semantics. */
diff --cc src/gate-run-receipt.js
index 4f2d8fe9,a0485d8e..b42dbaba
--- a/src/gate-run-receipt.js
+++ b/src/gate-run-receipt.js
@@@ -11,7 -11,7 +11,8 @@@ import
join,
} from 'node:path';
import { tryGit } from './git.js';
+import { proofFields } from './proof-provenance.js';
+ import { environmentProblem } from './execution-environment.js';
/** The folder beside the board that holds gate run receipts. */
export const RECEIPT_FOLDER = 'gate-receipts';
@@@ -64,13 -64,9 +65,14 @@@ export function receiptFields(value)
/** The checks behind receiptFields; each malformed field throws, and receiptFields turns that into null. */
function checkedFields(value) {
const bad = () => new TypeError('malformed gate receipt');
+ if (Object.hasOwn(value ?? {}, 'environment') && value.environment !== null && environmentProblem(value.environment)) throw bad();
- if (!value || value.version !== 1 || !ID.test(value.id ?? '') || !['gate', 'land', 'submit'].includes(value.kind) || !SHA.test(value.tree ?? '')
- || !SHA.test(value.head ?? '') || value.main !== null && !SHA.test(value.main ?? '') || !DIGEST.test(value.command ?? '')
+ const proof = value?.version === 2 ? proofFields(value.proof) : null;
+ const version = value?.version;
+ const kinds = version === 2 ? ['check', 'submit', 'verdict'] : ['gate', 'land', 'submit'];
+ if (!value || ![1, 2].includes(version) || version === 2 && !proof || !ID.test(value.id ?? '') || !kinds.includes(value.kind)
+ || !(version === 2 && value.tree === null) && !SHA.test(value.tree ?? '')
+ || !(version === 2 && value.head === null) && !SHA.test(value.head ?? '')
+ || value.main !== null && !SHA.test(value.main ?? '') || !DIGEST.test(value.command ?? '')
|| typeof value.green !== 'boolean' || !Array.isArray(value.failures) || value.failures.length > MOST_FAILURES
|| value.green && value.failures.length > 0 || !line(value.at, 40) || !Number.isFinite(Date.parse(value.at))) throw bad();
const failures = value.failures.map((entry) => {
@@@ -79,11 -75,11 +81,11 @@@
return { file, name };
});
const load = value.load;
- if (!load || !Array.isArray(load.average) || load.average.length !== 3 || load.average.some((number) => !Number.isFinite(number) || number < 0)
- || !Number.isSafeInteger(load.cpus) || load.cpus < 1 || !Number.isSafeInteger(load.freeMB) || load.freeMB < 0) throw bad();
- return { version: 1, id: value.id, kind: value.kind, tree: value.tree, head: value.head, main: value.main, command: value.command,
- green: value.green, failures, load: { average: [...load.average], cpus: load.cpus, freeMB: load.freeMB }, at: value.at,
- ...(Object.hasOwn(value, 'environment') ? { environment: value.environment } : {}) };
+ if (!(version === 2 && load === null) && (!load || !Array.isArray(load.average) || load.average.length !== 3 || load.average.some((number) => !Number.isFinite(number) || number < 0)
+ || !Number.isSafeInteger(load.cpus) || load.cpus < 1 || !Number.isSafeInteger(load.freeMB) || load.freeMB < 0)) throw bad();
+ return { version, id: value.id, kind: value.kind, tree: value.tree, head: value.head, main: value.main, command: value.command,
+ green: value.green, failures, load: load === null ? null : { average: [...load.average], cpus: load.cpus, freeMB: load.freeMB }, at: value.at,
- ...(proof ? { proof } : {}) };
++ ...(proof ? { proof } : {}), ...(Object.hasOwn(value, 'environment') ? { environment: value.environment } : {}) };
}
/**
diff --cc src/gate.js
index 4ad27ad1,1665d6d2..add340f8
--- a/src/gate.js
+++ b/src/gate.js
@@@ -303,12 -302,12 +309,12 @@@ export function runShell(root, command
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, exitCode: result.status, output: raw, seconds, ...(timed ? { timedOut: result.timedOut } : {}), sandboxBlocked: blocked(raw) };
- if (!split) return { isGreen: result.status === 0, exitCode: result.status, output: raw, seconds, stages: null, ...(timed ? { timedOut: result.timedOut } : {}), sandboxBlocked: blocked(raw) };
- if (!stages) return { isGreen: result.status === 0, output: raw, seconds, environment, ...(timed ? { timedOut: result.timedOut } : {}), sandboxBlocked: blocked(raw) };
- if (!split) return { isGreen: result.status === 0, output: raw, seconds, environment, ...(timed ? { timedOut: result.timedOut } : {}), stages: null, sandboxBlocked: blocked(raw) };
++ if (!stages) return { isGreen: result.status === 0, exitCode: result.status, output: raw, seconds, environment, ...(timed ? { timedOut: result.timedOut } : {}), sandboxBlocked: blocked(raw) };
++ if (!split) return { isGreen: result.status === 0, exitCode: result.status, output: raw, seconds, environment, stages: null, ...(timed ? { timedOut: result.timedOut } : {}), 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, exitCode: result.status, seconds, ...(timed ? { timedOut: result.timedOut } : {}), ...staged, stages: withPipes, sandboxBlocked: blocked(staged.output) };
- return { isGreen: result.status === 0, seconds, environment, ...(timed ? { timedOut: result.timedOut } : {}), ...staged, stages: withPipes, sandboxBlocked: blocked(staged.output) };
++ return { isGreen: result.status === 0, exitCode: result.status, seconds, environment, ...(timed ? { timedOut: result.timedOut } : {}), ...staged, stages: withPipes, sandboxBlocked: blocked(staged.output) };
}
/** Refuse an environment-blocked proof after its ordinary raw logs and timings are persisted. */
@@@ -754,8 -706,7 +771,8 @@@ function fullGateRun(root, config, trus
const receiptId = run.sandboxBlocked ? null : leaveRunReceipt(root, config, run, { before, kind });
refuseSandboxBlocked(run);
if (isGreen && before !== null && committedTree(root) === before) writeFileSync(gitPath(root, STAMP), `${before}\n`);
- return { isGreen, isCached: false, output, seconds, log, profile, profilePath, receiptId,
- return { isGreen, isCached: false, output, seconds, log, profile, profilePath, receiptId, ...(run.timedOut ? { timedOut: true } : {}), environment: run.environment ?? null, ...(run.executionRoot ? { executionRoot: run.executionRoot } : {}),
++ return { isGreen, isCached: false, output, seconds, log, profile, profilePath, receiptId, environment: run.environment ?? null,
+ ...(run.proofReceiptId ? { proofReceiptId: run.proofReceiptId } : {}), ...(run.timedOut ? { timedOut: true } : {}), ...(run.executionRoot ? { executionRoot: run.executionRoot } : {}),
// A remote run's host load and pinned main reach the flake diagnostics with it (#925).
...(run.executionRunner ? { executionRunner: run.executionRunner, executionMain: run.executionMain ?? null, executionLoad: run.executionLoad ?? null } : {}), ...(stages ? { stages: run.stages } : {}) };
}
diff --cc src/machine.js
index b65e35bf,2aaa53de..fd38f2fa
--- a/src/machine.js
+++ b/src/machine.js
@@@ -234,8 -233,8 +234,8 @@@ export const MOVES =
},
{
verb: 'accept', from: ['submitted', 'verified'], to: 'verified', by: ['agent', 'coordinator'], refuse: 'NOT_SUBMITTED',
- guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'atSubmittedCommit', 'notMerged', 'verdictReviewRecorded', 'reviewTreeCurrent', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree', 'criterionUnchanged', 'reasonIsMet', 'trunkMergeClean', 'noUnverifiedStack', 'queuedItemLease', 'itemCheckGreen', 'proofNoted'],
+ guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'atSubmittedCommit', 'notMerged', 'verdictReviewRecorded', 'reviewTreeCurrent', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree', 'criterionUnchanged', 'reasonIsMet', 'trunkMergeClean', 'noUnverifiedStack', 'queuedItemLease', 'itemCheckGreen', 'proofRecorded', 'proofNoted'],
- alsoRefuses: [{ code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 20 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],
+ alsoRefuses: [{ code: 'VERDICT_ENVIRONMENT', rule: 'optional recorded verdict environment contains exact platform, architecture and Node version', next: 'run the frozen check with current Pullboard, then have an independent reviewer record a fresh verdict with its actual executor environment' }, { code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 20 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],
sets: ['item_verified_by'], command: 'pullboard verify <id> accept --note "..."',
},
{
diff --cc src/private-check-worker.js
index 84aad995,7c32feeb..03b2f982
--- a/src/private-check-worker.js
+++ b/src/private-check-worker.js
@@@ -62,7 -63,8 +63,7 @@@ child.once('close', (status, signal) =
sent = true;
const marker = bytes > LIMIT ? '\n[output capped at 8 MiB; middle omitted]\n' : '';
const output = head.toString('utf8') + marker + tail.toString('utf8');
- process.stdout.write(JSON.stringify({ status, signal, executed: Boolean(child.pid), error: timedOut ? { code: 'ETIMEDOUT' } : error, logError, output }));
- process.stdout.write(JSON.stringify({ status, signal, error: timedOut ? { code: 'ETIMEDOUT' } : error, logError, output,
- environment: executionEnvironment() }));
++ process.stdout.write(JSON.stringify({ status, signal, executed: Boolean(child.pid), error: timedOut ? { code: 'ETIMEDOUT' } : error, logError, output, environment: executionEnvironment() }));
};
log.once('close', finish);
if (log.closed) finish();
diff --cc src/relay-outbox.js
index 63f5ff23,96eccee0..c96be80d
--- a/src/relay-outbox.js
+++ b/src/relay-outbox.js
@@@ -161,9 -161,9 +161,9 @@@ export const ITEM_SLOTS = Object.freeze
register: [], ensureCoordinator: [], shout: [], passDecision: [], holdLane: [], releaseLane: [],
moveMilestone: [], editMilestone: [], removeMilestone: [], shipMilestone: [],
recordRowDecisions: [], applyRowDecisions: [], draftSpecRow: [], recordSpecApprovalBaseline: [],
- recordLandingBatch: [], recordLandingWaiver: [], recordLandingFlake: [], finishLandingBatch: [],
+ recordLandingBatch: [], recordLandingWaiver: [], recordLandingFlake: [], recordLandingTestDefect: [], finishLandingBatch: [],
recordHealthFindings: [], decideSentinel: [], beginSentinelRun: [], finishSentinelRun: [],
- recordFlakeObservation: [], recordGateRun: [], declareJob: [], recordJobRun: [], takeCoordinator: [], landingLeaseMove: [],
+ recordFlakeObservation: [], recordGateRun: [], recordProofRun: [[0, 'itemId']], declareJob: [], recordJobRun: [], takeCoordinator: [], landingLeaseMove: [],
...Object.fromEntries(FIRST_ITEM.map((operation) => [operation, [[0]]])),
addItem: [[0, 'parentId'], [0, 'after', '*']],
editItem: [[0], [1, 'after', '*']],
diff --cc src/relay-sender.js
index 3cbd4cc5,867b2784..407eb4d1
--- a/src/relay-sender.js
+++ b/src/relay-sender.js
@@@ -10,10 -10,10 +10,10 @@@ export function relayMoveActor(move)
if (move.operation === 'addItem') return args[0]?.by ?? null;
if (move.operation === 'shout') return args[0]?.from ?? null;
if (['proposeSentinel', 'decideSentinel', 'beginSentinelRun', 'finishSentinelRun'].includes(move.operation)) return args[0]?.agentId ?? null;
- if (['recordHealthFindings', 'recordFlakeObservation', 'recordGateRun', 'declareJob', 'recordJobRun', 'takeCoordinator', 'landingLeaseMove'].includes(move.operation)) return args[0]?.agentId ?? null;
+ if (['recordHealthFindings', 'recordFlakeObservation', 'recordGateRun', 'recordProofRun', 'declareJob', 'recordJobRun', 'takeCoordinator', 'landingLeaseMove'].includes(move.operation)) return args[0]?.agentId ?? null;
if (['holdLane', 'releaseLane'].includes(move.operation) && args[1]?.asPerson) return 'person';
if (move.operation === 'release') return args[1] ?? null;
- if (['reserveNextReview', 'addMilestone', 'recordRowDecisions', 'applyRowDecisions', 'draftSpecRow', 'recordSpecApprovalBaseline', 'recordLandingBatch', 'recordLandingWaiver', 'recordLandingFlake', 'finishLandingBatch'].includes(move.operation)) return args[0]?.agentId ?? null;
+ if (['reserveNextReview', 'addMilestone', 'recordRowDecisions', 'applyRowDecisions', 'draftSpecRow', 'recordSpecApprovalBaseline', 'recordLandingBatch', 'recordLandingWaiver', 'recordLandingFlake', 'recordLandingTestDefect', 'finishLandingBatch'].includes(move.operation)) return args[0]?.agentId ?? null;
if (['acceptCheck', 'completeCheckBaseline', 'appendFact', 'editItem', 'escalate', 'recordAttempt', 'claim', 'submit', 'reserveReview', 'verify', 'merged', 'withdraw', 'refreeze',
'passDecision', 'answerDecision', 'holdLane', 'releaseLane', 'holdItem', 'releaseItemHold', 'reopen', 'editMilestoneItems', 'orderMilestoneItems', 'moveMilestone', 'editMilestone', 'removeMilestone', 'shipMilestone'].includes(move.operation)) return args[1]?.agentId ?? null;
return null;
diff --cc src/trusted-policy.js
index 000c3001,0492106e..5fb6099c
--- a/src/trusted-policy.js
+++ b/src/trusted-policy.js
@@@ -223,9 -221,9 +225,9 @@@ export function checkAtCommit(root, ite
const finish = (state, stage) => {
const runner = timingRunner(command);
const events = checkLogPath && existsSync(checkLogPath) ? timingFromLog(checkLogPath, runner) : timingFromOutput(checkOutput, runner);
- timingProfile = { ...events, wallMs: Math.max(0, Date.now() - checkStartedAt) };
+ timingProfile = { ...events, wallMs: Math.max(0, Date.now() - checkStartedAt), environment };
return checkResult(state, stage, installOutput, checkOutput, { root, item, commandRoot: copy, installLogPath, checkLogPath, timingProfile, waitMs,
- executed, exitCode, proofCounts: privateCheckCounts(checkLogPath, checkOutput), executionSourceUnchanged: checkedSourceReady && privateSourceUnchanged(copy, item.item_commit, env) });
- environment, executionSourceUnchanged: checkedSourceReady && privateSourceUnchanged(copy, item.item_commit, env) });
++ environment, executed, exitCode, proofCounts: privateCheckCounts(checkLogPath, checkOutput), executionSourceUnchanged: checkedSourceReady && privateSourceUnchanged(copy, item.item_commit, env) });
};
try {
const common = policyGit(root, ['rev-parse', '--path-format=absolute', '--git-common-dir']).trim();
@@@ -270,8 -268,7 +272,9 @@@
if (remaining <= 0) return finish('unverified', 'check timed out');
checkLogPath = join(scratch, 'check.log');
const run = runPrivateCommand(copy, env, command, remaining, checkLogPath);
+ executed = run.executed === true;
+ exitCode = run.status ?? null;
+ environment = environmentProblem(run.environment) ? null : run.environment;
checkOutput = run.output;
if (run.error?.code === 'ETIMEDOUT') return finish('unverified', 'check timed out');
if (run.error) return finish('unverified', `check could not start (${run.error.code})`);
@@@ -435,7 -426,7 +438,7 @@@ function privateSourceUnchanged(root, c
}
/** Persist a sanitized full diagnostic outside the temporary checkout so a refusal can name it. */
- function checkResult(state, stage, installCapture, checkCapture, { root = '', item = {}, commandRoot = root, installLogPath = '', checkLogPath = '', timingProfile = null, waitMs = 0, executed = false, exitCode = null, proofCounts = null, executionSourceUnchanged } = {}) {
-function checkResult(state, stage, installCapture, checkCapture, { root = '', item = {}, commandRoot = root, installLogPath = '', checkLogPath = '', timingProfile = null, waitMs = 0, environment = null, executionSourceUnchanged } = {}) {
++function checkResult(state, stage, installCapture, checkCapture, { root = '', item = {}, commandRoot = root, installLogPath = '', checkLogPath = '', timingProfile = null, waitMs = 0, environment = null, executed = false, exitCode = null, proofCounts = null, executionSourceUnchanged } = {}) {
const boundedInstall = secretScanned(installCapture, 'check install capture');
const boundedCheck = secretScanned(checkCapture, 'frozen check capture');
const install = digestOf(boundedInstall) || '(no output)';
@@@ -511,6 -502,6 +514,6 @@@
: /could not start/u.test(stage) ? "couldn't start" : state === 'unverified' ? 'could not be verified' : 'passed';
const output = `install output:\n${boundedInstall || '(no output)'}\ncheck output:\n${boundedCheck || '(not run or no output)'}`;
return { sandboxBlocked, state, green: state === 'pass', checked: true, stage, failure, report, output, outputTail, outputPath, outputError, profilePath,
- executionRoot: commandRoot, executed, exitCode, proofCounts, ...(executionSourceUnchanged === undefined ? {} : { executionSourceUnchanged }),
- executionRoot: commandRoot, environment, ...(executionSourceUnchanged === undefined ? {} : { executionSourceUnchanged }),
++ executionRoot: commandRoot, environment, executed, exitCode, proofCounts, ...(executionSourceUnchanged === undefined ? {} : { executionSourceUnchanged }),
profile: timingProfile ? { ...timingProfile, profilePath } : null };
}