Exceeding the iteration budget fails the run, it does not pause it
The rule
- A state update that would push the run's iteration count strictly past the configured maximum MUST NOT be applied.
- The budget's own last iteration MUST be allowed; only exceeding the maximum ends the run.
- The job of the node whose update would exceed the maximum MUST be recorded as
failed, with the codeMAX_ITERATIONS_EXCEEDEDand three details: the configured maximum asmax_iterations, the count the update would have reached asiteration_count, and the node asnode_id. - That failure escapes the node (ERR-3): it MUST NOT travel an error edge.
- It MUST NOT be retried (ERR-11).
- The run MUST end with the status
failed, and its remaining work is handled as ORC-11 handles an unhandled failure. - The run's
terminalReason(PIPE-1) MUST carry the same code and details. - This is a terminal verdict and not a pause.
- The run MUST NOT offer a resume handle.
- Its status MUST NOT be
paused. - 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.
{
"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.