Skip to content

Update Vercel queue delay cap for longer sleeps#1604

Open
pranaygp wants to merge 4 commits intomainfrom
pranaygp/codex/update-vercel-queue-7d-delay
Open

Update Vercel queue delay cap for longer sleeps#1604
pranaygp wants to merge 4 commits intomainfrom
pranaygp/codex/update-vercel-queue-7d-delay

Conversation

@pranaygp
Copy link
Copy Markdown
Collaborator

@pranaygp pranaygp commented Apr 3, 2026

Summary

  • bump @vercel/queue from 0.1.4 to 0.1.6
  • raise the Vercel world max delayed re-enqueue window to 1 hour less than 7 days (601200 seconds)
  • update the long-sleep queue test and add a changeset for @workflow/world-vercel

Testing

  • pnpm turbo build --filter=@workflow/world-vercel...
  • pnpm --filter @workflow/world-vercel test
  • pnpm exec biome check packages/world-vercel/src/queue.ts packages/world-vercel/src/queue.test.ts

@pranaygp pranaygp requested a review from a team as a code owner April 3, 2026 18:58
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Apr 3, 2026 8:49pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Apr 3, 2026 8:49pm
example-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-astro-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-express-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-fastify-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-hono-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-nitro-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-nuxt-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workbench-vite-workflow Ready Ready Preview, Comment Apr 3, 2026 8:49pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Apr 3, 2026 8:49pm
workflow-swc-playground Error Error Apr 3, 2026 8:49pm

Copilot AI review requested due to automatic review settings April 3, 2026 18:58
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

🦋 Changeset detected

Latest commit: da34354

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@workflow/world-vercel Patch
@workflow/cli Patch
@workflow/core Patch
workflow Patch
@workflow/world-testing Patch
@workflow/builders Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/web-shared Patch
@workflow/ai Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

No benchmark result files found in benchmark-results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
❌ ▲ Vercel Production 849 8 67 924
✅ 🪟 Windows 76 0 8 84
Total 925 8 75 1008

❌ Failed Tests

▲ Vercel Production (8 failed)

astro (2 failed):

  • DurableAgent e2e tool approval (GAP) completes but needsApproval is not checked (GAP)
  • outputStreamWorkflow no startIndex (reads all chunks)

example (1 failed):

  • outputStreamWorkflow positive startIndex (skips first chunk)

fastify (1 failed):

  • outputStreamWorkflow positive startIndex (skips first chunk)

hono (1 failed):

  • outputStreamWorkflow negative startIndex (reads from end)

nitro (1 failed):

  • outputStreamWorkflow positive startIndex (skips first chunk)

nuxt (1 failed):

  • outputStreamWorkflow positive startIndex (skips first chunk)

sveltekit (1 failed):

  • outputStreamWorkflow no startIndex (reads all chunks)

Details by Category

❌ ▲ Vercel Production
App Passed Failed Skipped
❌ astro 75 2 7
❌ example 76 1 7
✅ express 77 0 7
❌ fastify 76 1 7
❌ hono 76 1 7
✅ nextjs-turbopack 82 0 2
✅ nextjs-webpack 82 0 2
❌ nitro 76 1 7
❌ nuxt 76 1 7
❌ sveltekit 76 1 7
✅ vite 77 0 7
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 76 0 8

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: failure
  • Local Prod: failure
  • Local Postgres: failure
  • Windows: success

Check the workflow run for details.

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 3, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​vercel/​queue@​0.1.4 ⏵ 0.1.69610010099100

View full report

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates @workflow/world-vercel’s Vercel Queue integration to support longer “sleep” delays by increasing the maximum delayed re-enqueue window and updating dependency + tests accordingly.

Changes:

  • Bump @vercel/queue from 0.1.4 to 0.1.6 via the pnpm catalog/lockfile.
  • Increase the default max delaySeconds cap to 7d - 1h (601200s) and adjust related inline documentation.
  • Update the long-sleep clamping test and add a changeset for @workflow/world-vercel.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-workspace.yaml Updates pnpm catalog version for @vercel/queue to 0.1.6.
pnpm-lock.yaml Lockfile updates to reflect @vercel/queue@0.1.6.
packages/world-vercel/src/queue.ts Raises the default delay cap to 7d - 1h and updates chaining documentation.
packages/world-vercel/src/queue.test.ts Adjusts the long-sleep clamping test to the new cap.
.changeset/strong-guests-study.md Publishes a patch changeset for @workflow/world-vercel.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 51 to 56
const SECONDS_PER_HOUR = 60 * 60;
const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * SECONDS_PER_HOUR;
const MAX_DELAY_SECONDS = Number(
process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || 82800 // 23 hours - leave 1h buffer before 24h retention limit
process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS ||
MAX_QUEUE_DELAY_WINDOW_SECONDS - SECONDS_PER_HOUR
);
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX_DELAY_SECONDS is derived from Number(process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || ...). If the env var is set but non-numeric (or empty), Number(...) becomes NaN, and Math.min(timeoutSeconds, MAX_DELAY_SECONDS) will produce NaN, which then gets forwarded to QueueClient.send({ delaySeconds }). Consider parsing/validating the env var (fallback to the default when invalid) and clamping it to the supported maximum delay (the 7d window minus the 1h buffer) to avoid misconfiguration causing runtime failures.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6b2568fe. VERCEL_QUEUE_MAX_DELAY_SECONDS now goes through getMaxDelaySeconds(), which falls back for blank/non-numeric/negative values and clamps valid overrides to the supported max before we pass delaySeconds to VQS.

@@ -1,5 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

const MAX_DELAY_SECONDS = 7 * 24 * 60 * 60 - 60 * 60;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-use constant from actual file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 407954ea — the test now imports MAX_DELAY_SECONDS from queue.ts instead of duplicating the calculation locally.

'@workflow/world-vercel': patch
---

Update the Vercel queue delay cap for longer sleeps.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Update the Vercel queue delay cap for longer sleeps.
Update Vercel queue max delay for longer sleeps without having to re-enqueue as frequently

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 407954ea.

*
* These constants can be overridden via environment variables for testing.
*/
const SECONDS_PER_HOUR = 60 * 60;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should actually make this one day. Practically, there'll be no performance or cost difference, BUT if there's infra downtime, and it happens to be the "right" minute, this gives us a bigger margin for queue to re-drive before it gives up? Would have to think through this more deeply but seems like a generally safer approach

Suggested change
const SECONDS_PER_HOUR = 60 * 60;
const RE_ENQUEUE_MARGIN_SECONDS = 24 * 3600; // 24 hours

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense — applied in 407954ea. The re-enqueue margin is now 24 hours, which brings the effective max delayed send to 6 days and gives more room for queue redrive if there is infra turbulence near the delivery boundary.

* These constants can be overridden via environment variables for testing.
*/
const SECONDS_PER_HOUR = 60 * 60;
const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * SECONDS_PER_HOUR;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * SECONDS_PER_HOUR;
const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * 3600; // 7 days

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 407954ea.

const MAX_DELAY_SECONDS = Number(
process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || 82800 // 23 hours - leave 1h buffer before 24h retention limit
process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS ||
MAX_QUEUE_DELAY_WINDOW_SECONDS - SECONDS_PER_HOUR
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MAX_QUEUE_DELAY_WINDOW_SECONDS - SECONDS_PER_HOUR
MAX_QUEUE_DELAY_WINDOW_SECONDS - RE_ENQUEUE_MARGIN_SECONDS

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 407954ea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants