Skip to Content
Runlane
ReferenceContract values

Delivery values

Look up stable transport, message, worker, and maintenance values.

Import these values from @runlane/contracts. Provider code should branch on enums, not copied strings.

Public mutation results use DeliveryOutcome from the same package. Its optional deliveryError field follows saved changes and delivery errors. Completion resume diagnostics identify the affected waiting parent as meta.runId and the completed child as meta.sourceRunId. A lookup failure before a target is known uses only meta.sourceRunId. Each parent receives only its own resume diagnostic.

Transport profiles

EnumValueMeaning
TransportDurability.BestEffortbest_effortA positive publish result does not promise durable retention
TransportDurability.DurabledurableA positive result crossed the provider's durable boundary
TransportOrdering.NonenoneNo cross-message order is promised
TransportOrdering.PartitionpartitionAccepted messages preserve order for one effective partition

TransportDriverProfile.publishTimeout optionally declares the configured publish lifetime as a positive whole number of milliseconds. Core uses the larger of the default lease and this timeout plus contractDefaults.delivery.outboxSettlementReserve for outbox ownership and abort timing. Direct HTTP derives it from its publishTimeout option; it is not a separate user setting.

Transport limit fields are:

  • maxMessageBytes for one logical message.
  • maxPublishMessages for one publish call.
  • Optional maxDelaySecondsByQueue maps logical queues to their future delivery windows. A missing queue or zero means due-only publication. TransportMessage.availableAt is the earliest delivery time; delayed publishers must honor it. Schedule hints may publish before their fire time and bypass the run-owned outbox.

Redis Streams profile

createRedisDeliveryProvider() from @runlane/transport-redis reports TransportDurability.BestEffort and TransportOrdering.None. It advertises no future delivery window, so core publishes only due wakeups. Accepted messages may be delivered more than once.

The body limit is contractDefaults.delivery.maxEnvelopeBytes; a publish call accepts up to 100 messages. One Stream and one fixed consumer group serve each queue. A finite backlog includes unread and pending entries. See Streams options for admission, reclamation, and failure reporting.

Publish command

PublishMessagesCommand requires messages and signal: AbortSignal. Parsing preserves the signal instance. It aborts when the original outbox claim, minus contractDefaults.delivery.outboxSettlementReserve, may expire. Providers must stop capacity waits and start no new sends after abort. parsePublishMessagesCommand() rejects an already-aborted command with a retryable transport_unavailable error. If the signal aborts after parsing, return retryable failures for messages not yet sent. Await started requests; throw if their delivery results are unknown.

Publish outcomes

EnumValueMeaning
PublishOutcomeType.PublishedpublishedThe provider acknowledged one input message
PublishOutcomeType.FailedfailedThe provider returned a reliable failure for one input

A request failure without trustworthy item results rejects the call instead of inventing per-item outcomes.

Ordering applies only to messages with published outcomes. A failed item was not accepted into broker order; retrying it is a later publish, so it may follow messages that came after it in the original input.

Delivery dispositions

EnumValueProvider action
DeliveryDispositionType.HandledhandledAcknowledge, delete, or commit the native message
DeliveryDispositionType.RetryretryPreserve it for another delivery
DeliveryDispositionType.RejectrejectApply configured terminal handling

DeliveryAttempt.deliveryCount is an optional positive integer: the native receive or delivery count for this message, starting at 1. Supply the broker's count when available; omit it when unknown. Do not use the task attempt count or invent a local counter. SQS workers and Lambda supply ApproximateReceiveCount; missing or malformed receive metadata is treated as unknown. Redis Streams uses its existing pending-entry delivery count. HTTP omits it. Core requests a fast claim retry only when this count equals 1; later and absent counts keep native backoff.

Retry optionally carries retryAfterMs, a positive integer number of milliseconds. It asks a capable provider to delay redelivery from the retry decision, rounding up to native precision. Omission preserves existing backoff. Core supplies contractDefaults.delivery.claimConflictRetryDelayMs (1,000) only for retryable storage conflicts thrown at the run-claim boundary on native delivery 1. Paused/full queues, missing handlers, outages, and other retries omit the hint. Native limits, reclaim cadence, and unsupported platforms can delay pickup; this does not change at-least-once delivery or storage admission.

Direct HTTP profile

createDirectHttpAdapter() from @runlane/transport-http reports BestEffort durability, no ordering, no native delay, a publish batch limit of 100, and the existing envelope byte limit. No broker retention or deduplication is promised. Package-owned httpTransportDefaults supplies HTTP tuning; body bytes and Retry-After retain their existing contract owners. See HTTP options for signed header names, limits and status mapping.

Canonical envelope

