FN-6281: add bounded graph resume retries

Add a narrow persisted retry path for transient workflow-graph failures during resume after restart or unpause.

- Persist graphResumeRetryCount with schema migration, store round-tripping, manual retry reset, and task serialization coverage.
- Retry only no-progress execute-seam graph failures immediately following resume markers, then clear transient status/error and re-run within a capped budget.
- Preserve terminal graph failure handling for explicit reasons, durable task failures, completed progress, non-resume cases, and exhausted retry budgets.
- Document the resume-limbo retry contract and add a patch changeset for @runfusion/fusion.

Files changed:
 .changeset/fn-6281-graph-resume-retry.md           |   5 +
 docs/architecture.md                               |   1 +
 packages/core/src/__tests__/db-migrate.test.ts     |  30 +--
 packages/core/src/__tests__/db.test.ts             |  44 ++---
 packages/core/src/__tests__/goals-schema.test.ts   |   2 +-
 packages/core/src/__tests__/insight-store.test.ts  |  10 +-
 .../core/src/__tests__/manual-retry-reset.test.ts  |   1 +
 .../src/__tests__/merge-request-record.test.ts     |   2 +-
 packages/core/src/__tests__/mission-store.test.ts  |   2 +-
 packages/core/src/__tests__/run-audit.test.ts      |   4 +-
 .../core/src/__tests__/store-merge-queue.test.ts   |   2 +-
 .../core/src/__tests__/store-persistence.test.ts   |  22 +++
 packages/core/src/__tests__/task-documents.test.ts |   2 +-
 packages/core/src/db.ts                            |  10 +-
 packages/core/src/manual-retry-reset.ts            |   1 +
 packages/core/src/store.ts                         |  14 +-
 packages/core/src/types.ts                         |   5 +
 .../engine/src/__tests__/executor-recovery.test.ts | 201 +++++++++++++++++++++
 packages/engine/src/executor.ts                    |  54 ++++++
 19 files changed, 359 insertions(+), 53 deletions(-)

Fusion-Task-Id: FN-6281

Fusion-Task-Lineage: f9061445-8624-465a-9255-c3d02eac1bdb
This commit is contained in:
gsxdsm
2026-06-12 11:10:12 -07:00
parent 36ba1b9d68
commit 0897b2a0bf
19 changed files with 359 additions and 53 deletions

View File

@@ -1269,6 +1269,7 @@ The columns/traits track moved *board* policy (transitions, capacity, hold, merg
- A `parse-steps` node reads a workflow-declared **artifact** (PROMPT.md is just the default workflow's declared `step-source` artifact) and runs a registry **parser** (`step-headings`, `json-steps`, or a plugin-contributed parser) to write `Task.steps[]`. It is the only graph-side step-list writer and must dominate any `foreach`. Parsers fail closed to a routable `outcome:parse-error`.
- A `foreach(source:"task-steps")` node instantiates an inline template subgraph once per planned step, with `mode` (sequential/parallel) and `isolation` (shared/worktree) as explicit axes and per-instance run-state pinned + persisted for crash-safe resume.
- Resume-limbo graph failures are retried only through a narrow persisted counter (`Task.graphResumeRetryCount`, max 2). The executor classifies a failure as transient only when it happens immediately after the engine restart/unpause resume log marker, reports no graph `reason`, has no completed step progress, and the task has no durable `lastError`/`failureReason`; it clears transient `status`/`error`, logs the auto-retry, and schedules one more graph execution. Any explicit graph reason, completed step progress, durable task error, missing resume marker, or exhausted counter remains a genuine `status:"failed"` disposition and goes to review handoff, preserving the FN-5704 anti-loop contract.
- A `step-review` node surfaces reviewer verdicts (APPROVE/REVISE/RETHINK/UNAVAILABLE) as outcome edges; `rework` edges (the only legal graph cycles, bounded per instance) route REVISE/RETHINK back to `step-execute`, with RETHINK traversal triggering the reset seam.
- A `code` node runs sandboxed TypeScript (esbuild + child process, clamped timeout, no store handle) for arbitrary computed routing/field logic — the same trust tier as project-local script steps.