fix: resolve workflow from CAS chain in collectCompletedThreads
CI / check (pull_request) Failing after 1m28s
CI / check (pull_request) Failing after 1m28s
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
This commit is contained in:
@@ -585,19 +585,20 @@ async function collectActiveThreads(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function collectCompletedThreads(
|
function collectCompletedThreads(
|
||||||
varStore: VarStore,
|
uwf: UwfStore,
|
||||||
activeIds: Set<ThreadId>,
|
activeIds: Set<ThreadId>,
|
||||||
): ThreadListItemWithStatus[] {
|
): ThreadListItemWithStatus[] {
|
||||||
const items: ThreadListItemWithStatus[] = [];
|
const items: ThreadListItemWithStatus[] = [];
|
||||||
const history = loadHistoryThreads(varStore);
|
const history = loadHistoryThreads(uwf.varStore);
|
||||||
const seen = new Set<ThreadId>(); // Deduplication (issue #470)
|
const seen = new Set<ThreadId>(); // Deduplication (issue #470)
|
||||||
for (const [threadId, entry] of Object.entries(history)) {
|
for (const [threadId, entry] of Object.entries(history)) {
|
||||||
if (!activeIds.has(threadId as ThreadId) && !seen.has(threadId as ThreadId)) {
|
if (!activeIds.has(threadId as ThreadId) && !seen.has(threadId as ThreadId)) {
|
||||||
seen.add(threadId as ThreadId);
|
seen.add(threadId as ThreadId);
|
||||||
const status = entry.status;
|
const status = entry.status;
|
||||||
|
const workflow = resolveWorkflowFromHead(uwf, entry.head);
|
||||||
items.push({
|
items.push({
|
||||||
thread: threadId as ThreadId,
|
thread: threadId as ThreadId,
|
||||||
workflow: "", // Will be resolved later if needed
|
workflow: workflow ?? "",
|
||||||
head: entry.head,
|
head: entry.head,
|
||||||
status,
|
status,
|
||||||
currentRole: null,
|
currentRole: null,
|
||||||
@@ -662,7 +663,7 @@ export async function cmdThreadList(
|
|||||||
statusFilter.includes("cancelled");
|
statusFilter.includes("cancelled");
|
||||||
if (includeCompleted) {
|
if (includeCompleted) {
|
||||||
const activeIds = new Set(items.map((i) => i.thread));
|
const activeIds = new Set(items.map((i) => i.thread));
|
||||||
const completedItems = collectCompletedThreads(uwf.varStore, activeIds);
|
const completedItems = collectCompletedThreads(uwf, activeIds);
|
||||||
items = items.concat(completedItems);
|
items = items.concat(completedItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user