> For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt.

# Timeouts, retries and failures

```yaml
version: 0
on: [push]
jobs:
  test:
    timeout: 30m
    retry:
      - {exit_codes: [137], max: 2}
      - {when: [timeout, error]}
    image: alpine:3.22
    steps:
      - run: ./integration-tests.sh
        timeout: 10m
  lint:
    allow_failure: true
    image: alpine:3.22
    steps:
      - run: ./lint.sh
      - run: ./check-links.sh
        allow_failure: {exit_codes: [2]}
```

## Timeouts

`timeout:` says how long a job, or a step, may run. When it runs out, the running step gets SIGTERM, then SIGKILL 10 seconds later, with every process it started. The step and its job end `timed_out`, which reads as `failure` in CEL. A job without `timeout:` gets 6 hours, or the server's `HOD_JOB_TIMEOUT`; `HOD_MAX_JOB_TIMEOUT` caps every job.

## Retries

`retry:` runs a job that didn't succeed again, as a new attempt, on any runner. It is a list of rules; the first one that matches and has attempts left runs the job again. `retry: 3` is short for `[{max: 3}]`.

| Key          | Default   |                                                                                         |
| ------------ | --------- | --------------------------------------------------------------------------------------- |
| `when`       | all three | `failure` (a step failed), `timeout`, `error` (setup, storage, checkout, a lost runner) |
| `exit_codes` |           | Only failures of a step that exited with one of these                                   |
| `max`        | `2`       | More attempts this rule allows, at most 10                                              |

Cancelled and superseded jobs are never retried, and neither are jobs that fail with reason `config` (an image that doesn't exist, say) or `bad_output`.

## Allowed failures

`allow_failure: true` allows every failure, timeout and error; `{exit_codes: [...]}` allows failures of a step that exited with one of those codes. A job allowed to fail keeps its real result, marked allowed, and reads as a success everywhere else: the jobs that need it run, `jobs.<name>.result` is `"success"`, and the run can succeed. It has no outputs.

On a step, the step's failure doesn't fail the job, and later steps run. Retries come first: only a failure no rule retries is allowed.
