Failure Handling
When a gate fails, theretry block determines what happens next. The retry relaunches the step from GET with the current state — which has changed (error context, gate results are now available).
Without retry
If a step has noretry, any gate failure is fatal — the run stops immediately.
Basic retry
{error}, {diff}, {gate.*} are now in the state.
Overrides
Each retry entry declares a condition and optional keyword overrides:Condition types
Each entry has exactly one condition:| Condition | Example | Description |
|---|---|---|
attempt: N | attempt: 4 | Applies from attempt N onward (sticky) |
not: <gate> | not: gate.test | Applies if the named gate failed |
validate: <workflow> | validate: validators/assess | Invokes a validator; applies if output = true |
exit: N | exit: 6 | Stop retrying at attempt N → step FATAL |
exit is mandatory — a retry without exit is a dry-run error.
Overridable keywords
Retry entries can override these keywords:agent— switch to a different agent (escalation)session— forcenew(automatic when agent changes)worktree—resettogit reset --hard+git clean -fdprompt— replace the entire prompt (disables automatic retry context injection)
Sticky behavior
Overrides are sticky: an override activated at attempt N stays active for N+1, N+2, etc. A later entry overriding the same keyword replaces it.| Attempt | Agent |
|---|---|
| 1–2 | claude-sonnet (from the step) |
| 3–4 | claude-sonnet-thinking (sticky) |
| 5–7 | claude-opus (sticky) |
Validator conditions
A workflow validator can be used as a retry condition — the “agent assess” pattern:with: (separate from the step overrides). If its output is true, the entry’s overrides apply.
What happens on retry
- The state is updated with error context (
{error},{diff},{gate.*}) - Previous iteration keys are moved to
prevnamespace - The step relaunches from GET with the updated state
- If
worktree: resetis active, the worktree is reset to pre-step state - If the prompt is not overridden, the context builder injects a retry section automatically
- If the prompt is overridden, no automatic injection — the developer controls everything
Safety validations
| Rule | Behavior |
|---|---|
New agent without session: new | Gump forces session: new + warning |
worktree: reset with same session | Warning |
No exit: declared | Error at dry-run |