Infrastructure values
Find the stable enums, strings, defaults, and limits used by providers.
These pages are for provider code and low-level tools. Most apps do not need them.
Import values from the package named on each page. The tables also show their string forms. Use those strings to inspect stored data and wire messages. Do not copy them into another contract.
Storage contracts
Durability, clock and index profiles, logical collections, named indexes, record states, and capacity floors.
Delivery contracts
Transport guarantees, publish outcomes, delivery dispositions, envelope limits, and maintenance defaults.
Realtime contracts
Permissions, transport errors, and connection states shared by server and browser clients.
React contracts
Attempt retention modes for React stream hooks.
Redis connection, storage, lane, and Streams settings are listed in Redis options.
For implementation guidance, start with build a provider.
Shared run predicates and sequence
These exports come from @runlane/contracts:
| Export | Role |
|---|---|
runCreatedEventSequence | Sequence of run.created, derived from contractDefaults.run.newEventSequence. |
isRunVisible(run) | Tests whether a stored run has RunStorageVisibility.Visible. Terminal runs can still be visible. |
isRunLeaseLive(run, at, allowedStatuses) | Tests the allowed statuses and whether the lease expires strictly after at. Each operation still owns its deadline and cancellation checks. |
createTerminalRunStatusSchema(invalidMessage, terminalMessage) | Builds a Zod schema that accepts only terminal run statuses and outputs TerminalRunStatus. The first message covers values that are not run statuses. The second covers active statuses. |
Singleton conflict values
Import SingletonConflict from @runlane/contracts or @runlane/core.
| Value | Meaning |
|---|---|
SingletonConflict.Reject = 'reject' | Reject an active singleton conflict. |
SingletonConflict.ReturnExisting = 'return_existing' | Raw triggers return an active holder of the same task; other tasks still reject. |
contractDefaults.run.singletonConflict | Default policy; see current defaults. |
Crash recovery values
| Value | Meaning |
|---|---|
task_interrupted | Retryable worker shutdown abort reason from createWorkerShutdownError(). Also the non-retryable terminal failure when a run exceeds its interruption allowance. |
contractDefaults.run.maxInterruptions | Shared allowance resolved into each new run's required executionPolicy.maxInterruptions. See current defaults. |
The retry guide explains when interruptions count and reset.
Hook, reader, log, and schedule values
Import these enums from @runlane/contracts.
| Enum | Members and wire values |
|---|---|
HookScope | Task = 'task', Runtime = 'runtime' |
HookKind | Success = 'success', Failure = 'failure', Cancel = 'cancel', Complete = 'complete' |
HookCallbackStatus | Pending = 'pending', Done = 'done', Failed = 'failed', Skipped = 'skipped' |
RunHooksStatus | PendingDiscovery = 'pending_discovery', Pending = 'pending', Claimed = 'claimed', Done = 'done', Failed = 'failed' |
TaskMiddlewareOutcome | Returned = 'returned', Failed = 'failed', Suspended = 'suspended', Abandoned = 'abandoned' |
RunWaitResolution | Satisfied = 'satisfied', TimedOut = 'timed_out' |
RunReaderKind | Subscription = 'subscription', Stream = 'stream', Logs = 'logs', Timeline = 'timeline' |
RunlaneLogAttribute | FireAt = 'fire_at', ScheduleId = 'schedule_id', Attempt = 'attempt', BatchId = 'batch_id', Count = 'count', MaxInterruptions = 'max_interruptions', Operation = 'operation', Phase = 'phase', PreviousExpiresAt = 'previous_expires_at', PreviousPerKey = 'previous_per_key', PreviousTotal = 'previous_total', Queue = 'queue', Reason = 'reason', RunId = 'run_id', SourceRunId = 'source_run_id', TaskId = 'task_id', TokenId = 'token_id'; see log attributes. |
TaskLogLevel | Debug = 'debug', Info = 'info', Warn = 'warn', Error = 'error' |
RunStreamCloseReason | Completed = 'completed', Failed = 'failed', Released = 'released', Cancelled = 'cancelled', Expired = 'expired', Abandoned = 'abandoned' |
ScheduleSource | Declared = 'declared', Runtime = 'runtime' |
RunStepType | Output = 'output', Wait = 'wait', Child = 'child' |
RunReleaseType | Shutdown = 'shutdown', Time = 'time', External = 'external', Handoff = 'handoff' |
RunInterruptionCause | PlatformTimeLimit = 'platform_time_limit', ExternalAbort = 'external_abort', LeaseExpired = 'lease_expired' |
Middleware receives { payload, context } and a next() callback. See attempt middleware.
RunReleaseType.Shutdown identifies run.released events caused by an abort of the execution or delivery signal after claim, including worker shutdown, a platform time limit, a caller’s signal, or transport receipt loss, when the handler throws. It carries no wait or delay. These releases requeue the run. New events record interruptionCause and the decided interruptions count. See Stop crash loops for how this count changes. Delivery normally publishes a new wakeup, subject to queue capacity. When delivery is deferred, maintenance publishes the saved outbox message for an unbounded queue or reserves and delivers the queued run for a bounded queue. A best-effort HTTP adapter in in_request mode defers these wakeups. See Continue across request budgets for how the adapter affects delivery.
When recovery replaces an expired started attempt, it records run.attempt_abandoned with the decided count before claiming the run or requesting another delivery. The event uses the storage transaction's time, which runs.attempts() reports as the abandoned attempt's completion time. Maintenance uses that same time for the recovery wakeup's occurredAt and preserves the original delivery.requestedAt. If a delivery reaches a worker after the queue has been removed and the run is within its interruption allowance, history shows the expired attempt as abandoned before the configuration failure.
When a run exceeds its interruption allowance, the system records a task_interrupted failure. The count is stored in failure.meta.interruptions, alongside maxInterruptions and interruptionCause. The diagnostic in failure.meta.cause contains a code, a message, and any available name and stack, using the existing failure text limits. Older failures with only failure.meta.reason: shutdown are still readable as external_abort.
run.cancelled and shutdown run.released events have an optional failure field containing the handler's RunFailure. Cancellation wins over errors at settlement and keeps that error in attempt history. Successful returns, waits, and explicit releases under cancellation omit it, except that an oversized return records failure.code: storage_limit_exceeded instead of output.
run.cancelled has optional output for the handler's validated return value when cancellation wins. Attempt history shows the handler output or its failure. The run result remains cancelled.
createPlatformTimeLimitError() creates the platform abort reason; isPlatformTimeLimitError() recognizes it. isWorkerShutdownError() also recognizes it, so handlers still receive task_interrupted.
RunReleaseType.Handoff yields at an unsaved durable operation after this attempt saved a new checkpoint. It carries no wait or delay. It requeues immediately. A provider may supply DeliveryAttempt.handoffAt; it does not add a task handler option. Cancellation and attempt deadlines take precedence.
Recovery events and shutdown releases may record interruptions, the count already decided when the attempt ended. Historical events without this field retain their original replay behavior.
Hook failure reasons
The reason attribute on hook_delivery_failed logs describes the delivery decision:
| Reason | Meaning |
|---|---|
retry_scheduled | A retryable callback failure has attempts left. |
not_retryable | The callback failure is not retryable; delivery stops at once. |
exhausted | A retryable failure or expired claim used the last attempt. |
discovery_timeout | Workers did not resolve callback discovery before its deadline. |