Workflow execution model
Define run and step states before implementing a scheduler.
Proposed run states
Pending → Planning → Ready → Executing. Executing may pause in Awaiting Approval before a consequential action or final release. Approval returns the run to Executing; successful validation and delivery end in Completed. A terminal error or denied required action ends in Failed with a reason.
Step states and dependencies
A run may contain completed steps while the overall run is still executing. A step becomes ready when all required upstream outputs are available and validated. Persist attempt numbers, input/output references, and transition timestamps; do not use the UI progress indicator as the source of truth.
Retry semantics
Use bounded retries for transient reads. For writes, attach an idempotency key and determine whether the adapter supports reliable deduplication. If an external response is ambiguous, pause for reconciliation instead of repeating the action. Invalid schemas and denied permissions are not retryable failures.
Approval is revision-specific
Approval covers a named action, payload, destination, and run revision. An edited destination or changed report requires a new decision. An expired approval or lost authorization must prevent execution even if a previous browser tab still shows an approve button.