From 064a24f093a12748db081290f59b059475659617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Sun, 10 May 2026 01:36:14 +0000 Subject: [PATCH] fix: no-ctl threads should be failed, not active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 小橘 --- packages/cli-workflow/src/thread-scan.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/cli-workflow/src/thread-scan.ts b/packages/cli-workflow/src/thread-scan.ts index 43aeabd..7b7ef0d 100644 --- a/packages/cli-workflow/src/thread-scan.ts +++ b/packages/cli-workflow/src/thread-scan.ts @@ -232,13 +232,15 @@ export async function resolveThreadListStatus( } // 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"; - } + if (!ctlResult.ok) { + // No ctl file means worker never registered or was already cleaned up — dead thread + return "failed"; + } + try { + process.kill(ctlResult.value.pid, 0); + } catch { + // Worker PID is dead, thread never finished — crashed + return "failed"; } return "active"; }