Skip to content

TASK-001D: Workflow Orchestration

Goal

Implement the application-layer orchestration for connect, load recipe, home, start, stop, abort, fault, and recovery so the first slice has a coherent runtime model and terminal behavior.

Scope

  • implement the central state store or owned mutation path
  • implement application commands or handlers for connect, load recipe, home, start, stop, abort, acknowledge, and recover or reset
  • implement workflow transitions and terminal behavior
  • create exactly one run summary for each terminal run outcome

Non-Scope

  • final operator UI polish
  • advanced diagnostics pages
  • detailed streaming backpressure implementation beyond what this task strictly needs

AI Execution Profile

  • Model class: High-capability
  • Reasoning effort: High
  • Use this on: your strongest reasoning model
  • This is the most logic-sensitive task in the pack

Files Or Areas Expected To Change

  • Application state store or equivalent
  • workflow orchestration services
  • command handlers
  • run lifecycle and summary creation

Acceptance Targets

  • command guards and state transitions follow the requirements exactly
  • stop, abort, and fault lead to distinct terminal outcomes
  • recovery behavior is explicit
  • exactly one terminal run summary is produced

Copy/Paste Prompt

text
Implement only TASK-001D: Workflow Orchestration in this repository.

Read first:
- docs/requirements.md
  Focus on Sections 6.8, 7.5, 7.9, 7.10, 7.12, 9.5, 12.1 through 12.6, and 13.2
- docs/adrs/ADR-001-use-central-app-state-store.md
- docs/specs/SLICE-001-first-strong-vertical-slice.md
  Focus on Runtime Behavior, Stop, Abort, Critical Faults And Recovery, and Acceptance Criteria
- docs/tasks/slice-001/TASK-001D-workflow-orchestration.md

Goal:
- Implement the application-layer orchestration and owned state transitions for the first slice.

Scope:
- Implement the central app state store or equivalent owned mutation path.
- Implement commands/handlers for connect, load recipe, home, start, stop, abort, acknowledge, and recover/reset.
- Enforce start preconditions.
- Implement workflow transitions for normal completion, stop, abort, and fault.
- Create exactly one terminal run summary per run.

Do not:
- Build advanced UI
- Expand into future features
- Invent alternate workflow state names
- Hide stop/abort/fault differences behind one generic cancellation path

Critical constraints:
- Stop, abort, and fault must remain behaviorally distinct.
- Recovery must require explicit operator action after the unsafe condition is cleared.
- UI must not become the workflow coordinator.

Verification:
- Build if possible
- Add or update tests for terminal state behavior if practical within this task
- Summarize transition rules implemented
- Explicitly call out how stop differs from abort and fault

Important:
- Implement only this task
- Do not preemptively implement later tasks

Docs-first project memory for AI-assisted implementation.