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(runner): a child that leaves its group is still signalled [C7]
Corey Olsona25c39f81df3
diff --git a/src/runner-worker.js b/src/runner-worker.jsindex bd8a6232..3c19d524 100644--- a/src/runner-worker.js+++ b/src/runner-worker.js@@ -597,7 +597,14 @@ function createDescendantTracker(directory) {for (const pid of ownedPids) {const row = current.get(pid);const prior = known.get(pid);- if (row && prior?.birth === row.birth) Object.assign(prior, row);+ if (!row || prior?.birth !== row.birth) continue;+ Object.assign(prior, row);+ // A detached child is forked into its parent's group and calls setsid a moment later. A census in that window+ // records the parent's group; once this proven identity leads its own group, track that group instead (#888).+ if (!prior.root && row.pgid === row.pid && prior.group !== row.pid) {+ prior.group = row.pid;+ detachedGroups.set(row.pid, row.birth);+ }}return current;} catch {diff --git a/test/runner-parent-death-fixture.js b/test/runner-parent-death-fixture.jsindex 69f0bbab..12e3d694 100644--- a/test/runner-parent-death-fixture.js+++ b/test/runner-parent-death-fixture.js@@ -15,8 +15,10 @@ import { readRemoteGateHolders, waitForCondition } from './runner-fixture-state.* transport drops (#888: a forwarded write then waited forever for a drain from a destroyed stdout), and `epermOnce`* makes the worker's repeat signal to one process group answer EPERM, as macOS did when the command group finished* exiting during the TERM grace loop (#888); the launcher lingers 300 ms after TERM so that repeat signal is sent.+ * `lateGroup` starts the child in the launcher's group and moves it to its own a second later, so the worker's census+ * always sees it first in the old group, as it did under load when a detached child had not yet called setsid (#888).*/-export async function parentDeathDrainFixture(t, tools, { holdRelease = false, chatty = false, epermOnce = false } = {}) {+export async function parentDeathDrainFixture(t, tools, { holdRelease = false, chatty = false, epermOnce = false, lateGroup = false } = {}) {const { cli, git, installSshStandIn, observe, startQueueController, waitForMarker, processIsAlive, shellQuote, HOST } = tools;const dir = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-runner-parent-death-')));t.after(() => rmSync(dir, { recursive: true, force: true }));@@ -96,9 +98,9 @@ export async function parentDeathDrainFixture(t, tools, { holdRelease = false, cwriteFileSync(join(repo, 'pullboard.json'), JSON.stringify({ gate: 'true' }));writeFileSync(join(repo, 'tracked.txt'), 'parent-death runner fixture\n');writeFileSync(join(repo, 'remote-parent-death-launcher.js'), `const { spawn } = require('node:child_process');-const child = spawn(process.execPath, [require.resolve('./remote-detached-child.js'), ...process.argv.slice(2)], {- detached: true, stdio: 'ignore', env: process.env,-});+const child = ${lateGroup+ ? "spawn('perl', ['-e', 'select(undef, undef, undef, 1); setpgrp(0, 0); exec @ARGV', process.execPath, require.resolve('./remote-detached-child.js'), ...process.argv.slice(2)], {\n stdio: 'ignore', env: process.env,\n});"+ : "spawn(process.execPath, [require.resolve('./remote-detached-child.js'), ...process.argv.slice(2)], {\n detached: true, stdio: 'ignore', env: process.env,\n});"}child.unref();${chatty ? "setInterval(() => process.stdout.write('launcher output\\n'), 20);" : 'setInterval(() => {}, 1_000);'}${epermOnce ? "process.on('SIGTERM', () => setTimeout(() => process.exit(0), 300));" : ''}diff --git a/test/runners.test.js b/test/runners.test.jsindex 9082997e..a55e2f06 100644--- a/test/runners.test.js+++ b/test/runners.test.js@@ -1680,6 +1680,9 @@ test('a queued run executes on a registered runner and its result comes back [C7test('a queued run executes on a registered runner and its result comes back [C7] (parent death drains its worker when a group signal answers EPERM)',{ timeout: 90_000 }, t => parentDeathDrainFixture(t, parentDeathTools, { epermOnce: true })); // budget: same fixture ceiling as the ordinary parent-death case.+test('a queued run executes on a registered runner and its result comes back [C7] (parent death drains a child that leaves its group after the first census)',+ { timeout: 90_000 }, t => parentDeathDrainFixture(t, parentDeathTools, { lateGroup: true })); // budget: same fixture ceiling as the ordinary parent-death case.+test('a queued run executes on a registered runner and its result comes back [C7] (unverified cleanup times out as a named red result)', { timeout: 90_000 }, async (t) => { // budget: bounded 30-second remote cleanup timeout plus startup, transport and fixture cleanup ceiling.const dir = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-runner-cleanup-timeout-')));const home = join(dir, 'home');