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
fix(gate): place declared CPU-load tests only on registered runners [C7]
Corey Olsonb99b498cf920
diff --git a/bin/run-tests.js b/bin/run-tests.jsindex 8cdf8341..1da7b1f0 100644--- a/bin/run-tests.js+++ b/bin/run-tests.js@@ -1320,6 +1320,8 @@ async function main(args) {return;}const gui = testsNeedGui(process.cwd(), guiFiles);+ const { cpuRunnerRequired } = await import('../src/cpu-load-admission.js');+ const runnerOnly = cpuRunnerRequired(process.cwd(), guiFiles);let signal = null;/** Keep sandbox lifetime inside the held lease, including the complete child process. */const shardLabel = process.env[LANDING_SHARD_ENV];@@ -1373,7 +1375,7 @@ async function main(args) {}if (scopedMarker) {const inherited = inheritedGateSlot({ root: process.cwd(), browser, namedFiles: shortEligible });- if (inherited) await run(gateSlotEnvironment(inherited));+ if (inherited && (!runnerOnly || inherited.runnerExecution)) await run(gateSlotEnvironment(inherited));else await acquire();} else if (legacyHeld) {throw new Error('this legacy gate marker does not identify a live machine gate lease; restart the parent runner with a scoped gate lease');@@ -1389,6 +1391,7 @@ async function main(args) {let announced = false;const runnerPath = relative(process.cwd(), runner);const canShipRunner = runnerPath && runnerPath !== '..' && !runnerPath.startsWith(`..${sep}`);+ if (runnerOnly && !canShipRunner) throw new Error('CPU-load tests require a committed runner inside the checkout; no local fallback is allowed while runners are registered');await withGateSlot(process.cwd(), async (lease) => {if (!lease.runner) return run(gateSlotEnvironment(lease));const { runOnRunner } = await import('../src/runners.js');@@ -1401,7 +1404,7 @@ async function main(args) {process.exitCode = result.exitCode;}, {browser, gui, kind: fullSuite ? 'gate' : 'focused', shortEligible,- remote: Boolean(canShipRunner),+ remote: Boolean(canShipRunner), runnerOnly,onWait: ({ holders, runnerUnavailable }) => {if (runnerUnavailable) {process.stderr.write(`runner ${runnerUnavailable.host} unavailable: ${runnerUnavailable.reason}; until ${runnerUnavailable.until}; requeueing the run\n`);diff --git a/docs/api.md b/docs/api.mdindex 34edf335..c3ef8bb8 100644--- a/docs/api.md+++ b/docs/api.md@@ -673,3 +673,5 @@ When `publish.pullRequest` is enabled, `pullboard publish` reconciles the GitHubA board-recorded item merge covers its introduced commits only when its exact submitted commit has that receipt and is an ancestor of the recorded merge. `Pullboard-Companion: #N` is covered only on a board-recorded trunk containing item N's landing. Unreceipted commits, including release bumps and synthetic publication commits, remain unverified. An outside PR is allowed and initially reads `not verified`; the JSON result's `verification[].intake` names the existing `pullboard intake` command that files it for review. Outside intake can cover only its exact accepted head, never its earlier commits by inference.The JSON result includes `verification` entries with PR number, exact head, state, assurance, receipt identities, and any unverified commit IDs. GitHub statuses are shared by PRs with the same head: if an outside or unproven PR shares a commit with a proven proposal, the shared status stays red rather than lending the proposal's green status to it. Publishing observes and posts statuses; it never merges a PR or requires outside authors to use Pullboard.++A Node test that intentionally generates CPU load declares `{ cpuLoad: true }` in its test options. `bin/run-tests.js` discovers declarations without running the module and places the selected files on a registered runner, even with local-first admission or an inherited coordinator lease. While runners are registered it waits for a compatible runner instead of using local or short capacity; browser and GUI requirements still apply. A runner failure never permits this load to fall back locally. With no runners registered it uses the ordinary local admission and prints the reason. Source must be clean and committed for remote execution. Discovery conservatively places the whole selected file, including when a name filter selects only some cases; comments and string examples do not declare load.diff --git a/docs/formats.md b/docs/formats.mdindex aa186f46..5ed3e2ea 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -672,3 +672,5 @@ not a native move, parent identity, configuration or authority record. Missing/dreplays activity. Reads freeze an event high-water mark before observing Git; subsequent eventsand messages remain pending. News has a separate cursor so an ordinary poll cannot consume afuture session-start digest.++The machine resource database adds `waiter.runner_only` and `holder.runner_execution`, both integer booleans defaulting to zero. A runner-only gate ticket cannot consume local or short capacity while a runner is registered. The trusted SSH worker sets `runner_execution` on its own actual private gate holder; inherited admission reads that holder rather than accepting an environment-only claim of remote execution. These are local, additive scheduling metadata, not board move or relay formats.diff --git a/src/cpu-load-admission.js b/src/cpu-load-admission.jsnew file mode 100644index 00000000..e542c0dd--- /dev/null+++ b/src/cpu-load-admission.js@@ -0,0 +1,18 @@+/** CPU-load declarations are source metadata; discovery never executes test code [C7]. */+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';+import { loadMachineSettings } from './settings.js';+import { cpuLoadOptionsIn } from './module-imports.js';++/** A selected file with a declared CPU-load option must be placed before any test body starts. */+export function testsNeedCpuRunner(root, files) {+ return cpuLoadOptionsIn(files.map(file => readFileSync(resolve(root, file), 'utf8'))).some(Boolean);+}++/** Report the explicit no-runner fallback while keeping registered CPU work off the coordinator. */+export function cpuRunnerRequired(root, files) {+ const declared = testsNeedCpuRunner(root, files);+ const registered = (loadMachineSettings().runners ?? []).length > 0;+ if (declared && !registered) process.stderr.write('CPU-load test uses the current admitted slot because no runners are registered\n');+ return declared && registered;+}diff --git a/src/gate.js b/src/gate.jsindex dcfb9be3..b7b9247d 100644--- a/src/gate.js+++ b/src/gate.js@@ -363,13 +363,13 @@ function runTiming(run, command) {* 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, gui?: boolean, remote?: boolean, timing?: boolean, agent?: string, item?: string|number, kind?: string, onWait?: (state: object) => void, onReceipt?: (receipt: object) => void, readMemory?: typeof readMachineMemory }} [options] - Queue class, short-slot eligibility, remote eligibility, progress reporter, the run's receipt once its slot is released (#836) and, for tests, the machine memory reader.+ * @param {{ landing?: boolean, itemCheck?: boolean, shortEligible?: boolean, diagnostic?: boolean, browser?: boolean, gui?: boolean, remote?: boolean, runnerOnly?: boolean, timing?: boolean, agent?: string, item?: string|number, kind?: string, onWait?: (state: object) => void, onReceipt?: (receipt: object) => void, readMemory?: typeof readMachineMemory }} [options] - Queue class, short-slot eligibility, remote eligibility, progress reporter, the run's receipt once its slot is released (#836) and, for tests, the machine memory reader.* @returns {Promise<any>} The action's result after releasing its lease.*/export async function withGateSlot(root, action, options = {}) {try { return await withOneGateSlot(root, action, options); }catch (error) {- if (!['RUNNER_BROWSER_SLOT_REQUIRED', 'RUNNER_GUI_SESSION_REQUIRED'].includes(error?.code) || options.remote === false) throw error;+ if (!['RUNNER_BROWSER_SLOT_REQUIRED', 'RUNNER_GUI_SESSION_REQUIRED'].includes(error?.code) || options.remote === false || options.runnerOnly) throw error;// The runner's red attempt stays on record beside the local rerun.const attempt = error.runnerAttempt ?? { host: '', exitCode: null, output: '' };const required = error.code === 'RUNNER_GUI_SESSION_REQUIRED' ? 'a GUI session' : 'a browser slot';@@ -387,7 +387,7 @@ export async function withLandingGateSlot(root, action, options = {}) {}/** One gate admission and its action; withGateSlot may call it again for a local rerun. */-async function withOneGateSlot(root, action, { landing = false, itemCheck = false, shortEligible = false, diagnostic = false, browser = false, gui = false, remote = true, timing = false, agent, item = '', kind = '', onWait, onReceipt, readMemory = readMachineMemory } = {}) {+async function withOneGateSlot(root, action, { landing = false, itemCheck = false, shortEligible = false, diagnostic = false, browser = false, gui = false, remote = true, runnerOnly = false, timing = false, agent, item = '', kind = '', onWait, onReceipt, readMemory = readMachineMemory } = {}) {const tracker = startReceipt();const receiptKind = kind || (landing ? 'landing' : 'gate');/** Hand the run its receipt tracker and slot, then record its receipt once the slot is released (#836). */@@ -401,7 +401,7 @@ async function withOneGateSlot(root, action, { landing = false, itemCheck = falsonReceipt?.(receipt);};const inherited = inheritedGateSlot({ root, browser, namedFiles: shortEligible, timing });- if (inherited) {+ if (inherited && (!runnerOnly || inherited.runnerExecution)) {timed(Object.assign(inherited, { inherited: true })).tracker.mark('actionAt');try { return await action(inherited); }finally {@@ -413,6 +413,7 @@ async function withOneGateSlot(root, action, { landing = false, itemCheck = falsconst floorMB = memoryFloorMB();const capacityProvider = () => settingsProvider().gateSlots;const source = runnerSource(root);+ if (runnerOnly && (!remote || !source)) throw new Refused('RUNNER_SOURCE', 'CPU-load tests need a clean committed checkout for runner execution; commit the source and retry, with no local fallback');// Read the board once before queueing, never inside the machine admission transaction.const releaseContext = gateQueueSettings().currentReleaseFirst? (await import('./release-queue.js')).captureReleaseQueue(root, item) : undefined;@@ -438,6 +439,7 @@ async function withOneGateSlot(root, action, { landing = false, itemCheck = falstiming,allowIdleCapacityUpdate: true,remote: remote && Boolean(source),+ runnerOnly,runnerProvider: () => loadMachineSettings().runners ?? [],runnersFirstProvider: gateRunnersFirstEnabled,releaseContext,@@ -457,8 +459,8 @@ async function withOneGateSlot(root, action, { landing = false, itemCheck = falsif (!(error instanceof RunnerDropped || cleanup) || !lease.runner || !lease.requeueRunner) throw error;const runnerUnavailable = { host: lease.runner.host, reason: cleanup ? error.message : 'transport lost before a complete result', until: 'the host is checked and re-registered' };if (onWait) await onWait({ holders: [], line: [], position: 0, runnerUnavailable });- else process.stderr.write(`runner ${runnerUnavailable.host} unavailable: ${runnerUnavailable.reason}; until ${runnerUnavailable.until}; ${cleanup ? 'rerunning it locally' : 'requeueing the run'}\n`);- lease = await lease.requeueRunner(cleanup ? 'cleanup-unverified' : 'transport-lost', { local: cleanup });+ else process.stderr.write(`runner ${runnerUnavailable.host} unavailable: ${runnerUnavailable.reason}; until ${runnerUnavailable.until}; ${cleanup && !runnerOnly ? 'rerunning it locally' : 'requeueing the run'}\n`);+ lease = await lease.requeueRunner(cleanup ? 'cleanup-unverified' : 'transport-lost', { local: cleanup && !runnerOnly });}}} finally {diff --git a/src/module-imports.js b/src/module-imports.jsindex 2d6f24db..445bf028 100644--- a/src/module-imports.js+++ b/src/module-imports.js@@ -156,3 +156,23 @@ export function commonJsIn(sources) {return found;});}++/** Find CPU-load option properties in code without evaluating a test module. Unknown values require runner admission. */+export function cpuLoadOptionsIn(sources) {+ const occurrences = sources.map(source => [...source.matchAll(/(?:\bcpuLoad\b|["']cpuLoad["'])\s*:/gu), ...source.matchAll(UNICODE_ESCAPE)]);+ const variants = sources.flatMap((source, index) => occurrences[index].map(match => {+ const at = match.index + match[0].length;+ return source.slice(0, at) + '\u0000' + source.slice(at);+ }));+ const parsed = look([...sources, ...variants]);+ let next = sources.length;+ return sources.map((source, index) => {+ let found = !parsed[index].compiles;+ for (const match of occurrences[index]) {+ const value = pastGap(source, match.index + match[0].length);+ if (!parsed[next].compiles && !/^false\b/u.test(value)) found = true;+ next += 1;+ }+ return found;+ });+}diff --git a/src/resources.js b/src/resources.jsindex cf10982e..de6cf6ed 100644--- a/src/resources.js+++ b/src/resources.js@@ -131,6 +131,8 @@ function openQueue(file) {CREATE INDEX IF NOT EXISTS waiter_name_ticket ON waiter(name, ticket);`);for (const table of ['holder', 'waiter']) {const columns = db.prepare(`PRAGMA table_info(${table})`).all().map(({ name }) => name);+ if (table === 'waiter' && !columns.includes('runner_only')) db.exec('ALTER TABLE waiter ADD COLUMN runner_only INTEGER NOT NULL DEFAULT 0');+ if (table === 'holder' && !columns.includes('runner_execution')) db.exec('ALTER TABLE holder ADD COLUMN runner_execution INTEGER NOT NULL DEFAULT 0');if (!columns.includes('timing_aware')) db.exec(`ALTER TABLE ${table} ADD COLUMN timing_aware INTEGER NOT NULL DEFAULT 0`);if (!columns.includes('timing')) db.exec(`ALTER TABLE ${table} ADD COLUMN timing INTEGER NOT NULL DEFAULT 0`);if (!columns.includes('started')) db.exec(`ALTER TABLE ${table} ADD COLUMN started TEXT NOT NULL DEFAULT ''`);@@ -345,19 +347,19 @@ function queueOrder(scope) {/** Read the complete resource line with the metadata every admission view orders identically. */function queuedWaiters(db, name) {- return db.prepare('SELECT ticket, pid, agent, repo, since, landing, item_check AS itemCheck, diagnostic, browser, gui, remote, item, kind, lease_until AS leaseUntil, classed, release_aware, board_key, release_rank, queue_ticket, short_eligible AS shortEligible, timing FROM waiter WHERE name = ?').all(name);+ return db.prepare('SELECT ticket, pid, agent, repo, since, landing, item_check AS itemCheck, diagnostic, browser, gui, remote, runner_only AS runnerOnly, item, kind, lease_until AS leaseUntil, classed, release_aware, board_key, release_rank, queue_ticket, short_eligible AS shortEligible, timing FROM waiter WHERE name = ?').all(name);}/** Current holders and the waiting line in admission order, each waiter naming its class (aged only while class order is on). */function snapshot(db, name, order = ARRIVAL_ORDER, now = Date.now()) {/** Preserve older public entries while naming diagnostics as a distinct queue class. */- const project = ({ diagnostic, browser, gui, remote, runner, item, kind, leaseUntil, shortSlot, shortEligible, timing, ...entry }) => ({ ...entry, landing: entry.landing === 1,+ const project = ({ diagnostic, browser, gui, remote, runnerOnly, runner, item, kind, leaseUntil, shortSlot, shortEligible, timing, ...entry }) => ({ ...entry, landing: entry.landing === 1,itemCheck: entry.itemCheck === 1 && diagnostic !== 1, ...(diagnostic === 1 ? { diagnostic: true } : {}),...(['gate', 'browser'].includes(name) && shortSlot === 1 ? { slot: 'short' } : {}),...(['gate', 'browser'].includes(name) && shortSlot === 0 ? { slot: 'gate' } : {}),...(['gate', 'browser'].includes(name) && shortEligible === 1 ? { requestedSlot: 'short-eligible' } : {}),...(timing === 1 ? { timing: true } : {}), ...(browser === 1 ? { browser: true } : {}), ...(gui === 1 ? { gui: true } : {}), ...(remote === 1 ? { remote: true } : {}),- ...(runner ? { runner } : {}), ...(item ? { item } : {}), ...(kind ? { kind } : {}), ...(leaseUntil ? { leaseUntil } : {}) });+ ...(runnerOnly === 1 ? { runnerOnly: true } : {}), ...(runner ? { runner } : {}), ...(item ? { item } : {}), ...(kind ? { kind } : {}), ...(leaseUntil ? { leaseUntil } : {}) });// Browser is an additional capability on a gate lease, not a second partially held row.const where = name === 'browser' ? 'name = ? AND browser = 1' : 'name = ?';const sourceName = name === 'browser' ? 'gate' : name;@@ -512,6 +514,7 @@ function gateAdmission(db, ticket, capacity, shortCapacity, runners, runnersFirsreturn null;}const remote = runnerSlot();+ if (waiter.runnerOnly === 1 && runners.length) return remote;if (runnersFirst) {if (remote) return remote;const local = localSlot();@@ -760,7 +763,7 @@ function pause(ms) { return new Promise((resolvePromise) => setTimeout(resolvePr/*** 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, timing?: boolean, runnerProvider?: () => Array<{host:string,slots:number,browser:number}>, item?: string, kind?: string, onWait?: (state: object) => any | Promise<any>, 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. An awaited wait callback may return {leaseUntil} and then receives a final {admitted:true} callback before work starts.+ * @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, runnerOnly?: boolean, runnerExecution?: boolean, timing?: boolean, runnerProvider?: () => Array<{host:string,slots:number,browser:number}>, item?: string, kind?: string, onWait?: (state: object) => any | Promise<any>, 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. An awaited wait callback may return {leaseUntil} and then receives a final {admitted:true} callback before work starts.* memory, when given, is read before each admission: a held verdict keeps the whole queue* waiting in place, local, remote and short slots alike, and an unchecked one is passed to onWait once* so the caller can warn.@@ -779,6 +782,7 @@ export async function takeResource(options) {const browser = options.browser === true;const gui = options.gui === true;const remote = options.remote === true;+ const runnerOnly = options.runnerOnly === true;// This synchronous provider is used inside the admission transaction; callers must// limit it to a bounded local configuration read, never Git, process inspection or network work.const runnerProvider = options.runnerProvider;@@ -911,7 +915,7 @@ export async function takeResource(options) {return { acquired: false, state: { ...snapshot(db, name, order), position: waiterPosition(db, name, initialTicket, { order, shortCapacity: options.shortCapacityProvider?.() ?? 0 }), rejoined: true } };}// 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);+ db.prepare('UPDATE waiter SET heartbeat = ?, classed = ?, runner_only = ? WHERE token = ?').run(Date.now(), classedMarker(order), Number(runnerOnly), token);const spot = snapshot(db, name, order, now);const reportPosition = waiterPosition(db, name, waiter.ticket, { order, now, shortCapacity: options.shortCapacityProvider?.() ?? 0 });const limit = db.prepare('SELECT capacity FROM resource WHERE name = ?').get(name).capacity;@@ -926,6 +930,7 @@ export async function takeResource(options) {const acquiredAt = new Date().toISOString();const holderName = executor.host ? runnerResourceName(executor.host) : name;db.prepare('INSERT INTO holder(token, name, pid, started, agent, repo, since, heartbeat, landing, item_check, diagnostic, browser, item, kind, runner, short_slot, timing, timing_aware) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)').run(token, holderName, pid, started, agent, repo, acquiredAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind, executor.host, Number(executor.shortSlot === true), Number(timing), 1);+ db.prepare('UPDATE holder SET runner_execution = ? WHERE token = ?').run(Number(options.runnerExecution === true), token);return { acquired: true, state: { ...spot, position: 0 }, ticket: waiter.ticket, queueTicket, runner: executor.host ? executor : undefined, shortSlot: executor.shortSlot === true, capacity: limit, admittedAt: acquiredAt };}return { acquired: false, state: { ...spot, position: reportPosition } };@@ -1010,7 +1015,7 @@ export async function takeResource(options) {}db.prepare('DELETE FROM holder WHERE token = ?').run(token);db.prepare('INSERT INTO waiter(ticket, token, name, pid, started, agent, repo, since, heartbeat, landing, item_check, diagnostic, browser, item, kind, remote, classed, release_aware, board_key, release_rank, queue_ticket, short_eligible, gui, timing, timing_aware) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')- .run(requeueTicket, token, name, pid, started, agent, repo, queuedAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind, Number(remote && !local), marker, 1, boardKey, releaseRank, requeueOpportunity, Number(shortEligible), Number(gui), Number(timing), 1);+ .run(requeueTicket, token, name, pid, started, agent, repo, queuedAt, Date.now(), Number(landing), Number(itemCheck || diagnostic), Number(diagnostic), Number(browser), item, kind, Number(remote && (!local || runnerOnly)), marker, 1, boardKey, releaseRank, requeueOpportunity, Number(shortEligible), Number(gui), Number(timing), 1);});} catch (error) {transferred = false;@@ -1018,10 +1023,10 @@ export async function takeResource(options) {throw error;}db.close();- return takeResource({ ...options, ...(local ? { remote: false } : {}), _resume: { token, ticket: requeueTicket ?? acquired.ticket, queueTicket: requeueOpportunity,+ return takeResource({ ...options, ...(local && !runnerOnly ? { remote: false } : {}), _resume: { token, ticket: requeueTicket ?? acquired.ticket, queueTicket: requeueOpportunity,queuedAt, requestedAt, priorWaitMs: acquiredWaitMs, waitStartedAt: Date.now() } });};- return { name, scope, token, pool, browser, timing, admittedAt: acquired.admittedAt, capacity: acquired.capacity, slotClass: acquired.shortSlot ? 'short' : 'gate', ...(acquired.runner ? { runner: acquired.runner } : {}),+ return { name, scope, token, pool, browser, timing, runnerExecution: options.runnerExecution === true, admittedAt: acquired.admittedAt, capacity: acquired.capacity, slotClass: acquired.shortSlot ? 'short' : 'gate', ...(acquired.runner ? { runner: acquired.runner } : {}),waitMs: acquiredWaitMs, release, renew, timingEvidence,...(acquired.runner ? { requeueRunner } : {}) };}@@ -1055,7 +1060,7 @@ export function inheritedGateSlot({ root = process.cwd(), browser = false, namedconst db = open(pool, true);let holder;try {- holder = update(db, () => db.prepare("SELECT browser, short_slot AS shortSlot, timing, timing_aware AS timingAware FROM holder WHERE name = 'gate' AND token = ?").get(token));+ holder = update(db, () => db.prepare("SELECT browser, short_slot AS shortSlot, timing, timing_aware AS timingAware, runner_execution AS runnerExecution FROM holder WHERE name = 'gate' AND token = ?").get(token));} finally { db.close(); }if (!holder) throw new Refused('GATE_SLOT_LEASE_LOST', 'the inherited gate lease is missing or expired; remove stale gate markers or let the parent reacquire the gate slot');if (timing && (holder.timing !== 1 || holder.timingAware !== 1)) throw new Refused('TIMING_SLOT_REQUIRED', 'the inherited ordinary lease is not exclusive; start the timing check outside it and acquire timing true');@@ -1066,7 +1071,7 @@ export function inheritedGateSlot({ root = process.cwd(), browser = false, namedif (browser && holder.browser !== 1 && refusalFile) writeFileSync(refusalFile, '{"code":"BROWSER_SLOT_REQUIRED"}\n', { mode: 0o600 });if (browser && holder.browser !== 1) throw new Refused('BROWSER_SLOT_REQUIRED', 'the inherited gate lease does not hold the browser slot; release it and reacquire gate with browser: true before launching Chrome');return {- name: 'gate', scope: 'machine', token, pool, browser: holder.browser === 1, timing: holder.timing === 1, slotClass, waitMs: 0,+ name: 'gate', scope: 'machine', token, pool, runnerExecution: holder.runnerExecution === 1, browser: holder.browser === 1, timing: holder.timing === 1, slotClass, waitMs: 0,release() {}, renew() {},};}diff --git a/src/runner-worker.js b/src/runner-worker.jsindex 518a35da..bbaba9c8 100644--- a/src/runner-worker.js+++ b/src/runner-worker.js@@ -834,7 +834,7 @@ async function main() {const packFile = join(runDirectory, 'source.pack');setupStep = 'runner gate admission';lease = await acquireResourceApi(api, {- name: 'gate', capacity: gateCapacity, scope: 'machine', root: runnerRoot,+ name: 'gate', capacity: gateCapacity, scope: 'machine', root: runnerRoot, runnerExecution: true,repo: runnerRoot, agent: `pullboard-ssh-${spec.id}`,landing: spec.landing === true, itemCheck: spec.itemCheck === true,diagnostic: spec.diagnostic === true, browser: spec.browserRequired, timing: spec.timing === true,diff --git a/test/cpu-load-test-fixture.js b/test/cpu-load-test-fixture.jsindex 579b3828..a755fbd1 100644--- a/test/cpu-load-test-fixture.js+++ b/test/cpu-load-test-fixture.js@@ -9,7 +9,7 @@ import { HOST, installSshStandIn } from './runner-ssh-fixture.js';const SOURCE = resolve(import.meta.dirname, '..');/** Build an ordinary CLI fixture whose declared test reports its actual checkout and live holder. */-export function cpuLoadFixture(e2e) {+export function cpuLoadFixture(e2e, { declaration = '{ cpuLoad: true }' } = {}) {const box = e2e.project('node bin/run-tests.js test/cpu-probe.test.js');const bin = join(box.dir, 'ssh-bin');const remoteHome = join(box.dir, 'runner-home');@@ -21,7 +21,9 @@ export function cpuLoadFixture(e2e) {writeFileSync(join(box.repo, 'package.json'), JSON.stringify({ name: 'cpu-placement-fixture', version: '1.0.0', type: 'module' }) + '\n');writeFileSync(join(box.repo, 'test', 'cpu-probe.test.js'), `import { test } from 'node:test';import { DatabaseSync } from 'node:sqlite';-test('declared load stand-in', { cpuLoad: true }, () => {+// Example text is not a declaration: { cpuLoad: true }+const example = '{ cpuLoad: true }';+test('declared load stand-in', ${declaration}, () => {const db = new DatabaseSync(process.env.PULLBOARD_GATE_SLOT_POOL, { readOnly: true });const row = db.prepare('SELECT * FROM holder WHERE token=?').get(process.env.PULLBOARD_GATE_SLOT_TOKEN);db.close();diff --git a/test/cpu-load-tests.test.js b/test/cpu-load-tests.test.jsindex bd23b544..db853b32 100644--- a/test/cpu-load-tests.test.js+++ b/test/cpu-load-tests.test.js@@ -28,3 +28,14 @@ test('a declared CPU-load test runs only on a runner when one is registered [C7]assert.match(local.log + local.result.stderr, /CPU.load[\s\S]*no (?:registered )?runners|no runners are registered/iu,'the no-runner local fallback explains why it is local');});+++test('a false CPU-load option and textual examples keep ordinary local-first admission [C7]', async () => {+ const box = cpuLoadFixture(e2e, { declaration: '{ cpuLoad: false }' });+ const local = await box.runGate();+ assert.equal(local.result.status, 0, local.result.context);+ assert.equal(box.requestsMade().length, 0, 'comments, string examples and a false option do not force runner execution');+ assert.equal(local.executor?.cwd, box.repo);+ assert.equal(local.executor?.liveLease, true);+ assert.equal(local.executor?.runnerExecution, false);+});diff --git a/test/gate-admission.test.js b/test/gate-admission.test.jsindex 825d1434..24be7fe0 100644--- a/test/gate-admission.test.js+++ b/test/gate-admission.test.js@@ -198,7 +198,7 @@ test('a caller keeps its place while its synchronous call is open, so no other fassert.equal(await occupiedPlaces(home), 2, 'the call returned, the caller runs in its own place');});-test('a parent that starts its nested run asynchronously keeps its own token, so its nested files take separate ones [C7]', async (t) => {+test('a parent that starts its nested run asynchronously keeps its own token, so its nested files take separate ones [C7]', { cpuLoad: true }, async (t) => {const { root, env, log } = fixture(t, 2);for (const file of ['inner-a.test.js', 'inner-b.test.js']) writeFileSync(join(root, file), timedFile(file, 400));// The parent starts its nested run without blocking on it and spins the CPU until the run ends.@@ -454,7 +454,7 @@ test('a broken private pool must not return a live loan', async () => {assert.equal(await occupiedPlaces(env.PULLBOARD_MACHINE_HOME), 0);});-test('a run a synchronous call leaves behind lends nothing once the call returns [C7]', async (t) => {+test('a run a synchronous call leaves behind lends nothing once the call returns [C7]', { cpuLoad: true }, async (t) => {const { root, env, log } = fixture(t, 1);for (const file of ['inner-a.test.js', 'inner-b.test.js']) writeFileSync(join(root, file), timedFile(file, 200));// The parent's shell call starts a detached run and returns at once; the parent then works on in its own place.diff --git a/test/runners.test.js b/test/runners.test.jsindex 01849e96..4a807ad2 100644--- a/test/runners.test.js+++ b/test/runners.test.js@@ -1443,7 +1443,7 @@ test('a red on a registered runner gets its paired rerun and ledger entry, or st});test('the runner round trip deadline holds under a loaded test machine and still catches a stuck phase [C7]',- { timeout: 660_000 }, async t => { // budget: five real paired attempts plus a bounded held phase, below the file hang ceiling.+ { timeout: 660_000, cpuLoad: true }, async t => { // budget: five real paired attempts plus a bounded held phase, below the file hang ceiling.await assertAttemptDeadlineReset(PAIRED_RERUN_FIXTURE);await assertRedispatchDeadlineAccounting(PAIRED_RERUN_FIXTURE);assertFixtureGroupEpermControls();