From 06af1dc668d63f5bcd09523bb95753ab69cae31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E6=9C=88?= Date: Thu, 4 Jun 2026 15:35:08 +0800 Subject: [PATCH] fix: resolve workflow from CAS chain in collectCompletedThreads Instead of hardcoding workflow as empty string for completed/cancelled threads, use resolveWorkflowFromHead to get the actual workflow hash from the CAS chain, consistent with active thread handling. Closes #46 --- packages/cli/src/commands/thread.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/thread.ts b/packages/cli/src/commands/thread.ts index d2c06d6..113f21b 100644 --- a/packages/cli/src/commands/thread.ts +++ b/packages/cli/src/commands/thread.ts @@ -585,19 +585,20 @@ async function collectActiveThreads( } function collectCompletedThreads( - varStore: VarStore, + uwf: UwfStore, activeIds: Set, ): ThreadListItemWithStatus[] { const items: ThreadListItemWithStatus[] = []; - const history = loadHistoryThreads(varStore); + const history = loadHistoryThreads(uwf.varStore); const seen = new Set(); // Deduplication (issue #470) for (const [threadId, entry] of Object.entries(history)) { if (!activeIds.has(threadId as ThreadId) && !seen.has(threadId as ThreadId)) { seen.add(threadId as ThreadId); const status = entry.status; + const workflow = resolveWorkflowFromHead(uwf, entry.head); items.push({ thread: threadId as ThreadId, - workflow: "", // Will be resolved later if needed + workflow: workflow ?? "", head: entry.head, status, currentRole: null, @@ -662,7 +663,7 @@ export async function cmdThreadList( statusFilter.includes("cancelled"); if (includeCompleted) { const activeIds = new Set(items.map((i) => i.thread)); - const completedItems = collectCompletedThreads(uwf.varStore, activeIds); + const completedItems = collectCompletedThreads(uwf, activeIds); items = items.concat(completedItems); }