feat(HAI-003): clear transient task fields when moving to done

- Clear status and worktree in moveTask when target column is done
- Clear transient status in completeTask before moving task to done
- Ensures done tasks don't retain stale status or worktree references
This commit is contained in:
Dustin Byrne
2026-03-25 20:04:05 -04:00
2 changed files with 8 additions and 0 deletions

View File

@@ -155,6 +155,12 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
task.column = toColumn;
task.updatedAt = new Date().toISOString();
// Clear transient fields when moving to done (matches moveToDone behavior)
if (toColumn === "done") {
task.status = undefined;
task.worktree = undefined;
}
const taskJsonPath = join(dir, "task.json");
this.suppressWatcher(taskJsonPath);
await writeFile(taskJsonPath, JSON.stringify(task, null, 2));

View File

@@ -224,6 +224,8 @@ async function completeTask(
taskId: string,
result: MergeResult,
): Promise<void> {
// Clear transient status before moving to done
await store.updateTask(taskId, { status: null });
// Use moveTask for proper event emission
const task = await store.moveTask(taskId, "done");
result.task = task;