Retries
Hot supports automatic retries for:
- Event handlers (
meta {on-event: "...", retry: ...}) - Scheduled functions (
meta {schedule: "...", retry: ...}) - Code tasks (
::hot::task/startwith::hot::task/TaskOptions({retry: ...}))
Retries for event handlers and scheduled functions are configured with the retry metadata field; code tasks pass the same retry shape inside TaskOptions.
retrydoes not apply to synchronous request/response surfaces like MCP tool calls and webhook invocations.
Retry Metadata
The retry field supports two forms.
Simple form:
retry: 3
Full form:
retry: {
attempts: 5,
delay: 5000,
backoff: "exponential",
max_delay: 120000,
jitter: true
}
| Field | Description | Default |
|---|---|---|
attempts (or simple number) | Maximum retry attempts | 0 (disabled) |
delay | Base delay between retries (ms) | 1000 |
backoff | Delay strategy: "fixed", "exponential", "linear" | "fixed" |
max_delay | Delay cap for backoff strategies (ms); note snake_case (max_delay) | 300000 |
jitter | Add random jitter (about +/-10%) | false |
Backoff formulas (attempt is 0-indexed, so 0 is the first retry):
"fixed":delay"exponential":delay * 2^attempt"linear":delay * (attempt + 1)
How Retries Execute
When a retryable run fails:
- Hot reads retry config from the metadata of the function that ran.
- If attempts remain, the run is updated to
pending_retry. - A new run of the same function is scheduled at
next_retry_at. - The retry run is linked to the original via
origin_run_id. - Retries stop on success or when attempts are exhausted.
Each handler of an event retries on its own. When several handlers share an event, one with retry retries on its own policy, one without isn't retried, and a retry runs only the handler that failed.
An event a run sends is a new event, so its handlers start at attempt 0 with their own retry, whichever attempt sent it.
In Hot App, retries are shown with retry badges (for example ↻1, ↻2) and linked run history.
Limits and Clamping
Retry values are clamped to configured platform limits:
| Setting | Config Key | Environment Variable | Default |
|---|---|---|---|
| Max attempts | hot.retry.max-attempts | HOT_RETRY_MAX_ATTEMPTS | 10 |
| Max delay | hot.retry.max-delay-ms | HOT_RETRY_MAX_DELAY_MS | 3600000 (1 hour) |
| Default delay | hot.retry.default-delay-ms | HOT_RETRY_DEFAULT_DELAY_MS | 1000 |
Delays below the 100ms minimum floor are raised to 100ms, and values above configured limits are capped.