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(core): recheck a drained landing group before signalling [Q3]
Corey Olsona403c852dab6
diff --git a/src/landing-worker.js b/src/landing-worker.jsindex 5b0759a6..ad2e2eee 100644--- a/src/landing-worker.js+++ b/src/landing-worker.js@@ -45,12 +45,21 @@ function stop(child, member) {&& current.get(pid)?.processSha256 === rows.get(pid)?.processSha256) {try { process.kill(pid, 'SIGKILL'); } catch (error) { if (error.code !== 'ESRCH') throw error; }}- // A SIGSTOP parent can retain its guardian as an unreaped zombie after the whole group exited.- if (![...current.values()].some(row => row.pgid === child.pid && !row.state.startsWith('Z'))) return;+ // 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') throw error; }+ 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'] });diff --git a/test/landing-queue-fixture.js b/test/landing-queue-fixture.jsindex 91d8b3e0..f0ecfa52 100644--- a/test/landing-queue-fixture.js+++ b/test/landing-queue-fixture.js@@ -238,7 +238,11 @@ export async function landingQueueCase(t, helpers, { staleAfterFirst = false, kiassert.equal(readBoard(box, board => store.landingBatches(board).length), 2);return;}- if (!killParent) assert.equal((await first.closed).code, 1, 'a surviving authority owner refuses after its worker stops');+ if (!killParent) {+ assert.equal((await first.closed).code, 1, 'a surviving authority owner refuses after its worker stops');+ assert.match(first.stderrText, /\[LAND_WORKER\]/u, 'guardian loss reports a typed worker refusal');+ assert.doesNotMatch(first.stderrText, /Error: kill EPERM|internal\/event_target/u, 'an uncaught cleanup error is not guardian fencing');+ }assert.equal(existsSync(release), false, 'the owning test did not let the abandoned gate proceed');const waiting = await second.closed;assert.equal(waiting.code, 1);