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(land): require original identity before group signals [Q1,Q3,C7]

Corey Olson98e809ff9ff6
diff --git a/src/landing-worker.js b/src/landing-worker.js
index 4e7a2da1..5b743ce2 100644
--- a/src/landing-worker.js
+++ b/src/landing-worker.js
@@ -31,7 +31,7 @@ function census() {
}
/** Stop owned descendants and their group; optional observers exercise census races without signaling foreign processes. */
-export function stop(child, member, { read = census, kill = process.kill } = {}) {
+export function stop(child, member, { read = census, kill = process.kill, log = stopNotice } = {}) {
if (!child.pid) return;
const rows = read();
const root = rows?.get(child.pid);
@@ -55,7 +55,12 @@ export function stop(child, member, { read = census, kill = process.kill } = {})
}
// Descendant signals can empty the group; its earlier census is no longer a signal target.
const group = read();
- if (!group || !runningGroup(group, child.pid)) return;
+ if (!group) { log(`landing stop skipped group ${child.pid}: the final process census is unavailable`); return; }
+ if (!runningGroup(group, child.pid)) return;
+ // Only an original attributed member can witness this group number's lifetime; a zombie still reserves its identity.
+ const witnessed = [...owned].some(pid => rows.get(pid)?.pgid === child.pid && group.get(pid)?.pgid === child.pid
+ && group.get(pid).started === rows.get(pid).started && group.get(pid).processSha256 === rows.get(pid).processSha256);
+ if (!witnessed) { log(`landing stop skipped group ${child.pid}: no recorded original process identity remains in that group`); return; }
try { kill(-child.pid, 'SIGKILL'); }
catch (error) {
if (error.code === 'ESRCH') return;
@@ -65,6 +70,9 @@ export function stop(child, member, { read = census, kill = process.kill } = {})
}
}
+/** Report unattributed remaining work without claiming its group was reused or drained. */
+function stopNotice(message) { process.stderr.write(message + '\n'); }
+
/** 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')); }