From ac53fd262282be335e70c738668b2f9f80a2e409 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Mon, 16 Nov 2026 12:29:48 +0100 Subject: [PATCH] test(ai-harness): count a zombie child as stopped in the bash timeout test On TanStack Source CI, PID 1 never reaps the killed node child, so kill(pid, 0) still succeeds and the test fails on every run that affects @tanstack/ai-harness. isRunning now reads /proc//stat and treats state Z as stopped, as #2138 did for the Blaxel test. --- packages/ai-harness/tests/workspace-tools.test.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/ai-harness/tests/workspace-tools.test.ts b/packages/ai-harness/tests/workspace-tools.test.ts index 31d2017a1a..2198915b5b 100644 --- a/packages/ai-harness/tests/workspace-tools.test.ts +++ b/packages/ai-harness/tests/workspace-tools.test.ts @@ -1,3 +1,4 @@ +import { readFileSync } from 'node:fs' import { mkdtemp, readFile, realpath, rm, symlink } from 'node:fs/promises' import { tmpdir } from 'node:os' import * as nodePath from 'node:path' @@ -173,10 +174,18 @@ const toolNames = (call: { tools: Array<{ name: string }> }) => function isRunning(pid: number) { try { process.kill(pid, 0) - return true } catch { return false } + // A zombie still answers `kill(pid, 0)`. In a CI container whose PID 1 + // never reaps it (TanStack Source), a killed child stays a zombie, so read + // its state on Linux. With no /proc, the process counts as running. + try { + const stat = readFileSync(`/proc/${pid}/stat`, 'utf8') + return !stat.slice(stat.lastIndexOf(')') + 2).startsWith('Z') + } catch { + return true + } } describe.each(fixtures)('workspace tools on the $name backend', (fixture) => {