Resume a failed run from a chosen step instead of retrying the whole task #428

Closed
opened 2026-10-27 13:36:17 +00:00 by sam · 0 comments
Owner

Purpose

When a long run fails at step 7 (say, the repository gate after a 10 minute build), the only remedy today is Retry, which re-runs the whole task from step 1. An operator must be able to resume a failed run from the failed step (or a chosen earlier step), keeping the work and results of the steps before it.

Today

  • Retry is a task action (internal/domain/taskactions, retry modes in internal/taskstate/taskstate.go: refresh_onto_base, continue_pushed_work). A retried attempt runs the pinned workflow from its first step.
  • Step results that later steps reference ({{ steps.<id>.summary }}, .result) live only in memory on TaskContext.stepResults (internal/domain/workflow/step_refs.go, step_flow.go). A resumed run would have no results for the skipped steps, so their references would render empty.
  • Worktree state survives a retry only for pushed work (continue_pushed_work); uncommitted changes from earlier steps do not.

Build

  1. Persist each finished step's StepResult (summary, structured result) with the step execution, through the State Store contract (this is a State Store SQL semantics change, so it needs a test: AGENTS.md).
  2. Add a resume point to retry: resume_from (a step name/position from the pinned definition). The engine skips steps before it, loading their persisted results into stepResults, and starts at it. Refuse a resume point the pinned definition does not have.
  3. Worktree: resuming requires the work of earlier steps. Decide (and record in the bead) between requiring continue_pushed_work and restoring the step's worktree state; the cheapest correct option is to allow resume only when earlier steps' changes were committed and pushed, and say so in the UI.
  4. Canvas: on a failed or parked watched run, the failed step's right-click menu and its Run details offer "Resume from here"; earlier steps offer "Re-run from here". Both go through the existing task action endpoint.

