Repository navigation
Description
Agreed design as of 2026-10-02, amended the same day (failures are retriable or not, replacing Transient; the Skipped outcome). The original proposal is kept at the end.
Steps: what a step is and how it runs (tier 1)
Builds on the premises of proposal 0002 (Foundations).
Building a step
- Built on demand, once per attempt. The implementation builds a fresh step for every attempt by calling its constructor. Nothing carries over from a failed attempt.
- Declared needs. The constructor's parameters declare what the step needs:
- inputs, each identified by a key local to the step, a type (the format the step wants), and whether it is required or optional;
- a contributor, through which it contributes data back;
- a step reporter, through which it emits its own events (Events #11).
- Inputs are resolved outside the step, through the workflow's input adapters or the data bag, as Foundations defines. The step's own code never sees the adapter, the data bag or the resolver.
- A step does not know its own name. Its name is how the workflow refers to it, which is workflow knowledge. A step that needs a label receives it as an ordinary input. (A step policy may request the name of the step it acts on, as Foundations allows.)
Two different failures
- Building fails: the journey is aborted. If a step cannot be built, because an input is missing or of the wrong type, an adapter fails, the constructor fails, or anything else, the journey is aborted. The workflow author is responsible for providing everything a step needs; a run in which a step cannot be built is unsafe.
- Running fails: an abnormal termination. Once built, a step that lets an error, an exception or a panic escape ends with an abnormal termination. Nobody knows whether trying again would help, so by default it is treated like a retriable failure (Running a workflow #9, Hooks, lifecycles and workflow roles #10). The error is all the hooks receive.
These two look alike in code but behave very differently, and the specification states both explicitly.
Outcomes
-
An outcome states what happened, never what to do next. Running a step ends with one of:
- Success: the step completed;
- Failure: the step could not complete;
- Skipped: the step decided, from what it knows of its domain, not to do its work, for example because no discount applies to this order.
-
A failure is not retriable unless the step says it is. Every failure carries a retriable flag, false by default:
- not retriable: trying again would not help, for example a declined card. By default the journey fails;
- retriable: trying again might help, for example an unreachable service. By default the step is tried again while its retry budget lasts.
The flag is something the step knows about its domain, a suggestion and not a decision. Whether a retriable failure is actually tried again depends on the step's retry configuration, the hooks, and the executor (Running a workflow #9, Hooks, lifecycles and workflow roles #10). Because the default is not retriable, forgetting the flag causes a clear failure, never an unintended retry.
-
A failure carries a reason: a code (a string, which hooks and conformance cases compare), an optional message, and optional serializable details (for example a decline code). Declaring each step's set of codes in advance may come later.
-
Errors the author anticipates become failures. Step authors handle the errors they expect and turn them into failures, retriable or not. Anything that escapes is an abnormal termination (item 6).
-
What hooks can request: the failure hook can request the failure's reason; the hook reacting to an abnormal termination can request the error; the retry hook can request the reason of a retriable failure, or the error. When the retry budget is exhausted, the failure hook is called and its cause says "retries exhausted".
Skipped
- A skipped step is out of the flow. No hook reacts to it, and no lifecycle can follow it: the executor moves straight to the next step. A journey whose steps all ended as succeeded or skipped succeeds.
- A skip may carry a reason, with the same shape as a failure's (code, message, details), recorded in the "step skipped" event (Events #11).
- A skipped step has no effect on data. Anything it contributed is discarded, and an event records that it was. A later step that requires a key the skipped step would have contributed aborts the journey; if the key is optional, it is absent (Foundations).
- A skipped step is final. Its status is
Skipped(Running a workflow #9); like a succeeded step, it is never run again, and the journey result lists it as skipped. - Only the step decides to skip. Hooks cannot skip steps (Running a workflow #9). A future hook that runs before a step and decides whether it runs would have to change that rule explicitly, and would record its decision as skipped by policy, distinct from a step that skipped itself.
Contributions
- Contributions are dynamic. The contributor accepts a key and a value; keys are not declared in advance, and the workflow knows everything a step contributed when the step returns.
- The same key twice in one attempt: the last value wins.
- Visible to hooks, committed only on success. Any outcome can carry the contributor. Contributions are visible to that attempt's hooks whatever the outcome, and are committed to the data bag only on success. A failed attempt's contributions, retriable or not, never reach later steps or the result. An abnormal termination carries no contributions.
- Overwriting the data bag is allowed and visible. A committed contribution may replace a key already in the bag, from the initial data or an earlier step; the last committed value wins, and the engine emits an event recording the overwrite (Events #11).
- Any value the language can hold. In tier 1, a contribution may be any value; a wrong type is caught when it is read, which aborts the journey (Foundations). Serializable values become a requirement only with durable runs. Conformance cases use only the neutral types.
- Data that was never contributed. A hook or anything else requesting a key the step did not contribute aborts the journey if the request is required, and receives it absent if optional (Foundations).
Identity and execution mode
- A step's name is any non-empty string, case-sensitive, and unique within its workflow. A duplicate name is refused at admission.
- Execution mode. A step is either synchronous or asynchronous. Which executors accept which mode is in The local executor #12.
Not in tier 1
- Timeouts enforced by the executor. The executor never interrupts a running step: it is not a low-level runtime that cancels futures or kills threads. A step handles its own time limits and reports a failure, retriable or not, when they are exceeded. A later tier may add a measured time limit: after a step returns, the executor compares its duration with an allowed one and fails it if it was exceeded, without ever interrupting it.
- A hook that runs before a step and may decide it does not run belongs to a later tier.
- The Pending outcome belongs to durable runs.
- Failures that end the process (out of memory, stack overflow) cannot be caught by any executor; durable runs will handle them.
Tier
Original proposal
Summary
What a step is and how it runs, in tier 1: how it is built, what it declares, what it returns, and what happens to the data it contributes. Builds on the premises in #2.
Proposal
- Built on demand, once per attempt. The implementation builds a fresh step for every attempt by calling its constructor. No state carries over from a failed attempt.
- Declared needs. The constructor's parameters declare what the step needs:
- inputs, each identified by a key local to the step and a type, which is the format the step wants;
- a contributor, through which it contributes data back;
- a step reporter, through which it emits its own events (see Events #11).
- Inputs are resolved outside the step. Before calling the constructor, the implementation resolves each input through the step's adapter (Foundations: step isolation, declarative workflows, policies and data flow #2, premise 6). The step's own code never sees the adapter, the data bag or the resolver.
- Outcomes. Running a step ends with one of:
- Success;
- Failure, with a reason. Failure is terminal: the workflow will fail;
- Transient: something temporary went wrong. Whether to retry is decided by policy, not by the step.
- Errors are abnormal terminations. Step authors handle the errors they anticipate and turn them into outcomes. Anything that escapes as an error, an exception, a panic or a timeout is an abnormal termination, and the error is all the hooks receive.
- Contributions. The contributor accepts a key and a value. Any outcome can carry the contributor. Contributions are visible to that attempt's hooks whatever the outcome, and are committed to the data bag only on success. An abnormal termination carries no contributions.
- Identity. Within a workflow, a step is identified by its name, which is unique in that workflow.
- Execution mode. A step is either synchronous or asynchronous. Which executors accept which mode is in The local executor #12.
Activity
marlon-sousa commentedon Oct 1, 2026
marlon-sousa commentedon Oct 2, 2026
Claude summary
Posted by Claude (Claude Code) from a maintainer's account, as described in PROCESS.md.
Evaluated with the maintainer outside the thread on 2026-10-02; every question was settled. The issue body now holds the agreed design, with the original proposal kept at the end. The comment carrying decisions over from #2 is folded in and hidden as outdated.
Decided in the evaluation: building failures abort the journey while running failures are abnormal terminations; Failure and Transient carry a reason (code, message, details); timeouts are left out of tier 1; the same key twice in one attempt keeps the last value; overwriting the data bag is allowed and emits an event; contributions may be any value in tier 1; a step does not know its own name; step names are non-empty, case-sensitive and unique.
The conformance checklist is updated in itinera-dev/conformance#8. This proposal is ready for a maintainer to set
status: ready.Steps: the executor never interrupts a running step
github-actions commentedon Oct 2, 2026
Accepted on 2026-10-02 in #23.
marlon-sousa commentedon Oct 2, 2026