The current delivery envelope:

  • has an explicit type: DeliveryMessageType.RunWakeup (run_wakeup) or DeliveryMessageType.RunHooksWakeup (run_hooks_wakeup), or DeliveryMessageType.ScheduleWakeup (schedule_wakeup).
  • has version: 3.
  • contains no user task payload.
  • is limited in UTF-8 bytes by contractDefaults.delivery.maxEnvelopeBytes.

run_wakeup and run_hooks_wakeup carry runId. schedule_wakeup carries scheduleId and fireAt. It has no run identity because the run is created at fire time. All variants carry environment, queue, and optional request and trace fields.

Treat it as opaque canonical bytes inside a transport provider.

Worker polling defaults

Storage-polling workers use:

  • contractDefaults.delivery.workHints (true) for work publications and native worker listeners.
  • contractDefaults.delivery.storagePollingEmptyPollDelay for the first idle delay.
  • contractDefaults.delivery.storagePollingMaximumEmptyPollDelay for the default backoff cap. The effective cap is the larger of this value and the user’s emptyPollDelay; idle polling never shortens that user delay.

Polling lanes accept workHints: false to disable both publications and listeners. Core keeps local commit wakes and polling with idle backoff. Hints only lower latency; time-based readiness always depends on polling and maintenance. Transport lanes reject workHints because their transport delivers work.

Read these fields in code. The defaults reference lists their owning group.

SQS Lambda options

recursiveLoop?: LambdaRecursiveLoop is accepted by createSqsLambdaHandler() and by the sqs options of postgresSqsLane() and redisSqsLane(). The @runlane/transport-sqs enum has Allow = 'allow' and Terminate = 'terminate'; sqsLambdaDefaults.recursiveLoop supplies the default. Both SQS lanes re-export LambdaRecursiveLoop. It only changes schedule wakeup handling in Lambda, not long-running workers. See recursive loop detection for AWS configuration, maintenance cadence, and opt-in risks.

SQS polling options

SqsTransportOptions.waitTimeSeconds from @runlane/transport-sqs sets the ReceiveMessage.WaitTimeSeconds value for every standard and FIFO queue consumer. Set it on createSqsDeliveryProvider() or in the sqs options of postgresSqsLane() or redisSqsLane(), beside client and queues.

It accepts integers from 1 to 20. Omitting it uses sqsConsumerDefaults.waitTimeSeconds, which is derived from sqsProviderConstraints.maxWaitTimeSeconds (20 seconds) in the SQS provider. These owners remain internal to that package. Invalid values raise a structured configuration_invalid error at transport construction.

Graceful close waits for accepted polls in parallel with attempt grace. An idle close can take up to waitTimeSeconds, plus request and release time. Shorter waits allow faster idle shutdowns but increase empty receives and SQS request costs. For example, sqs: { client, queues, waitTimeSeconds: 1 } limits each poll to one second. The default keeps AWS's recommended long-poll duration. Lambda handlers do not poll and are unaffected.

Wait-token and maintenance defaults

Omitting a wait-token idempotency TTL keeps the owner until the terminal token is pruned.

The maintenance token limits use these canonical defaults; see defaults for their values:

  • contractDefaults.maintenance.waitTokenTimeoutLimit.
  • contractDefaults.maintenance.waitTokenResumeLimit.

Token completion also attempts one linked-run resume for lower latency. Maintenance remains the recovery owner for all links left behind.

See build a transport provider and run maintenance for behavior behind these values.

Provider worker inputs include shutdownGrace?: ShutdownGrace. Contracts owns unlimitedSchema, its value unlimited ('unlimited'), and shutdownGraceSchema, with input type ShutdownGrace and parsed type ShutdownGraceValue. Providers can validate the raw duration or lowercase literal with shutdownGraceInputSchema before passing it to the worker. Unlimited close has no abort timer; running attempts retain their leases until they settle. Core passes the resolved worker default. Providers stop acquisition on close, wait through this grace, then abort active deliveries with createWorkerShutdownError() from @runlane/contracts. It returns a RunlaneError with code task_interrupted and retryable: true; handlers can recognize it with isWorkerShutdownError(), including across package copies. Core treats a handler error as an interruption when the delivery signal aborted after claim and before the error. RunReleaseType.Shutdown remains the release category on run.released events. Aborting the existing worker signal skips grace. Platform handlers gain no shutdown hook.

handoffBeforeSchema parses a positive duration into DurationValue, or keeps false to disable handler step-boundary handoff. getHandoffAfterMs(budgetMs, handoffBefore) converts that parsed option to a delay in milliseconds; disabled handoff returns undefined, and a reserve at least as large as the budget returns zero. Omission reserves contractDefaults.delivery.handoffReserveFraction (25%) of the host budget. See handoff.

On this page