Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/ai-harness/tests/workspace-tools.test.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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) => {
Expand Down
Loading