From bf2f790e6e306f7d4b8e8d97ad7fda443e3b189d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Sat, 9 May 2026 12:52:39 +0000 Subject: [PATCH] fix: detect crashed threads even when .running marker is already gone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check worker PID liveness as final fallback — if worker is dead and thread has no __end__ node, it crashed. 小橘 --- packages/cli-workflow/src/thread-scan.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/cli-workflow/src/thread-scan.ts b/packages/cli-workflow/src/thread-scan.ts index fbcc381..43aeabd 100644 --- a/packages/cli-workflow/src/thread-scan.ts +++ b/packages/cli-workflow/src/thread-scan.ts @@ -230,6 +230,16 @@ export async function resolveThreadListStatus( } return "running"; } + // No .running marker + no __end__ + source "active" → check if worker is dead (crashed) + const ctlResult = await readWorkerCtl(storageRoot, row.hash); + if (ctlResult.ok) { + try { + process.kill(ctlResult.value.pid, 0); + } catch { + // Worker PID is dead, thread never finished — crashed + return "failed"; + } + } return "active"; }