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 accepted main into landing host work
Corey Olson9a29a0988586
diff --cc docs/formats.mdindex fe910ea1,853c31b5..25ebaa5b--- a/docs/formats.md+++ b/docs/formats.md@@@ -111,9 -111,9 +111,9 @@@ The board file is in the repository's G| --- | --- | --- | --- || `CLI JSON envelope` | `1` | `JSON_SHAPES.version` in `src/json.js` | Keep optional fields additive within version 1; bump the envelope version for incompatible command/export shapes. || `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. |- | `board schema` | `2` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | Create missing tables and indexes, add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. |+ | `board schema` | `3` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | On a write open of a board whose version is behind: create missing tables and indexes (version 3 adds the hot-path indexes), add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. Read opens never migrate; a board at the current version whose shape differs is reported once on stderr and left as it is. || `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |-| `move engine` | `74` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |+| `move engine` | `79` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |<!-- format-versions:end -->Relay transport capability `apiVersion: 2` is independent of these versions and@@@ -196,12 -196,8 +196,14 @@@ Engine 72 (`COORDINATOR_HOLD_ENGINE`) hEngine 73 (`PEOPLE_ENGINE`) names people and lets approvers alone act as the person. The relay stamps each stored record's sender with the GitHub login behind it, the engine the sender declared and, on a board that names approvers, `approver: true|false` for a person sender. Replaying a move made at engine 73 or later, every event it writes carries `person`, that login, beside `event_by`, the agent or seat. A move that carries out a recorded phone request carries the request sender's login instead, and a `relay_refused` event carries the login of the person who tried the move or request. `pullboard.json` may list `approvers`, GitHub logins, at most fifty; leaving it out keeps today's behaviour. On a board that names them, every replica refuses with `NOT_APPROVER` a person move (a row or sentinel decision, an answer, hold or fact as the person, a person request shout) or a phone request to answer, hold or decide rows whose sender is not an approver, and the relay refuses an unlink or snapshot replacement from anyone else. A record whose seal no key opens, from an engine no newer than the replica's, is set aside as `relay_refused` with code `RELAY_SEAL`, and replay goes on; one from a newer engine still asks for an upgrade.+ Engine 74 (`LANDING_LEASE_ENGINE`) gives a trunk one landing at a time (#417). The `landingLeaseMove` operation takes, renews and releases the board's landing lease, carrying the holder's token, branch, pid, generation and guardian. `recordLandingBatch` and `finishLandingBatch` may carry a `landingFence` that names the lease they write under; a write whose fence is not the current holder's is refused. A second `pullboard land` names the holder and queues. Older engines refuse `landingLeaseMove` and any fenced landing write, and a landing lease move never falls back to a local preview or a queued relay move: it needs an acknowledged order.++Engine 79 (`LANDING_ENVIRONMENT_ENGINE`) records the actual executor's exact `{platform, arch, node}` on new machine-run verdicts and gate receipts. An explicit `null` means unknown; historical receipts without the field keep their original canonical bytes and replay semantics. Landing batches retain their executor and flag accepted verdicts from a different or unknown environment. Earlier engines refuse moves carrying these fields before applying them.++An optional `landing.environment` in `pullboard.json` requires all three exact fields. The matching machine must also opt into this board with `pullboard settings landing.pool on`; `off` removes its opt-in. Machine settings store the board IDs in `landing.pools`. A constrained landing runs on that matching, opted-in coordinator host; generic SSH runners are not members of a board's landing pool. Omitting the policy retains normal runner selection. A mismatch is refused before creating or gating a batch.++Engine 79 also adds `recordLandingTestDefect`. A red batch whose bisection finds no item culprit records a neutral repair item and a `landing-test-defect` event with its test path, content hash, red-tree blob, original trunk blob, failure names, batch ID and trunk branch. Its batch remains `test-defect`, and further landings on that trunk stop before another gate runs. A committed correction to the test on the trunk, or live existing waivers covering every recorded failure, releases the hold. Candidate-only changes and uncommitted edits do not release it. A waiver keeps the red tree and its waived failures explicit. Existing culprit and flake diagnosis retain their meanings; older engines cannot revise or finish a batch carrying these fields.+The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 48 after issuing any agent token or machine credential, includingrevoked or expired ones; before engine 48 these minimums were 3 and 6. The minimum survives reopening the auth database;diff --cc src/board.jsindex cfe9f0b4,eba7f82f..9f9efa34--- a/src/board.js+++ b/src/board.js@@@ -13,7 -13,8 +13,9 @@@ importcheckedLandingCommit,} from './verdict-reviews.js';export { verdictReviewProblem, verdictsFor, acceptedVerdict, checkedLandingCommit };+export { landingTestDefects, recordLandingTestDefect } from './landing-test-defects.js';+ export { landingLeaseMove, landingLeaseState } from './landing-lease.js';+ import { guardLandingWrite } from './landing-lease.js';import {randomBytes,randomUUID,@@@ -2676,13 -2664,8 +2670,14 @@@ export { stats } from './board-stats.jsexport { landingBatches };/** Append one coordinator-owned batch revision without changing the board schema [B3,R3]. */- export function recordLandingBatch(board, { agentId, batch, revision = 0 }) {+ export function recordLandingBatch(board, { agentId, batch, revision = 0, landingFence }) {coordinatorOnly(agentId, 'records landing batches');++ if ((board.executionEngineVersion ?? ENGINE_VERSION) < LANDING_ENVIRONMENT_ENGINE && board.db.prepare("SELECT 1 FROM event WHERE event_kind = 'landing-test-defect' LIMIT 1").get()) throw new Refused('ENGINE_VERSION', `this trunk has test-defect holds requiring engine ${LANDING_ENVIRONMENT_ENGINE}`);+ if (carriesLandingEnvironment(batch) && (board.executionEngineVersion ?? ENGINE_VERSION) < LANDING_ENVIRONMENT_ENGINE) throw new Refused('ENGINE_VERSION', `landing environments and test defects require engine ${LANDING_ENVIRONMENT_ENGINE}`);+ if (batch?.environmentWarnings !== undefined && !Array.isArray(batch.environmentWarnings)) throw new Refused('LAND_BATCH', 'landing environment warnings are a list');+ const environments = [batch?.environment, ...(Array.isArray(batch?.gateResults) ? batch.gateResults : []).map(gate => gate?.environment),+ ...(batch?.environmentWarnings ?? []).flatMap(warning => [warning?.recorded, warning?.landing])];+ if (environments.some(environment => environment !== undefined && environment !== null && environmentProblem(environment))) throw new Refused('LAND_BATCH', 'a landing executor needs exact platform, arch and Node version');if (carriesFlakeDiagnostics(batch) && (board.executionEngineVersion ?? ENGINE_VERSION) < NATIVE_FLAKE_ENGINE) {throw new Refused('ENGINE_VERSION', `typed landing diagnostics require engine ${NATIVE_FLAKE_ENGINE}; upgrade Pullboard`);}@@@ -2694,9 -2677,8 +2689,10 @@@throw new Refused('LAND_BATCH', 'a landing batch needs its exact base, tip, items, state, owner and log path; run pullboard land');}return atomic(board, () => {+ guardLandingWrite(board, landingFence);const previous = landingBatches(board).find((entry) => entry.id === batch.id);+ if (carriesLandingEnvironment(previous) && (board.executionEngineVersion ?? ENGINE_VERSION) < LANDING_ENVIRONMENT_ENGINE) throw new Refused('ENGINE_VERSION', `this batch requires engine ${LANDING_ENVIRONMENT_ENGINE}`);+ if (previous && ['environment', 'testDefects'].some(key => Object.hasOwn(previous, key) && !Object.hasOwn(batch, key))) throw new Refused('LAND_BATCH', 'a landing revision keeps its recorded executor and test defects');preserveInvariantEvidence(previous, evidence, board.executionEngineVersion ?? ENGINE_VERSION);validateLandingRevision(previous, batch, revision);const recorded = { ...batch, revision: revision + 1, updatedAt: now(board) };@@@ -2768,12 -2750,12 +2764,14 @@@ export function waivedLandingProof(boar}/** Atomically record a pushed batch's first-containing merges and one main-moved receipt [B3,R3]. */- export function finishLandingBatch(board, { agentId, id, tip }) {+ export function finishLandingBatch(board, { agentId, id, tip, landingFence }) {coordinatorOnly(agentId, 'finishes a landing');++ if ((board.executionEngineVersion ?? ENGINE_VERSION) < LANDING_ENVIRONMENT_ENGINE && board.db.prepare("SELECT 1 FROM event WHERE event_kind = 'landing-test-defect' LIMIT 1").get()) throw new Refused('ENGINE_VERSION', `this trunk has test-defect holds requiring engine ${LANDING_ENVIRONMENT_ENGINE}`);return atomic(board, () => {+ guardLandingWrite(board, landingFence);const batch = landingBatches(board).find((entry) => entry.id === id);if (!batch || batch.tip !== tip) throw new Refused('LAND_BATCH', 'the pushed tip must match its recorded batch; run pullboard land --adopt');+ if (carriesLandingEnvironment(batch) && (board.executionEngineVersion ?? ENGINE_VERSION) < LANDING_ENVIRONMENT_ENGINE) throw new Refused('ENGINE_VERSION', `this batch requires engine ${LANDING_ENVIRONMENT_ENGINE}`);if (batch.state === 'landed') return batch;if (batch.state !== 'pushed' && !(batch.state === 'trunk' && (board.executionEngineVersion ?? ENGINE_VERSION) >= LOCAL_LANDING_ENGINE)) throw new Refused('LAND_NOT_PUSHED', 'record a successful push before landing receipts; run pullboard land --adopt');for (const entry of batch.items) {diff --cc src/engine.jsindex 69aaa9cf,eb8926ac..be957778--- a/src/engine.js+++ b/src/engine.js@@@ -66,8 -66,7 +66,9 @@@ import { LOCAL_LANDING_ENGINE } from '.import { REVIEW_SKIP_ENGINE } from './review-skip-engine.js';import { COORDINATOR_HOLD_ENGINE } from './coordinator-hold-engine.js';import { requireCoordinatorHold } from './coordinator-hold.js';+import { LANDING_ENVIRONMENT_ENGINE } from './landing-environment-engine.js';+import { carriesLandingEnvironment } from './execution-environment.js';+ import { LANDING_LEASE_ENGINE } from './landing-lease-engine.js';const ITEM_ID_FIRST_ARGUMENT = new Set(['acceptCheck', 'editItem', 'escalate', 'recordAttempt', 'claim', 'release', 'submit', 'reserveReview', 'verify', 'merged', 'withdraw', 'refreeze', 'reopen', 'appendFact']);@@@ -78,9 -77,9 +79,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',+ 'recordFlakeObservation', 'recordGateRun', 'declareJob', 'recordJobRun', 'takeCoordinator', 'landingLeaseMove',]);/** Engine version at which each ordered operation first has stable replay semantics. */@@@ -89,13 -88,7 +90,15 @@@ const OPERATION_ENGINE = Object.freeze(/** Dependency edits, causes, sealed reviews, submission proofs, trunk conflicts, health observations and milestone targets retain distinct recorded engine meanings. */function minimumOperationEngine(operation, args, board, at) {+ if (operation === 'recordLandingTestDefect' || operation === 'verify' && args[1]?.environment !== undefined+ || operation === 'recordGateRun' && Object.hasOwn(args[0]?.receipt ?? {}, 'environment')+ || operation === 'recordLandingBatch' && carriesLandingEnvironment(args[0]?.batch)) return LANDING_ENVIRONMENT_ENGINE;+ if (board && ['recordLandingBatch', 'finishLandingBatch'].includes(operation)) {++ if (store.landingTestDefects(board).length) return LANDING_ENVIRONMENT_ENGINE;+ const id = operation === 'recordLandingBatch' ? args[0]?.batch?.id : args[0]?.id;+ if (store.landingBatches(board).some(batch => batch.id === id && carriesLandingEnvironment(batch))) return LANDING_ENVIRONMENT_ENGINE;+ }+ if (operation === 'landingLeaseMove' || args[0]?.landingFence !== undefined) return LANDING_LEASE_ENGINE;if (['verify', 'reopen'].includes(operation) && args[1]?.reopenFirstRefusalMinutes !== undefined|| ['claim', 'release'].includes(operation) && board && firstRefusal(board, args[0], at)) return REOPEN_FIRST_REFUSAL_ENGINE;// A batch landed on the local trunk before it is published (#801).diff --cc src/gate.jsindex 67e76436,e37ab40c..2698e6ea--- a/src/gate.js+++ b/src/gate.js@@@ -374,9 -371,9 +376,10 @@@ export async function runProfiledShellAconst inherited = {...(gateLease ? gateSlotEnvironment(gateLease) : gateSlotHeld ? { [GATE_SLOT_HELD_ENV]: '1' } : {}),[LANDING_RUN_ENV]: landing ? '1' : '0',+ PULLBOARD_TEST_STAGE: gateLease?.receiptKind ?? (landing ? 'land' : 'gate'),};const env = { ...gitChildEnv(root), ...inherited };+ const environment = executionEnvironment();const child = spawn(`(\n${command}\n) 2>&1`, { cwd: root, env, shell: true, stdio: ['ignore', 'pipe', 'pipe'] });const chunks = [];let bytes = 0;diff --cc src/land.jsindex 1e7484f6,4acc5f12..a3286112--- a/src/land.js+++ b/src/land.js@@@ -41,10 -42,15 +42,17 @@@ import} from './gate-run-receipt.js';import { testsNeedBrowser } from './browser-admission.js';import { laneOf } from './lanes.js';+ import { takeResource } from './resources.js';+ import {+ landingLeaseState,+ requireConfirmedLanding,+ } from './landing-lease.js';+ import { runLandingWorker } from './landing-worker.js';import { Refused } from './refused.js';+import { requireLandingHost } from './landing-host.js';+import { environmentLabel, sameEnvironment } from './execution-environment.js';import { browserFreeChecksEnabled } from './settings.js';+ import { policyAt } from './trusted-policy.js';import { landingFileTimes } from './submit-invariants.js';import {flakeSource,@@@ -64,30 -70,6 +72,30 @@@ function testHash(root, file)catch { return null; }}+/** Read a committed test identity; an uncommitted edit cannot release a trunk hold. */+function testBlob(root, commit, file) {+ const result = tryGit(root, ['rev-parse', '--verify', `${commit}:${file}`]);+ return result.status === 0 ? result.stdout : null;+}++/** A test defect holds every batch on its trunk until the committed test changes or every failure is waived. */+function heldTestDefects(root, board, trunk) {+ return store.landingTestDefects(board).filter(defect => {+ if (defect.branch !== trunk.branch) return false;+ const blob = testBlob(root, trunk.commit, defect.test);- return !(blob && blob !== defect.trunkBlob) && !defect.names.every(name => store.landingWaiverFor(board, { file: defect.test, name }));++ return !(blob && blob !== defect.blob && blob !== defect.trunkBlob) && !defect.names.every(name => store.landingWaiverFor(board, { file: defect.test, name }));+ });+}++/** Keep each verdict's recorded executor distinct from the actual landing host. */+function environmentWarnings(board, items, environment) {+ return items.flatMap(entry => {+ const verdict = store.acceptedVerdict(board, store.getItem(board, entry.id));+ const recorded = verdict?.environment ?? null;+ return sameEnvironment(recorded, environment) ? [] : [{ item: entry.id, recorded, landing: environment }];+ });+}+/** Derive failing test identities from TAP or spec reporter names and source locations, refusing unknown paths. */export function landingFailures(output, root, { excludeCancelled = false } = {}) {const failures = [];@@@ -765,9 -819,9 +865,12 @@@ export async function runLandingBatch(trunk = mainCheckout(root);}if (!trunk?.commit) throw new Refused('LAND_TRUNK', 'landing needs the coordinator’s primary branch; return its checkout to the trunk');+ // Pin accepted policy after any recorded-landed repair, never before admission or from candidate files.+ config ??= policyAt(root, trunk.commit).config;+ board.quarantineEnabled = () => config.flakes?.quarantine === true;++ const environment = dryRun ? null : requireLandingHost(store.boardId(board), config);+ const testDefects = heldTestDefects(root, board, trunk);+ if (!dryRun && testDefects.length) throw new Refused('LAND_TEST_DEFECT', `this trunk is held by ${testDefects.map(defect => `#${defect.item} (${defect.test})`).join(', ')}; correct the committed test or ask an approver for an expiring waiver`);- const unfinished = store.landingBatches(board).findLast((batch) => batch.state !== 'landed' && batch.state !== 'blocked');const selected = candidates(board, root, trunk.commit, maximum);const stale = selected.blocked.find(item => item.code === 'STALE_VERDICT');if (!selected.ready.length && stale) throw staleVerdictRefusal({ item_id: stale.id }, stale);diff --cc src/landing-worker.jsindex 00000000,66a9c346..0a0ba68bmode 000000,100644..100644--- a/src/landing-worker.js+++ b/src/landing-worker.js@@@ -1,0 -1,260 +1,260 @@@+ /** Isolate blocking Git and gates so the coordinator keeps renewing and fencing its board lease [Q1,Q3]. */+ import {+ spawn,+ spawnSync,+ } from 'node:child_process';+ import { join } from 'node:path';+ import { fileURLToPath } from 'node:url';+ import * as store from './board.js';+ import {+ invalidateGitFacts,+ mainCheckout,+ repoInfo,+ } from './git.js';+ import { Refused } from './refused.js';+ import { parseProcessCensus } from './process-census.js';++ const FILE = fileURLToPath(import.meta.url);++ /** Preserve one typed refusal prefix while passing it through more than one process. */+ function messageText(error) { return String(error.message).replace(/^\[[A-Z][A-Z0-9_]*\] /u, ''); }++ /** Read process identities before attributing a live worker or its detached gate descendants. */+ function census() {+ try {+ const result = spawnSync('/bin/ps', ['-axo', 'pid=,ppid=,pgid=,lstart=,stat=,comm='], { encoding: 'utf8', env: { ...process.env, LC_ALL: 'C', TZ: 'UTC' } });+ if (result.status !== 0) return null;+ const rows = parseProcessCensus(result.stdout);+ rows?.delete(result.pid); // This already-exited observer is never a cleanup target.+ return rows;+ } catch { return null; }+ }++ /** Stop a currently owned group; a recorded worker identity permits cleanup after guardian death without trusting a reused PID. */+ function stop(child, member) {+ if (!child.pid) return;+ const rows = census();+ const root = rows?.get(child.pid);+ const known = member && rows?.get(member.pid);+ const ownsRoot = root && (child.pid === process.pid || root.ppid === process.pid && child.exitCode === null && child.signalCode === null);+ const ownsMember = known && known.pgid === child.pid && known.started === member.started && known.processSha256 === member.processSha256;+ if (!ownsRoot && !ownsMember) return;+ // Shards have separate groups; traverse actual descendant ancestry before stopping the known group.+ const owned = new Set([ownsRoot ? child.pid : member.pid]);+ let changed;+ do {+ changed = false;+ for (const row of rows.values()) if (owned.has(row.ppid) && !owned.has(row.pid)) { owned.add(row.pid); changed = true; }+ } while (changed);+ const current = census();+ if (!current) return; // Missing identity evidence never authorizes a process-group signal.+ // Stop producers first: killing a held gate must not wake its worker into post-gate Git work.+ for (const pid of owned) if (pid !== child.pid && !current.get(pid)?.state.startsWith('Z') && current.get(pid)?.started === rows.get(pid)?.started+ && current.get(pid)?.processSha256 === rows.get(pid)?.processSha256) {+ try { process.kill(pid, 'SIGKILL'); } catch (error) { if (error.code !== 'ESRCH') throw error; }+ }+ // Descendant signals can empty the group; its earlier census is no longer a signal target.+ const group = census();+ if (!group || !runningGroup(group, child.pid)) return;+ try { process.kill(-child.pid, 'SIGKILL'); }+ catch (error) {+ if (error.code === 'ESRCH') return;+ const after = error.code === 'EPERM' ? census() : null;+ if (after && !runningGroup(after, child.pid)) return; // macOS can report EPERM for an already-empty group.+ throw error; // A live group or unknown census never licenses suppressing a permission failure.+ }+ }++ /** Unknown states remain executing; only a known group without non-zombie members is drained. */+ function runningGroup(rows, pgid) { return [...rows.values()].some(row => row.pgid === pgid && !row.state.startsWith('Z')); }++ /** Run blocking batch work under a live parent that owns all canonical writes and lease renewal. */+ export async function runLandingWorker(options, { write, checkLease, checkLeaseNow, bindWorker, watchDeadline, onWait, say, signal }) {+ const child = spawn(process.execPath, [FILE, 'guardian'], { cwd: options.root, env: process.env, detached: true, stdio: ['ignore', 'ignore', 'pipe', 'ipc'] });+ const inFlight = new Set();+ let result;+ let failure;+ let stderr = '';+ let member;+ const unwatch = watchDeadline(until => { if (child.connected) child.send({ type: 'deadline', until }, () => {}); });+ child.stderr.setEncoding('utf8').on('data', part => { stderr = (stderr + part).slice(-65536); });+ /** A failed authority check stops the whole owned group before another command can adopt its worktree. */+ const abort = () => { failure ??= signal.reason; stop(child, member); };+ signal.addEventListener('abort', abort, { once: true });+ /** Reply only over this owned child's channel, preserving the original typed refusal. */+ const answer = (id, value, error) => {+ if (!child.connected) return;+ child.send({ type: 'answer', id, value, error: error ? { code: error.code ?? 'LAND_WORKER', message: messageText(error) } : null }, () => {});+ };+ child.on('message', message => {+ if (message.type === 'worker') {+ if (signal.aborted || failure) { stop(child, member); return; }+ try { checkLeaseNow(); }+ catch (error) { failure = error; stop(child, member); return; }+ const row = census()?.get(message.pid);+ if (!row || row.ppid !== child.pid || row.pgid !== child.pid) {+ failure = new Refused('LAND_WORKER', 'the landing worker identity could not be confirmed; inspect pullboard resume before adopting');+ stop(child);+ return;+ }+ member = row;+ child.send({ type: 'worker-start', options: { ...options, guardianPid: child.pid } }, () => {});+ return;+ }+ if (message.type === 'say') { say(message.text); return; }+ if (message.type === 'result') { result = message.value; return; }+ if (message.type === 'failure') { failure = new Refused(message.code, message.message); return; }+ if (message.type !== 'call') return;+ /** Permit only the batch worker's narrow protocol, retaining all authority in this parent. */+ const act = async () => {+ if (signal.aborted || failure) throw signal.reason ?? failure;+ if (message.operation === 'check') { await checkLease(); checkLeaseNow(); return null; }+ if (message.operation === 'wait') return await onWait?.(message.args[0]);- if (!['recordLandingBatch', 'finishLandingBatch', 'recordLandingFlake', 'recordFlakeObservation', 'recordGateRun', 'reopen', 'appendFact'].includes(message.operation)) {++ if (!['recordLandingBatch', 'finishLandingBatch', 'recordLandingFlake', 'recordLandingTestDefect', 'recordFlakeObservation', 'recordGateRun', 'reopen', 'appendFact'].includes(message.operation)) {+ throw new Refused('LAND_WORKER', 'the landing worker requested an unsupported operation; stop it and inspect pullboard resume');+ }+ return await write(message.operation, message.args);+ };+ const pending = act().then(value => answer(message.id, value), error => answer(message.id, null, error));+ inFlight.add(pending);+ void pending.finally(() => inFlight.delete(pending));+ });+ try {+ const terminal = new Promise(resolveClose => {+ child.once('error', error => { failure = error; });+ child.once('exit', (code, terminatedBy) => {+ if (code !== 0 || terminatedBy || result === undefined) {+ failure ??= new Refused('LAND_WORKER', 'the landing guardian stopped unexpectedly; inspect pullboard resume before adopting');+ stop(child, member);+ }+ });+ child.once('close', (code, terminatedBy) => resolveClose({ code, signal: terminatedBy }));+ });+ await new Promise((resolveSpawn, reject) => { child.once('spawn', resolveSpawn); child.once('error', reject); });+ await bindWorker(child.pid);+ if (signal.aborted) abort();+ else child.send({ type: 'start', options });+ const status = await terminal;+ if (failure) throw failure;+ if (status.code !== 0 || result === undefined) throw new Refused('LAND_WORKER', `the landing worker stopped without a completed batch (${status.signal ?? status.code}); inspect pullboard resume before adopting${stderr ? `: ${stderr.trim()}` : ''}`);+ return result;+ } finally {+ signal.removeEventListener('abort', abort);+ unwatch();+ if (child.exitCode === null && child.signalCode === null) stop(child, member);+ await Promise.allSettled(inFlight);+ }+ }++ /** Make one checked request to the live parent without giving the worker independent board-write authority. */+ function channel(group) {+ let next = 0;+ let finished = false;+ const waiting = new Map();+ process.on('message', message => {+ if (message.type !== 'answer') return;+ const pair = waiting.get(message.id);+ if (!pair) return;+ waiting.delete(message.id);+ if (message.error) pair.reject(new Refused(message.error.code, message.error.message));+ else pair.resolve(message.value);+ });+ process.once('disconnect', () => { if (!finished) { try { process.kill(-group, 'SIGKILL'); } catch { process.exit(1); } } });+ const call = (operation, args = []) => new Promise((resolve, reject) => {+ const id = ++next;+ waiting.set(id, { resolve, reject });+ process.send({ type: 'call', id, operation, args });+ });+ return { call, finish(message) { finished = true; process.send(message, () => process.disconnect()); } };+ }++ /** Enter batch execution only through the parent's private process channel. */+ async function workerMain(options) {+ const pipe = channel(options.guardianPid);+ const { call } = pipe;+ const board = store.openBoard(join(repoInfo(options.root).commonDir, 'pullboard', 'board.sqlite'));+ try {+ const { runLandingBatch } = await import('./land.js');+ /** Canonical catch-up may have moved proof or trunk while the request was in flight. */+ const checkLease = async () => { await call('check'); invalidateGitFacts(); assertWorkerFence(board, options.fence, options.root); };+ const result = await runLandingBatch({ ...options, board, write: (operation, args) => call(operation, args),+ say: text => process.send({ type: 'say', text }), onWait: state => call('wait', [state]), checkLease,+ checkLeaseNow: () => assertWorkerFence(board, options.fence, options.root) });+ pipe.finish({ type: 'result', value: result });+ } catch (error) {+ process.exitCode = 1;+ pipe.finish({ type: 'failure', code: error.code ?? 'LAND_WORKER', message: messageText(error) });+ } finally { store.closeBoard(board); }+ }++ /** Check the shared native board immediately before a physical Git action, with no intervening await. */+ function assertWorkerFence(board, fence, root) {+ // This imported live binding is used only after module initialization, keeping board cycles inert.+ const holder = assertLandingLease(board, fence);+ invalidateGitFacts();+ if (mainCheckout(root)?.branch !== fence.branch) throw new Refused('LAND_LEASE_LOST', 'the trunk branch changed; start a fresh land command for its current branch');+ return holder;+ }+ import { assertLandingLease } from './landing-lease.js';++ /** A nonblocking guardian survives CLI death and stops its own whole group, even while the worker is synchronous. */+ function guardianMain() {+ let worker;+ let finished = false;+ let closed = false;+ let pending = 0;+ let deadline = 0;+ let expiring = false;+ /** Fail closed independently of a suspended CLI, using only its last acknowledged authority deadline. */+ const expire = () => {+ if (finished || expiring) return;+ expiring = true;+ if (process.connected) process.send({ type: 'failure', code: 'LAND_LEASE_LOST', message: 'the guardian stopped its owned worker before the acknowledged landing lease expired' }, () => stop({ pid: process.pid }));+ else stop({ pid: process.pid });+ };+ const watchdog = setInterval(() => { if (deadline && Date.now() >= deadline - 1500) expire(); }, 100);+ /** Flush result and refusal messages before ending this private channel normally. */+ const finish = () => {+ if (!closed || pending) return;+ finished = true;+ clearInterval(watchdog);+ if (process.connected) process.disconnect();+ };+ process.on('message', message => {+ if (message.type === 'deadline') {+ if (Number.isFinite(message.until)) deadline = message.until;+ return;+ }+ if (message.type === 'start' && !worker) {+ // The worker stays in this guardian's detached group; its gates inherit that group too.+ // Worker observations must not leave an optional status-refresh index lock when interrupted.+ worker = spawn(process.execPath, [FILE, 'worker'], { cwd: message.options.root, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' },+ stdio: ['ignore', 'ignore', 'inherit', 'ipc'] });+ worker.on('message', value => {+ if (!process.connected) return;+ pending += 1;+ process.send(value, () => { pending -= 1; finish(); });+ });+ worker.once('error', error => {+ if (process.connected) process.send({ type: 'failure', code: 'LAND_WORKER', message: error.message });+ });+ worker.once('close', (code, signal) => {+ closed = true;+ process.exitCode = code ?? (signal ? 1 : 0);+ finish();+ });+ worker.once('spawn', () => process.send({ type: 'worker', pid: worker.pid }));+ } else if (message.type === 'worker-start' && worker?.connected) {+ if (!deadline || Date.now() >= deadline - 1500) { expire(); return; }+ worker.send({ type: 'start', options: message.options });+ } else if (worker?.connected) worker.send(message, () => {});+ });+ process.once('disconnect', () => { if (!finished) stop({ pid: process.pid }); });+ }++ if (process.argv[1] === FILE && process.send) {+ if (process.argv[2] === 'guardian') guardianMain();+ else if (process.argv[2] === 'worker') process.once('message', message => {+ if (message.type === 'start') void workerMain(message.options);+ });+ }diff --cc src/relay-outbox.jsindex 2c8a8655,187d7d6b..96eccee0--- a/src/relay-outbox.js+++ b/src/relay-outbox.js@@@ -161,9 -161,9 +161,9 @@@ export const ITEM_SLOTS = Object.freezeregister: [], 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: [],+ recordFlakeObservation: [], recordGateRun: [], 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.jsindex 8af44175,bdca0eab..867b2784--- 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'].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 (['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/runner-worker.jsindex ff64a328,be89c2fc..e6459545--- a/src/runner-worker.js+++ b/src/runner-worker.js@@@ -206,7 -198,7 +199,7 @@@ async function readSpec()tagNames.add(tag.name);if (tag.chain.length ? tag.chain[0] !== tag.object : tag.object !== tag.peeledCommit) throw new Error('invalid tag manifest');}- const runtimeNames = ['resources.js', 'git.js', 'machine-home.js', 'refused.js', 'process-census.js', 'queue-settings.js', 'queue-order.js', 'sandbox-denial.js', 'gate-stages.js', 'child-journal-preload.js', 'execution-environment.js'];- const runtimeNames = ['runner-custody.js', 'resources.js', 'git.js', 'machine-home.js', 'refused.js', 'process-census.js', 'queue-settings.js', 'queue-order.js', 'sandbox-denial.js', 'gate-stages.js', 'child-journal-preload.js'];++ const runtimeNames = ['runner-custody.js', 'resources.js', 'git.js', 'machine-home.js', 'refused.js', 'process-census.js', 'queue-settings.js', 'queue-order.js', 'sandbox-denial.js', 'gate-stages.js', 'child-journal-preload.js', 'execution-environment.js'];if (Object.keys(value.runtime.files).length !== runtimeNames.length|| runtimeNames.some(name => typeof value.runtime.files[name] !== 'string')) throw new Error('invalid work specification');if (createHash('sha256').update(JSON.stringify(value.runtime.files)).digest('hex') !== value.runtime.sha256) throw new Error('invalid trusted runtime');diff --cc src/runners.jsindex 1df9ef0c,3936fa28..de7af454--- a/src/runners.js+++ b/src/runners.js@@@ -68,7 -67,7 +68,7 @@@ const MAX_BLOB_BYTES = 8 * 1024 ** 2const MAX_HISTORY_TAGS = 1_024;const MAX_TAG_CHAIN = 8;const TOOL_ROOT = fileURLToPath(new URL('../', import.meta.url));- const RUNTIME_NAMES = ['resources.js', 'git.js', 'machine-home.js', 'refused.js', 'process-census.js', 'queue-settings.js', 'queue-order.js', 'sandbox-denial.js', 'gate-stages.js', 'child-journal-preload.js', 'execution-environment.js'];-const RUNTIME_NAMES = ['runner-custody.js', 'resources.js', 'git.js', 'machine-home.js', 'refused.js', 'process-census.js', 'queue-settings.js', 'queue-order.js', 'sandbox-denial.js', 'gate-stages.js', 'child-journal-preload.js'];++const RUNTIME_NAMES = ['runner-custody.js', 'resources.js', 'git.js', 'machine-home.js', 'refused.js', 'process-census.js', 'queue-settings.js', 'queue-order.js', 'sandbox-denial.js', 'gate-stages.js', 'child-journal-preload.js', 'execution-environment.js'];/** Validate an SSH destination as one argument, never a command or an SSH option. */export function validateRunner(value) {diff --cc test/team.test.jsindex f0a98c71,7ecf3246..0db4973e--- a/test/team.test.js+++ b/test/team.test.js@@@ -24,17 -24,30 +24,35 @@@ import { decodeBoardKey, seal } from '.import { ENGINE_VERSION as PEOPLE_VERSION } from '../src/machine.js';import { relayWorkBudgetMs } from './relay-budget.js';import { hostname } from 'node:os';+import { assertMatchingLandingHost, assertNoCulpritTrunkHold } from './landing-environment-fixture.js';+ import { landingQueueCase } from './landing-queue-fixture.js';const CLI = join(import.meta.dirname, '..', 'bin', 'pullboard.js');const helpers = createE2eHelpers();after(helpers.cleanup);+test('land runs on a matching host [E27,E28,E29]', { timeout: 180_000 }, () => { // budget: hang ceiling for real Git/CLI host checks, bisection and waiver controls; no speed target.+ assertMatchingLandingHost(helpers);+ assertNoCulpritTrunkHold(helpers);+});+ test('a trunk lands one batch at a time [B3,R3,Q1,Q2,E8]', { timeout: 120_000 }, // budget: hang ceiling for real private Git, CLI checks, both gate barriers and cleanup; no speed target.+ async t => landingQueueCase(t, helpers));++ test('a queued landing uses admitted policy and repairs before pinning it [Q1,B3]', { timeout: 120_000 }, // budget: two real CLI landings and bounded recorded-tip repair, not a speed threshold.+ async t => landingQueueCase(t, helpers, { policyAfterFirst: true }));++ test('a queued landing rechecks freshness after its holder moves main [E8,Q1,Q2]', { timeout: 120_000 }, // budget: real private Git/CLI and deterministic gate barrier; no speed target.+ async t => landingQueueCase(t, helpers, { staleAfterFirst: true }));++ test('an abandoned landing drains its blocked gate before adoption [Q1,Q3,B3]', { timeout: 120_000 }, // budget: private CLI death, owned-process cleanup, interrupted-batch adoption and Git; no speed target.+ async t => landingQueueCase(t, helpers, { killParent: true }));++ test('a dead landing guardian cannot leave its blocked worker running [Q1,Q3,B3]', { timeout: 120_000 }, // budget: private guardian death, identity-bound cleanup and explicit adoption; no speed target.+ async t => landingQueueCase(t, helpers, { killGuardian: true }));++ test('a suspended landing owner is fenced before the queued adopter runs [Q1,Q3]', { timeout: 120_000 }, // budget: real 30s authority expiry, independent guardian watchdog, cleanup and adoption; no speed target.+ async t => landingQueueCase(t, helpers, { suspendParent: true }));/** Open a fixture's independent board and always close it after its observation or public move. */function withBoard(root, action) {