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
feat(land): person waivers also cover submit and landing gates [B3,R3]
Corey Olson222552fbf4d8
diff --git a/src/cli.js b/src/cli.jsindex 44095191..2535f665 100644--- a/src/cli.js+++ b/src/cli.js@@ -84,7 +84,7 @@ import { readRelayMachine } from './relay-machine.js';import { relayJoin, relayPair } from './relay-pairing-client.js';import { executePersonRequests } from './relay-request-execution.js';import { engineReceipt } from './engine.js';-import { land } from './land.js';+import { land, landingFailures, waivedFailures, waiverLine } from './land.js';const CHECKOUT_LEASES = new WeakMap();const CHECKOUT_BOARD_ONLY = new WeakMap();@@ -2111,7 +2111,9 @@ async function submitHere(ctx, id) {// Every submit proves its frozen check and reachable tests anew on this exact commit (V4,V16).// A full-gate stamp never substitutes for either proof; only an actual full fallback may stamp.const gate = await runSubmitGate(root, ctx.config, { base: claimHead, trunk: acceptedMain.commit, check: frozenCheck(held), agent: me.id, item: String(id), onWait: gateWaitReporter(ctx.io) });- 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, landingFailures(gate.output ?? '', 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();@@ -2128,12 +2130,19 @@ async function submitHere(ctx, id) {);}const currentTrunk = requireTrunkMerge(root, commit); // The trunk may have moved while the gate ran.+ const waivedLines = waived ? waived.map(waiverLine) : [];await withBoard(ctx, async (board) => {refuseUnverifiedStack(root, board, store.getItem(board, id), commit, currentTrunk);+ // The waived run is written to the item's thread before the submission, so no waived proof reads as green.+ if (waived) await ordered(ctx, board, 'appendFact', [id, { agentId: me.id, kind: 'measurement', text: `submission proof at ${commit.slice(0, 12)} was red and is recorded as waived, not green; every failure is covered by a live person waiver:\n${waivedLines.join('\n')}` }]);return await ordered(ctx, board, 'submit', [id, { agentId: me.id, commit, tree: headTree(root) ?? '', files: filesSince(root, id, claimHead, commit), policyCommit: acceptedMain.commit }]);});- return reportSubmission(ctx, id, commit, { green: gate.isGreen, report: submitGateReport(gate), files: gate.files, full: gate.full, reason: gate.reason, check: gate.check,- log: gate.log, profile: gate.profile, profilePath: gate.profilePath, proofLog: gate.proofLog, proofProfilePath: gate.proofProfilePath });+ const report = waived+ ? `submission proof waived, not green: ${waived.length} failure(s), each covered by a live person waiver; the whole output is in ${gate.log}\n${waivedLines.join('\n')}`+ : submitGateReport(gate);+ return reportSubmission(ctx, id, commit, { green: gate.isGreen, report, files: gate.files, full: gate.full, reason: gate.reason, check: gate.check,+ log: gate.log, profile: gate.profile, profilePath: gate.profilePath, proofLog: gate.proofLog, proofProfilePath: gate.proofProfilePath,+ ...(waived ? { waived: waived.map(({ file, name, waiver }) => ({ file, name, waiver: waiver.id, reason: waiver.reason, until: waiver.until })) } : {}) });}/** Report and pin the original submitted commit, including a recovered acknowledged outcome. */@@ -3350,6 +3359,15 @@ async function runCommand(argv, io) {throw error;}const gate = await runGate(ctx.info.root, config, { landing: values.landing, agent: resourceAgent(ctx), onWait: gateWaitReporter(io) });+ // A landing gate honours the person's live waivers exactly as land does; a red run never stamps, so it stays waived, not green [B3,R3].+ const waived = values.landing && !gate.isGreen ? withBoard(ctx, (board) => waivedFailures(board, landingFailures(gate.output ?? '', ctx.info.root))) : null;+ if (waived) {+ const lines = waived.map(waiverLine);+ const report = `landing gate waived, not green: ${waived.length} failure(s), each covered by a live person waiver; the whole output is in ${gate.log}\n${lines.join('\n')}`;+ io.result?.({ green: false, waived: waived.map(({ file, name, waiver }) => ({ file, name, waiver: waiver.id, reason: waiver.reason, until: waiver.until })), report });+ io.say(report);+ return 0;+ }io.result?.({ green: gate.isGreen, report: gateReport(gate) });io.say(gateReport(gate));return gate.isGreen ? 0 : 1;diff --git a/src/land.js b/src/land.jsindex 03816629..42750a84 100644--- a/src/land.js+++ b/src/land.js@@ -155,11 +155,26 @@ async function diagnose(state, failures) {return flakes;}+/**+ * Pair every named failure of a red run with the live person waiver covering it, or return null.+ * One unnamed, unfiled or unwaived failure voids the whole run, so a waiver never hides another red [B3,R3].+ */+export function waivedFailures(board, failures) {+ if (!failures.length || failures.some((entry) => !entry.file)) return null;+ const covered = failures.map((failure) => ({ ...failure, waiver: store.landingWaiverFor(board, failure) }));+ return covered.every((entry) => entry.waiver) ? covered : null;+}++/** Name one waived failure with the person's waiver, its reason and its expiry [B3]. */+export function waiverLine(failure) {+ const { waiver } = failure;+ return `waived: ${failure.name} (${failure.file}) by person waiver ${waiver.id} for ${waiver.test}: ${waiver.reason}; expires ${waiver.until}`;+}+/** Record every failure's exact live waiver rather than changing which tests the gate runs. */function waivedProof(state, gate) {- if (!gate.failures.length || gate.failures.some((entry) => !entry.file)) return null;- const failures = gate.failures.map((failure) => ({ ...failure, waiver: store.landingWaiverFor(state.board, failure)?.id }));- return failures.every((entry) => entry.waiver) ? { tree: gate.tree, failures, logPath: gate.logPath } : null;+ const failures = waivedFailures(state.board, gate.failures);+ return failures ? { tree: gate.tree, failures: failures.map((entry) => ({ ...entry, waiver: entry.waiver.id })), logPath: gate.logPath } : null;}/** Bisect a reproducible red without retrying any previously tested group. */diff --git a/test/land.test.js b/test/land.test.jsindex 6ebbbdb4..cab32ea9 100644--- a/test/land.test.js+++ b/test/land.test.js@@ -661,6 +661,69 @@ test('land stops again with an expired waiver, and a changed test on main releasassert.deepEqual(calls(box).slice(start), [[]], 'corrected test is gated afresh');});+test("a person's waiver lets a submit and a landing gate through only the waived test [B3,R3,C7]", () => {+ const box = landProject();+ const past = { now: () => new Date('2000-01-01T00:00:00Z') };+ const stampOf = (cwd) => {+ const stamp = join(cwd, box.git(cwd, 'rev-parse', '--git-path', 'pullboard-gate-green'));+ return existsSync(stamp) ? readFileSync(stamp, 'utf8').trim() : null;+ };+ const waived = itemWorktree(box, 1);+ assert.equal(commitFile(box, waived.path, waived.file, 'RED\n', `feat(web): build land fixture ${waived.item} [G1]`).status, 0);+ const unwaived = box.run(waived.path, 'submit', String(waived.item), '--json');+ assert.equal(JSON.parse(unwaived.out).error?.code, 'GATE_RED', 'an unwaived failure refuses the submission');+ onBoard(box, (board) => {+ store.recordLandingWaiver(board, { agentId: 'person', channel: 'terminal', id: 'expired-submit', test: FILES[0], until: '2000-01-02', reason: 'expired submit fixture' });+ store.recordLandingWaiver(board, { agentId: 'person', channel: 'terminal', id: 'expired-landing', test: FILES[1], until: '2000-01-02', reason: 'expired landing fixture' });+ }, past);+ const expired = box.run(waived.path, 'submit', String(waived.item), '--json');+ assert.equal(JSON.parse(expired.out).error?.code, 'GATE_RED', 'an expired waiver covers nothing');+ assert.equal(JSON.parse(box.run(waived.path, 'land', '--waive', FILES[0], '--until', '2099-01-01', '--reason', 'agent attempt', '--json').out).error?.code, 'COORDINATOR_ONLY', 'an agent seat cannot waive');+ box.env.CLAUDECODE = '1';+ assert.equal(JSON.parse(box.run(box.repo, 'land', '--waive', FILES[0], '--until', '2099-01-01', '--reason', 'agent shell attempt', '--json').out).error?.code, 'B26_PERSON_CHANNEL', 'an agent shell in the main checkout cannot waive');+ delete box.env.CLAUDECODE;+ onBoard(box, (board) => {+ const attempt = { channel: 'terminal', id: 'agent-attempt', test: FILES[0], until: '2099-01-01', reason: 'agent attempt' };+ assert.throws(() => store.recordLandingWaiver(board, { ...attempt, agentId: 'coordinator' }), /LAND_PERSON_ONLY/u);+ assert.throws(() => store.recordLandingWaiver(board, { ...attempt, agentId: 'web-1' }), /LAND_PERSON_ONLY/u);+ assert.throws(() => store.recordLandingWaiver(board, { ...attempt, agentId: 'person', channel: 'api' }), /B26_PERSON_CHANNEL/u);+ assert.equal(store.landingWaiverFor(board, { file: FILES[0], name: FILES[0] }), null, 'no attempt recorded a live waiver');+ });+ const waiver = json(box, box.repo, 'land', '--waive', FILES[0], '--until', '2099-01-01', '--reason', 'private flaky fixture tracked elsewhere').waiver;+ const line = new RegExp(`waived: .*\\(${FILES[0].replaceAll('.', '\\.')}\\) by person waiver ${waiver.id} for ${FILES[0].replaceAll('.', '\\.')}: private flaky fixture tracked elsewhere; expires 2099-01-01T00:00:00\\.000Z`, 'u');++ const mixed = itemWorktree(box, 2);+ assert.equal(commitFile(box, mixed.path, FILES[0], 'RED\n', `feat(web): build land fixture ${mixed.item} [G1]`).status, 0);+ assert.equal(commitFile(box, mixed.path, mixed.file, 'RED\n', `feat(web): build land fixture ${mixed.item} again [G1]`).status, 0);+ const partial = box.run(mixed.path, 'submit', String(mixed.item), '--json');+ assert.equal(JSON.parse(partial.out).error?.code, 'GATE_RED', 'a waiver for one test never passes another failure');+ assert.equal(json(box, box.repo, 'show', String(mixed.item)).item_status, 'claimed');++ const submitted = box.run(waived.path, 'submit', String(waived.item));+ assert.equal(submitted.code, 0, `${submitted.err}\n${submitted.out}`);+ assert.match(submitted.out, line, 'the submission names the waiver, its reason and its expiry');+ assert.match(submitted.out, /waived, not green/u);+ assert.equal(json(box, box.repo, 'show', String(waived.item)).item_status, 'submitted');+ const facts = events(box).filter((event) => event.event_kind === 'fact' && event.item_id === waived.item).map((event) => JSON.parse(event.event_detail).text);+ assert.ok(facts.some((text) => /recorded as waived, not green/u.test(text) && line.test(text)), 'the waived submission is recorded on the item');+ assert.notEqual(stampOf(waived.path), box.git(waived.path, 'rev-parse', 'HEAD^{tree}'), 'a waived submission writes no green stamp');++ assert.equal(commitFile(box, box.repo, FILES[0], 'RED\n', 'chore: install a flaky fixture test').status, 0);+ const landing = box.run(box.repo, 'gate', '--landing');+ assert.equal(landing.code, 0, `${landing.err}\n${landing.out}`);+ assert.match(landing.out, line, 'the landing gate names the waiver, its reason and its expiry');+ assert.match(landing.out, /landing gate waived, not green/u);+ const landingJson = json(box, box.repo, 'gate', '--landing');+ assert.equal(landingJson.green, false, 'a waived landing gate is never reported green');+ assert.deepEqual(landingJson.waived.map((entry) => [entry.file, entry.waiver]), [[FILES[0], waiver.id]]);+ assert.notEqual(stampOf(box.repo), box.git(box.repo, 'rev-parse', 'HEAD^{tree}'), 'a waived landing gate writes no green stamp');+ assert.equal(commitFile(box, box.repo, FILES[1], 'RED\n', 'chore: install a second failing fixture test').status, 0);+ const refused = box.run(box.repo, 'gate', '--landing');+ assert.equal(refused.code, 1, 'a failure with only an expired waiver refuses the landing gate');+ assert.match(refused.out, /gate red/u);+ assert.doesNotMatch(refused.out, /waived, not green/u);+});+test('land adoption recovers an interrupted gate and keeps one receipt under a new coordinator [B3,R3]', async (t) => {const box = landProject();const entries = verifiedFour(box);