Workflow run endings: the first step that sets an outcome ends the run #2042

Closed
opened 2026-11-17 07:29:40 +00:00 by sam · 1 comment
Owner

Child of #2037. Plan: workflow vocabulary on the durable engine, one requirement per child.

A step that sets an outcome ends the run; workflow.finish (completed, declined, waiting for approval) is the first such type. Resume-at-step and the needs-a-person state stay with #2036.

Done when: a workflow.finish under a when ends the run with its status and detail.

Child of #2037. Plan: workflow vocabulary on the durable engine, one requirement per child. A step that sets an outcome ends the run; `workflow.finish` (completed, declined, waiting for approval) is the first such type. Resume-at-step and the needs-a-person state stay with #2036. Done when: a workflow.finish under a when ends the run with its status and detail.
sam added the featurehigh labels 2026-11-17 07:29:40 +00:00
sam added a new dependency 2026-11-17 07:29:53 +00:00
Author
Owner

Built in a88f5630f, fb5f3ad47 and 7b6154e7e (migration 00044).

  • workflow.finish takes status (completed, parked, waiting_approval or declined) and detail, ported from internal/domain/workflow/finish_step.go. An unknown status is rejected when the workflow is saved.
  • The first step that sets an outcome ends the run. A failed step parks the run, with the reason in detail, unless it has on_failure: continue. A run that completes every step ends completed, with the last step's summary as its detail. This follows "How a run ends" in WORKFLOWS.md.
  • New run states parked, waiting_approval and declined, and a detail column.
  • A parked run retries from a top-level step with POST /api/runs/{id}/retry (optional from). Earlier steps replay from the journal without repeating their effects. Everything recorded from the retry step onwards is discarded, including the started markers. The run page shows Detail and a Retry button for parked runs.

Verified: the TestDocumentStepsRun table gained cases for parking, continue, finish (including under a false when), the last summary as detail, and retry keeping earlier results. With the finish step disabled, the finish cases failed. task check passed on the merged tree.

Left for #2036 and #2037: resuming a waiting_approval run, a step picker for retry (it retries from the step that parked the run), and parking rather than failing a run whose agent step stops part-way.

Built in a88f5630f, fb5f3ad47 and 7b6154e7e (migration 00044). - `workflow.finish` takes `status` (completed, parked, waiting_approval or declined) and `detail`, ported from `internal/domain/workflow/finish_step.go`. An unknown status is rejected when the workflow is saved. - The first step that sets an outcome ends the run. A failed step parks the run, with the reason in `detail`, unless it has `on_failure: continue`. A run that completes every step ends completed, with the last step's summary as its detail. This follows "How a run ends" in WORKFLOWS.md. - New run states `parked`, `waiting_approval` and `declined`, and a `detail` column. - A parked run retries from a top-level step with `POST /api/runs/{id}/retry` (optional `from`). Earlier steps replay from the journal without repeating their effects. Everything recorded from the retry step onwards is discarded, including the started markers. The run page shows Detail and a Retry button for parked runs. Verified: the `TestDocumentStepsRun` table gained cases for parking, continue, finish (including under a false `when`), the last summary as detail, and retry keeping earlier results. With the finish step disabled, the finish cases failed. `task check` passed on the merged tree. Left for #2036 and #2037: resuming a `waiting_approval` run, a step picker for retry (it retries from the step that parked the run), and parking rather than failing a run whose agent step stops part-way.
sam closed this issue 2026-11-21 03:51:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#2042