From 5a0117a362dacdc7a56e7ded04695f3622ecf6d3 Mon Sep 17 00:00:00 2001 From: Fusion Agent Date: Wed, 19 Aug 2026 07:18:50 +0000 Subject: [PATCH] FN-031: add task reset lifecycle handling Add durable task reset lifecycle support across core, dashboard, and engine integrations. - Add reset lifecycle publication and disposal primitives with coverage. - Expose reset lifecycle behavior through task workflow routes and dashboard task details. - Update workflow intake, engine exports, and worktree integration documentation. Files changed: docs/dashboard-guide.md | 8 + .../postgres/task-reset-publication.pg.test.ts | 99 +++++++ .../core/src/__tests__/task-move-disposer.test.ts | 52 +++ packages/core/src/index.gate.ts | 6 + packages/core/src/index.ts | 6 + packages/core/src/store.ts | 6 + packages/core/src/task-store/reset-lifecycle.ts | 193 ++++++++++++++ packages/core/src/tasks/task-move-disposer.ts | 25 ++ .../dashboard/app/components/TaskDetailModal.tsx | 8 +- .../components/__tests__/TaskDetailModal.test.tsx | 28 +- .../__tests__/plan-approval-intake-column.test.ts | 80 ++---- .../src/__tests__/task-reset-lifecycle.test.ts | 171 +++++++++++++ .../src/routes/register-task-workflow-routes.ts | 285 ++++++++++----------- packages/engine/src/index.ts | 10 +- packages/engine/src/worktree/worktree-backend.ts | 1 + 15 files changed, 766 insertions(+), 212 deletions(-) Fusion-Task-Id: FN-031 Fusion-Task-Lineage: 183bb709-485e-4069-bd2a-98f787b2bd73 Co-authored-by: Fusion --- docs/dashboard-guide.md | 8 + .../task-reset-publication.pg.test.ts | 99 ++++++ .../src/__tests__/task-move-disposer.test.ts | 52 ++++ packages/core/src/index.gate.ts | 6 + packages/core/src/index.ts | 6 + packages/core/src/store.ts | 6 + .../core/src/task-store/reset-lifecycle.ts | 193 ++++++++++++ packages/core/src/tasks/task-move-disposer.ts | 25 ++ .../app/components/TaskDetailModal.tsx | 8 +- .../__tests__/TaskDetailModal.test.tsx | 28 +- .../plan-approval-intake-column.test.ts | 80 ++--- .../__tests__/task-reset-lifecycle.test.ts | 171 +++++++++++ .../routes/register-task-workflow-routes.ts | 289 +++++++++--------- packages/engine/src/index.ts | 10 +- .../engine/src/worktree/worktree-backend.ts | 1 + 15 files changed, 768 insertions(+), 214 deletions(-) create mode 100644 packages/core/src/__tests__/postgres/task-reset-publication.pg.test.ts create mode 100644 packages/core/src/task-store/reset-lifecycle.ts create mode 100644 packages/dashboard/src/__tests__/task-reset-lifecycle.test.ts diff --git a/docs/dashboard-guide.md b/docs/dashboard-guide.md index 66bbccabf8..8db1d495b3 100644 --- a/docs/dashboard-guide.md +++ b/docs/dashboard-guide.md @@ -66,6 +66,14 @@ Both actions are irreversible; there is no undo after confirming. The dialog clo **Excluded sections.** Some sections are not a simple settings form and are intentionally excluded from **Reset this menu** (the button is disabled with an explanatory tooltip when one of these is the active section), because each already has its own dedicated management flow: **Secrets**, **MCP Servers** (global and project), **Plugins**, **Memory**, **Authentication**, **Prompts**, **CLI Agents**, and the **Hermes**/**OpenClaw**/**Paperclip** runtime sections. Runtime pages appear only when their runtime plugin is installed; an installed but disabled runtime stays visible so it can be inspected or re-enabled. Settings hides runtime pages while its installed-plugin list is loading or unavailable, then refreshes the navigation after plugin lifecycle changes while Settings remains open. **Reset all project settings** is unaffected by this exclusion list since it resets the underlying project settings values directly, not through any of those sections' own flows. +## Task Reset + + + +**Reset** is destructive and has no undo. After confirmation, Fusion fences active task work, removes only the task-owned standard worktree and the current `.fusion/tasks//PROMPT.md` plan, then atomically returns the same task to its workflow's **Planning/intake** column with pending steps and `needs-replan`. The task ID, title, description, dependencies, workflow selection, attachments, documents, logs/audit history, and branch history remain intact. + +Reset does not support workspace tasks or external/operator-owned, foreign, unsafe, or project-root worktrees. If cancellation, worktree removal, plan removal, runtime finalization, or durable publication fails, Fusion reports incomplete cleanup and does not claim success or expose the task to Planning; retry **Reset** after the reported problem is resolved. A plan-removal failure may leave the worktree already removed, but the stored task lifecycle state remains unchanged until a retry completes. Once the atomic publication commits, a task-file mirror problem is repaired separately and does not turn the successful reset into a false failure. + ## Keyboard shortcuts