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.

fix(core): carry GUI into common runner placement [C7,O5,V4]

Corey Olson77837085938e
diff --git a/docs/api.md b/docs/api.md
index 38b42c38..e058dd55 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -587,6 +587,8 @@ The view's own page retains its person channel. The standalone API refuses `POST
A test file whose header includes `/** @pullboard-test-gui */` explicitly needs a desktop; Chrome's `--headless` arguments do not infer or waive that requirement. The gate and landing-shard routes put that file only on a remote runner whose GUI capability is confirmed `true`; false and unknown runners are excluded and work falls back to a local slot. A no-GUI inherited remote parent also hands its GUI shard to a compatible slot. At actual remote job start, after physical admission and before the project command runs, the worker checks its own GUI session again. A stale positive report cannot bypass this check: `RUNNER_GUI_SESSION_REQUIRED` retains the refused attempt and reroutes the work locally. Direct runner API callers request the same check with `metadata.gui: true`; a completed result exposes the authenticated observation as `executionCapabilities.gui`. GUI availability is separate from browser-slot capacity and from whether Chrome itself succeeds.
+The runner stage and placement API carry optional `capabilities.gui` (`true`, `false`, or `null`). A `gui: true` request runs only on a confirmed GUI runner; unknown availability waits, and false availability is incompatible. `gui: false` imposes no GUI requirement. Current local capacity samples the GUI domain; remote capacity uses the last authenticated worker report. Historical receipts without a GUI observation stay unknown.
+
Runner storage keeps one repository object cache and creates an isolated checkout with complete history per run. A locked inventory handshake transfers only missing committed objects after scanning their blobs, paths and commit metadata, including ancestors. Historical protected paths are checked before connecting. A credential-free HTTPS origin may seed the cache at a locally known published ancestor; caller credentials are never forwarded. Cached object contents are not rescanned on every run.
Each checkout with a committed npm lockfile runs `npm ci`, including lifecycle scripts. Only npm's content cache is shared; installed dependencies and generated files stay in the fresh checkout. Other lock managers are refused. Combined command output and transport diagnostics are bounded at 64 MiB; exceeding that limit refuses the run.
diff --git a/src/gate.js b/src/gate.js
index 8e97b817..b8d80a37 100644
--- a/src/gate.js
+++ b/src/gate.js
@@ -238,7 +238,11 @@ export function runProfiledShell(root, command, { waitMs = 0, artifactDirectory,
browser: gateLease.browser, pipefail, stages, waivers: landing ? waivers : [], metadata: { ...(gateLease.runMetadata ?? {}), landing, ...(timeoutMs ? { timeoutMs } : {}) } }) }
: runShell(root, command, { pipefail, env: inherited, stages, timeoutMs });
gateLease?.tracker?.mark('ranAt');
- if (gateLease) { gateLease.environment = run.environment ?? null; gateLease.executionAdmission = run.executionAdmission ?? null; }
+ if (gateLease) {
+ gateLease.environment = run.environment ?? null;
+ gateLease.gui = run.executionCapabilities?.gui ?? null;
+ gateLease.executionAdmission = run.executionAdmission ?? null;
+ }
const sandboxBlocked = run.isGreen ? null : run.sandboxBlocked ?? (run.executionRunner
// The controller cannot realpath remote files; retain the network denial signal without treating remote paths as local paths.
? sandboxBlockedOperation(root, run.output, { includeFilePaths: false })
@@ -265,6 +269,7 @@ export async function runProfiledShellAsync(root, command, { waitMs = 0, gateSlo
const run = await runOnRunnerAsync(root, command, { runner: gateLease.runner, source: gateLease.source,
browser: gateLease.browser, metadata: { ...(gateLease.runMetadata ?? {}), landing } });
gateLease.environment = run.environment ?? null;
+ gateLease.gui = run.executionCapabilities?.gui ?? null;
gateLease.executionAdmission = run.executionAdmission ?? null;
gateLease.tracker?.mark('ranAt');
const wallMs = Math.max(0, Date.now() - started);
@@ -315,7 +320,7 @@ function settleReceipt(lease) {
const local = !lease.runner;
const descriptor = local ? lease.localDescriptor ?? localRunnerDescriptor(lease.capacity ?? null, null)
: { id: lease.runner.host, kind: 'ssh', slots: { current: executor?.slots ?? lease.runner.slots, limit: executor?.slots ?? lease.runner.slots, elastic: false },
- capabilities: { os: lease.environment?.platform ?? null, browser: lease.runner.browser > 0 } };
+ capabilities: { os: lease.environment?.platform ?? null, browser: lease.runner.browser > 0, gui: lease.gui ?? null } };
const admittedAt = local ? lease.admittedAt ?? new Date(lease.tracker.marks.admittedAt ?? lease.tracker.marks.requestedAt).toISOString() : executor?.admittedAt ?? null;
const finishedAt = local ? new Date().toISOString() : executor?.finishedAt ?? null;
const load = local ? { start: lease.startLoad ?? sampleRunnerLoad(), end: sampleRunnerLoad() } : executor?.load ?? null;
diff --git a/src/runner-load.js b/src/runner-load.js
index c4a83d4d..2d7b29d0 100644
--- a/src/runner-load.js
+++ b/src/runner-load.js
@@ -11,7 +11,7 @@ export function sampleRunnerLoad() {
}
/** Describe actual local admission capacity; unreported capabilities stay unknown. */
-export function localRunnerDescriptor(slots, browser) {
+export function localRunnerDescriptor(slots, browser, gui = null) {
return { id: `local:${hostname()}`, kind: 'local', slots: { current: slots, limit: slots, elastic: false },
- capabilities: { os: platform(), browser } };
+ capabilities: { os: platform(), browser, gui } };
}
diff --git a/src/runner-stage-read.js b/src/runner-stage-read.js
index 8697b4d2..18e91e41 100644
--- a/src/runner-stage-read.js
+++ b/src/runner-stage-read.js
@@ -1,4 +1,5 @@
/** Read a privacy-safe runner capacity snapshot for one explicit stats window [C7,O5]. */
+import { guiSession } from './gui-session.js';
import { retainedReceipts } from './gate-receipt.js';
import { localRunnerDescriptor } from './runner-load.js';
import {
@@ -24,7 +25,7 @@ function currentRunners(settings, receipts, machineResources) {
const browserPool = machineResources.find(resource => resource.name === 'browser');
const localCapacity = gate?.capacity ?? settings.gateSlots;
const browserCapacity = browserPool?.capacity ?? settings.browserSlots;
- const local = localRunnerDescriptor(localCapacity, browserCapacity > 0);
+ const local = localRunnerDescriptor(localCapacity, browserCapacity > 0, guiSession());
const gateHolders = gate?.holders ?? [];
local.active = gateHolders.some(holder => holder.timing) ? localCapacity
: gateHolders.filter(holder => holder.slot !== 'short').length;
@@ -34,7 +35,7 @@ function currentRunners(settings, receipts, machineResources) {
id: runner.host,
kind: runner.kind ?? 'ssh',
slots: { current: runner.slots, limit: runner.slots, elastic: false },
- capabilities: { os: reportedPlatform(receipts, runner.host), browser: runner.browser > 0 },
+ capabilities: { os: reportedPlatform(receipts, runner.host), browser: runner.browser > 0, gui: runner.gui ?? null },
active: runner.holders.some(holder => holder.timing === 1) ? runner.slots : runner.inUse,
browserSlots: runner.browser,
browserActive: runner.browserInUse,
diff --git a/src/runner-stage.js b/src/runner-stage.js
index 6bc18df4..57c93e73 100644
--- a/src/runner-stage.js
+++ b/src/runner-stage.js
@@ -29,9 +29,11 @@ function normalizedRunner(value, { stage = false } = {}) {
}
const os = value.capabilities.os ?? null;
const browser = value.capabilities.browser ?? null;
+ const gui = value.capabilities.gui ?? null;
if (!(typeof os === 'string' && os.trim() || os === null)
- || !(typeof browser === 'boolean' || browser === null)) {
- invalid('runner OS and browser capability must be reported values or null when unknown');
+ || !(typeof browser === 'boolean' || browser === null)
+ || !(typeof gui === 'boolean' || gui === null)) {
+ invalid('runner OS, browser and GUI capabilities must be reported values or null when unknown');
}
for (const key of ['unavailable', 'draining']) {
if (value[key] !== undefined && typeof value[key] !== 'boolean') invalid(`runner ${key} state must be true or false`);
@@ -52,7 +54,7 @@ function normalizedRunner(value, { stage = false } = {}) {
id: value.id,
kind: value.kind,
slots: { current: value.slots.current, limit: value.slots.limit, elastic: value.slots.elastic },
- capabilities: { os, browser },
+ capabilities: { os, browser, gui },
};
normalized.active = value.active;
if (value.browserSlots !== undefined) Object.assign(normalized, { browserSlots: value.browserSlots, browserActive: value.browserActive });
@@ -206,12 +208,12 @@ export function runnerStage(runners, receipts, window = {}) {
slowQuarterMs: quartile(waits, 0.75), worstMs: waits.length ? waits.at(-1) : null, count: waits.length } };
}
-/** Compare requested capabilities; false browser means no browser requirement. */
+/** Compare requested capabilities; false browser or GUI means no corresponding requirement. */
function capabilityMatch(runner, requested) {
let unknown = false;
- for (const key of ['os', 'browser']) {
+ for (const key of ['os', 'browser', 'gui']) {
if (requested[key] === undefined || requested[key] === null) continue;
- if (key === 'browser' && requested[key] === false) continue;
+ if (['browser', 'gui'].includes(key) && requested[key] === false) continue;
const actual = runner.capabilities[key];
if (actual === null) unknown = true;
else if (actual !== requested[key]) return 'no';
@@ -239,7 +241,7 @@ function candidateOrder(left, right) {
/**
* Return a read-only placement suggestion. It never changes runner capacity or starts a run.
* @param {{runners:object[],slotWait:object}} stage A value returned by {@link runnerStage}.
- * @param {{capabilities?:{os?:string|null,browser?:boolean|null},slotWaitTargetMs?:number}} request
+ * @param {{capabilities?:{os?:string|null,browser?:boolean|null,gui?:boolean|null},slotWaitTargetMs?:number}} request
*/
export function placeRunner(stage, request = {}) {
if (!record(request)) invalid('runner placement request must be an object');
@@ -251,6 +253,7 @@ export function placeRunner(stage, request = {}) {
if (!record(capabilities) || !(capabilities.os === undefined || capabilities.os === null
|| typeof capabilities.os === 'string' && capabilities.os.trim())
|| !(capabilities.browser === undefined || capabilities.browser === null || typeof capabilities.browser === 'boolean')
+ || !(capabilities.gui === undefined || capabilities.gui === null || typeof capabilities.gui === 'boolean')
|| !Number.isFinite(slotWaitTargetMs) || slotWaitTargetMs < 0) {
invalid('placement capabilities must be reported values or null and the wait target nonnegative');
}