Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep test-process reaping when an ancestor row has no parent (#13301)
[._.]/ Adam Eivy6b1e4618e8c5
diff --git a/scripts/lib/testOwnedProcesses.js b/scripts/lib/testOwnedProcesses.jsindex e1efae8733..ee023f8eea 100644--- a/scripts/lib/testOwnedProcesses.js+++ b/scripts/lib/testOwnedProcesses.js@@ -99,18 +99,25 @@ export function testProcessRoot({ args = [], env = {} }, parent, prefix) {}export function processAncestors(records, pid = process.pid) {- const parents = new Map(records.map(record => [record.pid, record.ppid]));- if (!parents.has(pid)) return null;+ const parents = new Map();+ for (const record of records || []) {+ // An incomplete identity row has a pid and no parent. It is a gap in the+ // chain, not a parent link, and must not void every other owned process.+ if (Number.isSafeInteger(record?.pid) && Number.isSafeInteger(record.ppid) && record.ppid >= 1) {+ parents.set(record.pid, record.ppid);+ }+ }+ if (!Number.isSafeInteger(pid) || pid < 1 || !parents.has(pid)) return null;const ancestors = new Set([1, pid, process.ppid]);const visited = new Set();while (pid > 1) {if (visited.has(pid)) return null;visited.add(pid);- // Readers may omit an ancestor owned by another uid. Keep every known- // ancestor excluded without requiring visibility all the way to init.+ // Readers may omit an ancestor owned by another uid, or return it without+ // a parent. Keep every known ancestor excluded without requiring init.if (!parents.has(pid)) return ancestors;const parent = parents.get(pid);- if (!Number.isSafeInteger(parent) || parent < 1 || parent === pid) return null;+ if (parent === pid) return null;if (parent === 1) return ancestors;ancestors.add(parent);pid = parent;diff --git a/scripts/testOwnedProcessRecovery.test.js b/scripts/testOwnedProcessRecovery.test.jsindex fc3dd6caed..0e9fc8aa24 100644--- a/scripts/testOwnedProcessRecovery.test.js+++ b/scripts/testOwnedProcessRecovery.test.js@@ -16,6 +16,8 @@ describe('test process ownership boundaries', () => {const records = [{ pid: 900001, ppid: 900002 }, { pid: 900002, ppid: 900003 }];expect(processAncestors(records, 900004)).toBeNull();expect(processAncestors(records, 900001)).toEqual(new Set([1, 900001, process.ppid, 900002, 900003]));+ expect(processAncestors([...records, { pid: 900003, ownershipComplete: false }], 900001))+ .toEqual(new Set([1, 900001, process.ppid, 900002, 900003]));expect(processAncestors([...records, { pid: 900003, ppid: 900001 }], 900001)).toBeNull();});