Context every agent needs

  • The Workflows page (ui/src/workflows/WorkflowsPage.vue, WorkflowEditor.vue) is archie-core's main operator surface: a Vue Flow canvas (WorkflowCanvas.vue, nodes in StepNode.vue, layout in workflow-graph.ts) that both edits a workflow definition and watches its runs. Edits are edits to the YAML document (workflow-edit.ts), so the canvas and the YAML tab never disagree. Read WORKFLOWS.md (repo root) for the workflow language.
  • The watched run comes from useWorkflowRuns (workflow-runs.ts): GET /api/tasks filtered by workflow, and GET /api/tasks/{id}/attempts for its recorded steps (stage rows: name, status ok|failed|interrupted|running, duration_ms, error). A step is recorded under its id, else its type. Live refresh is useLiveResource("tasks", ...) over the SSE stream.
  • Slide-in panels over the right edge of the canvas (StepEditor.vue, WorkflowSettings.vue) are the pattern for details and editing. Do not add a permanent side panel.
  • UI bar the maintainer has set (memory: canvas UI taste): direct manipulation (right-click menus, inline + points, panels that open on demand), no instructional filler text, the field that matters first, help text on hover, nothing that makes the page scroll when the canvas could pan. Drive every change in a headless browser (Playwright with the system Chrome works; stub /api/** with page.route) and look at screenshots at 1920x947 before calling it done.
  • AGENTS.md rules apply: cheapest change first, services own contracts (the dashboard reaches other services only through archie-ui's HTTP API and their gRPC contracts), no new binaries, regenerate and commit ui/dist with the change, task check gates the commit, tests only for the seams AGENTS.md lists.

Acceptance criteria

  • A tdd run failed at its final gate can be resumed from that step; the steps before it are not re-run and their results (e.g. steps.analyse.summary) are available to the resumed steps.
  • A resume point not in the pinned definition, or one that needs unpushed work, is refused with a clear reason.
  • The State Store change has a test that fails without it.
  • Canvas offers Resume/Re-run from a step on failed or parked runs only. task check passes.

Notes

Worktree decision: resume requires pushed work. A retry with resume_from on a task with a repository forces continue_pushed_work and is refused when the task has no pushed branch; worktree state is not restored. Resume points are stage names (step id, else type); a name two top-level steps share is refused, so the tdd commits got ids (commit-repro, commit-fix).

Close reason

Resume/re-run from a step: step results persisted per stage, retry carries resume_from, engine skips earlier steps with results loaded; canvas menu and Run panel offer it on parked runs. State Store test covers the resume read.


Imported from beads archie-core-t19m.6 · GitHub #1403 · type feature · priority P1 · created 2026-10-05 · closed 2026-10-05

## Purpose When a long run fails at step 7 (say, the repository gate after a 10 minute build), the only remedy today is Retry, which re-runs the whole task from step 1. An operator must be able to resume a failed run from the failed step (or a chosen earlier step), keeping the work and results of the steps before it. ## Today - Retry is a task action (`internal/domain/taskactions`, retry modes in `internal/taskstate/taskstate.go`: `refresh_onto_base`, `continue_pushed_work`). A retried attempt runs the pinned workflow from its first step. - Step results that later steps reference (`{{ steps.<id>.summary }}`, `.result`) live only in memory on `TaskContext.stepResults` (`internal/domain/workflow/step_refs.go`, `step_flow.go`). A resumed run would have no results for the skipped steps, so their references would render empty. - Worktree state survives a retry only for pushed work (`continue_pushed_work`); uncommitted changes from earlier steps do not. ## Build 1. Persist each finished step's `StepResult` (summary, structured result) with the step execution, through the State Store contract (this is a State Store SQL semantics change, so it needs a test: AGENTS.md). 2. Add a resume point to retry: `resume_from` (a step name/position from the pinned definition). The engine skips steps before it, loading their persisted results into `stepResults`, and starts at it. Refuse a resume point the pinned definition does not have. 3. Worktree: resuming requires the work of earlier steps. Decide (and record in the bead) between requiring `continue_pushed_work` and restoring the step's worktree state; the cheapest correct option is to allow resume only when earlier steps' changes were committed and pushed, and say so in the UI. 4. Canvas: on a failed or parked watched run, the failed step's right-click menu and its Run details offer "Resume from here"; earlier steps offer "Re-run from here". Both go through the existing task action endpoint. ## Context every agent needs - The Workflows page (`ui/src/workflows/WorkflowsPage.vue`, `WorkflowEditor.vue`) is archie-core's main operator surface: a Vue Flow canvas (`WorkflowCanvas.vue`, nodes in `StepNode.vue`, layout in `workflow-graph.ts`) that both edits a workflow definition and watches its runs. Edits are edits to the YAML document (`workflow-edit.ts`), so the canvas and the YAML tab never disagree. Read `WORKFLOWS.md` (repo root) for the workflow language. - The watched run comes from `useWorkflowRuns` (`workflow-runs.ts`): `GET /api/tasks` filtered by workflow, and `GET /api/tasks/{id}/attempts` for its recorded steps (stage rows: name, status ok|failed|interrupted|running, duration_ms, error). A step is recorded under its `id`, else its type. Live refresh is `useLiveResource("tasks", ...)` over the SSE stream. - Slide-in panels over the right edge of the canvas (`StepEditor.vue`, `WorkflowSettings.vue`) are the pattern for details and editing. Do not add a permanent side panel. - UI bar the maintainer has set (memory: canvas UI taste): direct manipulation (right-click menus, inline + points, panels that open on demand), no instructional filler text, the field that matters first, help text on hover, nothing that makes the page scroll when the canvas could pan. Drive every change in a headless browser (Playwright with the system Chrome works; stub `/api/**` with `page.route`) and look at screenshots at 1920x947 before calling it done. - AGENTS.md rules apply: cheapest change first, services own contracts (the dashboard reaches other services only through archie-ui's HTTP API and their gRPC contracts), no new binaries, regenerate and commit `ui/dist` with the change, `task check` gates the commit, tests only for the seams AGENTS.md lists. ### Acceptance criteria - A tdd run failed at its final gate can be resumed from that step; the steps before it are not re-run and their results (e.g. steps.analyse.summary) are available to the resumed steps. - A resume point not in the pinned definition, or one that needs unpushed work, is refused with a clear reason. - The State Store change has a test that fails without it. - Canvas offers Resume/Re-run from a step on failed or parked runs only. `task check` passes. ### Notes Worktree decision: resume requires pushed work. A retry with resume_from on a task with a repository forces continue_pushed_work and is refused when the task has no pushed branch; worktree state is not restored. Resume points are stage names (step id, else type); a name two top-level steps share is refused, so the tdd commits got ids (commit-repro, commit-fix). ### Close reason Resume/re-run from a step: step results persisted per stage, retry carries resume_from, engine skips earlier steps with results loaded; canvas menu and Run panel offer it on parked runs. State Store test covers the resume read. --- _Imported from beads `archie-core-t19m.6` · GitHub #1403 · type feature · priority P1 · created 2026-10-05 · closed 2026-10-05_
sam added the highfeature labels 2026-10-27 13:36:17 +00:00
sam self-assigned this 2026-10-27 13:36:17 +00:00
sam closed this issue 2026-10-27 13:36:17 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#428