Skip to Content
Runlane
Understand Runlane

Retries, waits, and recovery

Choose the right way to continue work after it stops.

Several paths can lead to another task attempt. They are not interchangeable because each one records a different reason.

PathUse it whenWhat Runlane records
RetryThe task failed and trying again may workFailure, retry count, and next due time
ReleaseThe task is waiting for an expected conditionA successful pause without failure or retry cost
SignalSomething should wake current matching waitersA one-time wakeup, not a stored result
TokenAn external result must remain readableA durable pending, completed, or timed_out decision
External abort interruptionThe execution or delivery signal aborts after claim, then the attempt throwsNo retry cost. See Stop crash loops for the interruption allowance.
RecoveryDelivery or ownership stopped making progressFramework repair of the existing run

Retry failures

A retry follows a task failure. Every run requires the task's execution-policy snapshot saved at acceptance, so a deployment does not change its retry budget or delay. Runs without the snapshot fail to decode. Earlier failures stay in history even if a later attempt succeeds. See stored execution policy for the boundaries and upgrade requirements.

retry.maxRetries bounds automatic retries after failures. context.attempt counts every start, so a run can have more attempts than its retry budget. See the retry counting rules.

Use retry failed work for temporary failures.

Release expected waits

A release ends the current attempt without recording a task failure or spending retry budget. The task can wait until a time, for a signal, for a durable token, or for another run.

Await context.step.sleep(), context.step.waitForSignal(), context.wait.until(), context.wait.forToken(), or context.join() to wait for a result. Use return context.release(...) to check state from the top after a delay. The next attempt starts the handler from the beginning. Keyed sleeps and signal waits return their saved outcomes on replay. Joins, token waits, and signal waits expose ok; .unwrap() returns output or fails the parent with a non-retryable error. Timed token windows replay earlier timeouts so reminder loops follow the same path. wait.until() needs no checkpoint because the passed date remains passed. Use durable steps or idempotency when earlier side effects must not run again. Follow wait without failing for the available wait types.

Use signals and tokens for different jobs

A signal wakes runs that are already waiting on the same key. It does not retain a value for a future waiter.

A token stores one terminal result and can resume every retained run link in bounded batches. Use it for approvals and other decisions that must remain inspectable. See human-in-the-loop flows.

Let recovery repair the same run

Recovery handles framework state such as expired worker leases, deferred outbox publishing, abandoned cancellation, and fixed attempt deadlines. It preserves a lifecycle change that won the race before recovery.

When both a lease and a fixed attempt deadline have expired, timeout finalization wins. Reacquiring the run first would clear the deadline and lose the durable timeout result. Unlike an expired lease alone, an attempt timeout records a failure and uses the retry policy.

Maintenance connects due work back to delivery. Polling workers can find due work in storage. Transport deployments need maintenance to create and publish a fresh wakeup. Completing a token or reaching a due time does not itself send an SQS message.

If work stays stuck, use observe and recover runs. More retries will not fix missing maintenance, and a replacement trigger will lose the original run's audit link.

Interruptions and durable progress

The interruption allowance limits how often work can restart after a crash or platform time limit. See Stop crash loops for the rules and settings.

Invocation handoff

Providers with invocation budgets may yield before the next unsaved durable operation once 25% of the invocation budget remains (contractDefaults.delivery.handoffReserveFraction). This handoff requires a new checkpoint in the current attempt, drains concurrent operations, and requeues immediately. Cancellation and attempt deadlines still win.

Once any operation observes that the attempt is eligible for handoff, unsaved step.run() callbacks that have yet to start wait for the next attempt. This applies even if another operation has already selected a different pause or the step read the run before the first checkpoint was saved.

If a named child wait selects handoff, it parks before preparing its missing children. The next attempt reaches the wait again and can create those children. A sibling wait that was already admitted can finish preparing its missing children during handoff. Those children become visible in the same commit that releases the parent and saves its wakeup. Eager transport delivery then tries to publish the wakeups. A delivery that defers refill leaves them for maintenance.

On this page