You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When infrastructure is down (OOMs, network outages), VQS retries messages up to maxDeliveries: 64 times at 5s intervals. After exhausting retries, VQS drops the message — the run stays in running status forever with no error, no failure event.
Solution
Remove maxDeliveries from VQS config — allow infinite retries at queue level
Keep retryAfterSeconds: 5 — VQS owns retry timing (works even after SIGKILL/OOM)
Handlers check metadata.attempt — when > MAX_QUEUE_DELIVERIES (64), fail gracefully with MAX_DELIVERIES_EXCEEDED error code
If even failure event creation fails — log detailed error and consume the message (no point retrying further)
The reason will be displayed to describe this comment to others. Learn more.
Additional Suggestion:
SvelteKit package has hardcoded maxDeliveries: 64 on queue triggers, causing VQS to silently drop messages before the handler can gracefully fail runs/steps.
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR moves enforcement of the queue delivery cap from the Vercel Queue trigger configuration into the workflow/step runtime handlers, and updates local-queue behavior/logging to support the new approach.
Changes:
Add a shared MAX_QUEUE_DELIVERIES constant and enforce it in both workflow and step handlers with graceful failure (run_failed / step_failed + requeue workflow for step).
Remove maxDeliveries from queue trigger definitions in @workflow/builders.
Improve world-local queue logging with runId/stepId context and add a local retry safety limit.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
File
Description
packages/world-local/src/queue.ts
Adds structured identifiers to logs and replaces the old retry counter with a fixed safety-loop cap.
packages/errors/src/error-codes.ts
Introduces MAX_DELIVERIES_EXCEEDED run error code.
packages/core/src/runtime/step-handler.ts
Enforces max deliveries for steps and adjusts event creation/logging behavior.
packages/core/src/runtime/step-handler.test.ts
Adds test coverage for step max-deliveries behavior.
packages/core/src/runtime/constants.ts
Defines MAX_QUEUE_DELIVERIES.
packages/core/src/runtime.ts
Enforces max deliveries for workflow handler and records run_failed with a specific error code.
packages/builders/src/constants.ts
Removes VQS maxDeliveries from trigger constants.
.changeset/handler-max-deliveries.md
Changeset describing the behavior shift from VQS config to handler enforcement.
The reason will be displayed to describe this comment to others. Learn more.
Like the step error message, this should also be more verbose and explain that a persistent outage is preventing us from failing the run normally etc. etc.
The reason will be displayed to describe this comment to others. Learn more.
Like the step error message, this should also be more verbose and explain that a persistent outage is preventing us from failing the run normally etc. etc.
VQS uses linear 5s backoff for attempts 1-32, then exponential capped
at 2h. At 48 attempts total elapsed time is ~20h, safely under the
24h message visibility limit. Local world now uses 5s linear backoff
to approximate VQS timing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces VQS
maxDeliveries: 64cap with handler-level enforcement. Handlers now gracefully fail runs/steps after excessive queue redeliveries, preventing "phantom stuck" runs.Stacked on #1342 → #1340
Problem
When infrastructure is down (OOMs, network outages), VQS retries messages up to
maxDeliveries: 64times at 5s intervals. After exhausting retries, VQS drops the message — the run stays inrunningstatus forever with no error, no failure event.Solution
maxDeliveriesfrom VQS config — allow infinite retries at queue levelretryAfterSeconds: 5— VQS owns retry timing (works even after SIGKILL/OOM)metadata.attempt— when >MAX_QUEUE_DELIVERIES(64), fail gracefully withMAX_DELIVERIES_EXCEEDEDerror codeQueue error log examples (before → after)
Before (dumped full body, no run context):
After (structured, includes run/step IDs, separates HTTP status from handler error):
Local world queue
Test plan
failedwithMAX_DELIVERIES_EXCEEDED🤖 Generated with Claude Code