Skip to content

Exceeding the iteration budget fails the run, it does not pause it

The rule

Normative: this is the rule
  1. A state update that would push the run's iteration count strictly past the configured maximum MUST NOT be applied.
  2. The budget's own last iteration MUST be allowed; only exceeding the maximum ends the run.
  3. The job of the node whose update would exceed the maximum MUST be recorded as failed, with the code MAX_ITERATIONS_EXCEEDED and three details: the configured maximum as max_iterations, the count the update would have reached as iteration_count, and the node as node_id.
  4. That failure escapes the node (ERR-3): it MUST NOT travel an error edge.
  5. It MUST NOT be retried (ERR-11).
  6. The run MUST end with the status failed, and its remaining work is handled as ORC-11 handles an unhandled failure.
  7. The run's terminalReason (PIPE-1) MUST carry the same code and details.
  8. This is a terminal verdict and not a pause.
  9. The run MUST NOT offer a resume handle.
  10. Its status MUST NOT be paused.
  11. This run-wide budget is not a loop's round budget (SG-7): a loop whose rounds are spent exits, and the run goes on.

What it means

Reaching the configured maximum is allowed; only going past it ends the run. A caller who sets the budget expecting the last permitted iteration to still happen is right — the guard only trips on the update that would push the count strictly beyond the maximum.

Where it does trip, the run fails. Its status is failed, the same terminal status every client already knows, so nothing keeps polling a run that is over. The reason is not a status of its own; it is a code. The node whose update would have gone over is the one whose job fails, with MAX_ITERATIONS_EXCEEDED, the maximum, the count it would have reached and its own id. Its update is not applied, so the run's state is the state of the last permitted iteration. The run carries the same code and details in its terminalReason (PIPE-1), so a client reads the reason without walking the jobs.

The failure escapes the node. An error edge cannot catch it and a retry cannot repeat it, for the same reason: a handler or a retry inside the loop would only spend another iteration and trip the budget again. What else was left to run is dealt with as for any unhandled failure (ORC-11).

Nothing about the verdict looks like a pause: no resume handle is offered, and the status is never paused. Nor is this a loop's own round budget (SG-7). A loop that has run its rounds simply stops going round, and the run carries on; this budget counts the whole run, and spending it ends the run.

Example

A run configured with a maximum of 5, whose node agent makes the update that would be the sixth iteration.

The run's status documentfailed
{
  "id": "6918",
  "status": "failed",
  "terminalReason": {
    "code": "MAX_ITERATIONS_EXCEEDED",
    "details": { "max_iterations": 5, "iteration_count": 6, "node_id": "agent" }
  }
}

The job of agent is failed with the same code and details, and its sixth update is not in the run's state.

Why

Recorded under OPEN-25, OPEN-57.

Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · SG-14 · changed in spec 1.1