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(runners): route inherited GUI shards, retain text [C7,V4]
Corey Olsone71a170c9028
diff --git a/src/commands/runner.js b/src/commands/runner.jsindex 568d82ee..57b509a0 100644--- a/src/commands/runner.js+++ b/src/commands/runner.js@@ -16,7 +16,7 @@ export function runnerCommand(io, { first, second, rest, values }) {// Registered capacity is what each runner enforces, whatever its own settings say (#1066).const runners = runnerResourceStatus(loadMachineSettings().runners ?? []);io.result?.({ runners });- io.say(runners.length ? runners.map(runner => `${runner.host}: ${runner.slots} slots, ${runner.browser} browser, GUI ${runner.gui === true ? 'yes' : runner.gui === false ? 'no' : 'unknown'}${runner.draining ? ' (draining)' : ''}`).join('\n') : 'no runners registered');+ io.say(runners.length ? runners.map(runner => `${runner.host}: ${runner.slots} slots, ${runner.browser} browser${runner.draining ? ' (draining)' : ''}\n GUI session: ${runner.gui === true ? 'yes' : runner.gui === false ? 'no' : 'unknown'}`).join('\n') : 'no runners registered');return 0;}if (first === 'remove') {diff --git a/src/gate.js b/src/gate.jsindex 17168ad2..a03a2982 100644--- a/src/gate.js+++ b/src/gate.js@@ -351,7 +351,8 @@ export async function withGateSlot(root, action, options = {}) {if (!['RUNNER_BROWSER_SLOT_REQUIRED', 'RUNNER_GUI_SESSION_REQUIRED'].includes(error?.code) || options.remote === false) throw error;// The runner's red attempt stays on record beside the local rerun.const attempt = error.runnerAttempt ?? { host: '', exitCode: null, output: '' };- process.stderr.write(`${error.message}; its attempt (exit ${attempt.exitCode}):\n${attempt.output}${attempt.output.endsWith('\n') || !attempt.output ? '' : '\n'}rerunning it locally with the required capabilities\n`);+ const required = error.code === 'RUNNER_GUI_SESSION_REQUIRED' ? 'a GUI session' : 'a browser slot';+ process.stderr.write(`${error.message}; its attempt (exit ${attempt.exitCode}):\n${attempt.output}${attempt.output.endsWith('\n') || !attempt.output ? '' : '\n'}rerunning it locally with ${required}\n`);const result = await withOneGateSlot(root, action, { ...options, remote: false, browser: true });if (result && typeof result === 'object') result.runnerAttempt = attempt;return result;diff --git a/src/landing-shards.js b/src/landing-shards.jsindex 19d17f72..a73dd973 100644--- a/src/landing-shards.js+++ b/src/landing-shards.js@@ -356,6 +356,9 @@ export async function runLandingShards({ root, runner, files, count, inherited =const entries = await Promise.all(plan.map(async (shard, index) => ({ shard, label: `${index + 1}/${total}`,browser: await needsBrowser(shard.files), gui: await needsGui(shard.files), claimed: false, localOnly: false, done: false, attempts: [], status: null })));+ /** A remote parent's slot cannot take a GUI file unless its own advertised capability permits it. */+ const inheritedCanRun = entry => !entry.gui || !inherited?.runner || inherited.runner.gui === true;+/** Run one attempt of a shard on a lease: a local child, or the runner it names. */const attempt = async (entry, lease) => {const started = Date.now();@@ -470,7 +473,7 @@ export async function runLandingShards({ root, runner, files, count, inherited =/** The parent's own slot: run free shards one after another until every shard is done. */const lane = async () => {while (!entries.every(entry => entry.done) && !failures.length) {- const next = entries.find(entry => !entry.claimed && !entry.done && (!entry.gui || !inherited.runner || inherited.runner.gui === true));+ const next = entries.find(entry => !entry.claimed && !entry.done && inheritedCanRun(entry));if (!next) { await changed; continue; }next.claimed = true;await runOnLease(next, inherited);@@ -479,7 +482,7 @@ export async function runLandingShards({ root, runner, files, count, inherited =let shards;try {- for (const entry of entries) if (!inherited || entry !== entries[0]) acquire(entry);+ for (const entry of entries) if (!inherited || entry !== entries[0] || !inheritedCanRun(entry)) acquire(entry);if (inherited) await lane();while (!entries.every(entry => entry.done) && !failures.length) await changed;if (failures.length) throw failures[0];diff --git a/test/chrome-clone-proof.js b/test/chrome-clone-proof.jsindex 83327e97..7ded567f 100644--- a/test/chrome-clone-proof.js+++ b/test/chrome-clone-proof.js@@ -103,9 +103,9 @@ export async function assertNoKilledChromeClone(t) {try {await waitUntil(() => existsSync(join(profile, 'DevToolsActivePort')), 15_000, 'real Chrome did not publish its private DevTools port');if (control) {- // Chrome may skip an unstarted clone task during shutdown, so observe creation before asking it to close.- await waitUntil(() => monitor.created.size > 0, 5_000, 'unflagged native Chrome must create a clone for the control');+ await new Promise(resolve => setTimeout(resolve, 1_000)); // budget: let the native background clone task start before graceful shutdown drains it.await gracefulClose(profile, launched);+ await waitUntil(() => monitor.created.size > 0, 5_000, 'unflagged native Chrome must create a clone for the control');assert.deepEqual(monitor.errors, []);t.diagnostic(JSON.stringify({ phase: 'unflagged-control', createdClones: monitor.created.size, remainingClones: newChromeClones(before).length }));await waitUntil(() => newChromeClones(before).length === 0, 5_000, 'Chromium must clean its own control clone after graceful shutdown');diff --git a/test/landing-shards.test.js b/test/landing-shards.test.jsindex 1d964d36..4655e8e3 100644--- a/test/landing-shards.test.js+++ b/test/landing-shards.test.js@@ -89,6 +89,46 @@ process.stdout.write(JSON.stringify(result));`;assert.equal(measured.shards[0].attempts[0].host, 'local');});+test('a no-GUI remote parent gives its first GUI shard to a compatible local slot [C7,V4]', t => {+ const box = fixture({ runner: true });+ t.after(() => rmSync(box.dir, { recursive: true, force: true }));+ const settingsPath = join(box.env.PULLBOARD_MACHINE_HOME, 'settings.json');+ const settings = JSON.parse(readFileSync(settingsPath, 'utf8'));+ settings.runners = settings.runners.map(runner => ({ ...runner, gui: false }));+ writeFileSync(settingsPath, JSON.stringify(settings));+ const script = `import assert from 'node:assert/strict';+import { withGateSlot } from ${JSON.stringify(pathToFileURL(join(SOURCE, 'src/gate.js')).href)};+import { runLandingShards } from ${JSON.stringify(pathToFileURL(join(SOURCE, 'src/landing-shards.js')).href)};+const root = ${JSON.stringify(box.repo)};+let release;+let entered;+const ready = new Promise(resolve => { entered = resolve; });+const freed = new Promise(resolve => { release = resolve; });+const result = await withGateSlot(root, async () => {+ const held = withGateSlot(root, async () => { entered(); await freed; }, { remote: false });+ await ready;+ try {+ return await withGateSlot(root, async inherited => {+ assert.equal(inherited.runner.host, ${JSON.stringify(HOST)});+ assert.equal(inherited.runner.gui, false);+ const timer = setTimeout(release, 250);+ try { return await runLandingShards({ root, inherited, runner: ${JSON.stringify(join(box.repo, 'bin/run-tests.js'))},+ files: ['./test/a.test.js'], count: 1, needsBrowser: async () => false, needsGui: async () => true,+ remoteRun: async () => { throw new Error('a no-GUI inherited runner must not execute this shard'); }, write: () => {} }); }+ finally { clearTimeout(timer); }+ });+ } finally { release(); await held; }+}, { remote: false });+process.stdout.write(JSON.stringify(result));`;+ const env = { ...box.env };+ delete env.NODE_TEST_CONTEXT;+ const result = runFixtureChild(process.execPath, ['--input-type=module', '-e', script], { cwd: box.repo, env, encoding: 'utf8' });+ assert.equal(result.status, 0, result.context);+ const measured = JSON.parse(result.stdout);+ assert.equal(measured.isGreen, true);+ assert.equal(measured.shards[0].attempts[0].host, 'local');+});+test('six shards land on six different runners [C7,V4]', (t) => {const box = fixture({ runner: false });t.after(() => rmSync(box.dir, { recursive: true, force: true }));