Skip to content

Fix stale SvelteKit workflow queue triggers#1984

Merged
pranaygp merged 2 commits into
stablefrom
pranaygp/codex/fix-sveltekit-stale-queue-triggers
May 14, 2026
Merged

Fix stale SvelteKit workflow queue triggers#1984
pranaygp merged 2 commits into
stablefrom
pranaygp/codex/fix-sveltekit-stale-queue-triggers

Conversation

@pranaygp
Copy link
Copy Markdown
Contributor

Summary

  • Strip Workflow queue triggers from the shared SvelteKit Vercel source function after copying it into the dedicated flow.func and step.func outputs.
  • Keep the dedicated workflow functions subscribed to their expected queues only.
  • Add a patch changeset for @workflow/sveltekit.

Root cause

SvelteKit adapter output can use shared __data.json.func/catchall function configs. The Workflow SvelteKit integration copies those shared functions into dedicated workflow functions and patches queue triggers there, but stale queue triggers can remain on the shared source config. That can leave extra Workflow queue consumers in a deployment.

Validation

  • pnpm --filter @workflow/sveltekit build
  • pnpm exec biome check packages/sveltekit/src/index.ts
  • Vercel-mode SvelteKit build on Node 24 with injected stale V1 workflow queue triggers. Final output only had queue triggers on:
    • .well-known/workflow/v1/flow.func for __wkf_workflow_*
    • .well-known/workflow/v1/step.func for __wkf_step_*
    • shared/catchall source configs had no workflow queue triggers

Note: pnpm changeset status --since=origin/stable reported the expected patch bump set after staging the changeset.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 14, 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 May 14, 2026 10:25pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment May 14, 2026 10:25pm
example-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-astro-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-express-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-fastify-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-hono-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-nitro-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-nuxt-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-sveltekit-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-tanstack-start-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workbench-vite-workflow Ready Ready Preview, Comment May 14, 2026 10:25pm
workflow-docs Ready Ready Preview, Comment, Open in v0 May 14, 2026 10:25pm
workflow-swc-playground Ready Ready Preview, Comment May 14, 2026 10:25pm
workflow-tarballs Ready Ready Preview, Comment May 14, 2026 10:25pm
workflow-web Ready Ready Preview, Comment May 14, 2026 10:25pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

🦋 Changeset detected

Latest commit: bf8dfaf

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

This PR includes changesets to release 18 packages
Name Type
@workflow/sveltekit Patch
workflow Patch
tarballs Patch
@workflow/ai Patch
@workflow/world-testing Patch
@workflow/core Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/web-shared Patch
@workflow/web Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup 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 May 14, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
❌ ▲ Vercel Production 900 1 67 968
❌ 💻 Local Development 888 82 86 1056
✅ 📦 Local Production 970 0 86 1056
✅ 🐘 Local Postgres 970 0 86 1056
✅ 🪟 Windows 88 0 0 88
❌ 🌍 Community Worlds 139 83 0 222
✅ 📋 Other 492 0 36 528
Total 4447 166 361 4974

❌ Failed Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

💻 Local Development (82 failed)

nitro-stable (82 failed):

  • DurableAgent e2e core basic text response
  • DurableAgent e2e core single tool call
  • DurableAgent e2e core multiple sequential tool calls
  • DurableAgent e2e core tool error recovery
  • DurableAgent e2e provider tools provider tool identity preserved across step boundaries
  • DurableAgent e2e provider tools mixed provider and function tools
  • DurableAgent e2e onStepFinish fires constructor + stream callbacks in order with step data
  • DurableAgent e2e onFinish fires constructor + stream callbacks in order with event data
  • DurableAgent e2e instructions string instructions are passed to the model
  • DurableAgent e2e timeout completes within timeout
  • DurableAgent e2e experimental_onStart (GAP) completes but callbacks are not called (GAP)
  • DurableAgent e2e experimental_onStepStart (GAP) completes but callbacks are not called (GAP)
  • DurableAgent e2e experimental_onToolCallStart (GAP) completes but callbacks are not called (GAP)
  • DurableAgent e2e experimental_onToolCallFinish (GAP) completes but callbacks are not called (GAP)
  • DurableAgent e2e prepareCall (GAP) completes but prepareCall is not applied (GAP)
  • DurableAgent e2e prepareStep on constructor agent-level prepareStep is called for each LLM step
  • DurableAgent e2e prepareStep on constructor stream-level prepareStep overrides constructor-level
  • DurableAgent e2e multimodal tool results passes through LanguageModelV3ToolResultOutput from tools
  • DurableAgent e2e tool approval (GAP) completes but needsApproval is not checked (GAP)
  • addTenWorkflow | wrun_01KRM9CZWXZKE40P6D1B7SSEQJ
  • addTenWorkflow | wrun_01KRM9CZWXZKE40P6D1B7SSEQJ
  • promiseAllWorkflow | wrun_01KRM9D74Y6F3ATN76CC2N6SE3
  • promiseRaceWorkflow | wrun_01KRM9DA9BNXC71XDQC63CMDQ7
  • promiseAnyWorkflow | wrun_01KRM9DDE8H971272XS0A0JDXW
  • readableStreamWorkflow | wrun_01KRM9DFAW057FYYQH4KR9B1W4
  • hookWorkflow | wrun_01KRM9DS595AJVXE71ZRS6HBWA
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KRM9E4RWQ5AVGB9MSRQEDSRP
  • webhookWorkflow | wrun_01KRM9EDK6846YZRG7YBBR9WPM
  • webhook route with invalid token
  • sleepingWorkflow | wrun_01KRM9EKBGR8KAKDX11WBNB363
  • parallelSleepWorkflow | wrun_01KRM9EZEEQ3BTB1QHC56S7RXK
  • nullByteWorkflow | wrun_01KRM9F2J1Q1TSK1K6VC4MYPZM
  • workflowAndStepMetadataWorkflow | wrun_01KRM9F4GB0T7Q208YQVTCYN2R
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KRM9HKH1E9GFCZ2XBAEE96A8
  • fetchWorkflow | wrun_01KRM9J1SS6VN5910AWTKAE0DC
  • promiseRaceStressTestWorkflow | wrun_01KRM9J60YC9TRWPTP5BG89F8A
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KRM9NDM3V7M02EC57D3CZYPP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KRM9P0VDKJ6AX8RKS1KHR0ZP
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KRM9PM9XPRC30Q466YTJCYF9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KRM9Q6Z48BRMVACVS44KJ1Z5
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KRM9QEPK39YBMBEGVP1B44E2
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KRM9QKDGX8A63EXC59J2SFAZ
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KRM9QN9WDZGSW202FRGQ52WX
  • health check endpoint (HTTP) - workflow and step endpoints respond to __health query parameter
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KRM9R3M0MK3MMT4TFCEJHWGM
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KRM9R8BB8Y6R3B8ERWQB6C2S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KRM9RE9B3DFE6JXF7RW2B42W
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KRM9RM7SGQ17WE9N1688YJ88
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KRM9RVJQSC91QRK1MSEMX163
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KRM9S1YFAK58R7RZV08KSK9J
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KRM9S8YW2V72QA10XZ2VPW66
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KRM9SK2VN8RKA6NPJ7ZTXQSY
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KRM9SVC258G1BB1FPTN01WKB
  • cancelRun - cancelling a running workflow | wrun_01KRM9T2KMEZEHNWT06A7Q23HJ
  • cancelRun via CLI - cancelling a running workflow | wrun_01KRM9TB8B978YR7EK8SED5EKF
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KRM9TP14S41319SGPM5XF7D4
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KRM9VA937SN1XNQKWPH23VC8
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KRM9VM77NW5K1C1PC7HSE3EH
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KRM9VVPPJBVZXBCX52AEXCNY
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KRM9VXRNG2RFGBRZ6ZVN3YZG
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KRM9VZXF7Y5T7EY2W1WTNQAF
🌍 Community Worlds (83 failed)

mongodb (11 failed):

  • readableStreamWorkflow | wrun_01KRM9DFAW057FYYQH4KR9B1W4
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KRM9E4RWQ5AVGB9MSRQEDSRP
  • webhookWorkflow | wrun_01KRM9EDK6846YZRG7YBBR9WPM
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KRM9HKH1E9GFCZ2XBAEE96A8
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KRM9P0VDKJ6AX8RKS1KHR0ZP
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KRM9VZXF7Y5T7EY2W1WTNQAF

redis (7 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KRM9E4RWQ5AVGB9MSRQEDSRP
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KRM9P0VDKJ6AX8RKS1KHR0ZP
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KRM9VZXF7Y5T7EY2W1WTNQAF

turso (65 failed):

  • addTenWorkflow | wrun_01KRM9CZWXZKE40P6D1B7SSEQJ
  • addTenWorkflow | wrun_01KRM9CZWXZKE40P6D1B7SSEQJ
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KRM9EMR66VQG21HP8Y3SZNDE
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KRM9D74Y6F3ATN76CC2N6SE3
  • promiseRaceWorkflow | wrun_01KRM9DA9BNXC71XDQC63CMDQ7
  • promiseAnyWorkflow | wrun_01KRM9DDE8H971272XS0A0JDXW
  • importedStepOnlyWorkflow | wrun_01KRM9F0Y16RW1T9W3WBY5YY3E
  • readableStreamWorkflow | wrun_01KRM9DFAW057FYYQH4KR9B1W4
  • hookWorkflow | wrun_01KRM9DS595AJVXE71ZRS6HBWA
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KRM9E4RWQ5AVGB9MSRQEDSRP
  • webhookWorkflow | wrun_01KRM9EDK6846YZRG7YBBR9WPM
  • sleepingWorkflow | wrun_01KRM9EKBGR8KAKDX11WBNB363
  • parallelSleepWorkflow | wrun_01KRM9EZEEQ3BTB1QHC56S7RXK
  • nullByteWorkflow | wrun_01KRM9F2J1Q1TSK1K6VC4MYPZM
  • workflowAndStepMetadataWorkflow | wrun_01KRM9F4GB0T7Q208YQVTCYN2R
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KRM9HKH1E9GFCZ2XBAEE96A8
  • fetchWorkflow | wrun_01KRM9J1SS6VN5910AWTKAE0DC
  • promiseRaceStressTestWorkflow | wrun_01KRM9J60YC9TRWPTP5BG89F8A
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KRM9NDM3V7M02EC57D3CZYPP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KRM9P0VDKJ6AX8RKS1KHR0ZP
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KRM9PM9XPRC30Q466YTJCYF9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KRM9Q6Z48BRMVACVS44KJ1Z5
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KRM9QEPK39YBMBEGVP1B44E2
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KRM9QKDGX8A63EXC59J2SFAZ
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KRM9QN9WDZGSW202FRGQ52WX
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KRM9R3M0MK3MMT4TFCEJHWGM
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KRM9R8BB8Y6R3B8ERWQB6C2S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KRM9RE9B3DFE6JXF7RW2B42W
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KRM9RM7SGQ17WE9N1688YJ88
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KRM9RVJQSC91QRK1MSEMX163
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KRM9S1YFAK58R7RZV08KSK9J
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KRM9S8YW2V72QA10XZ2VPW66
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KRM9SK2VN8RKA6NPJ7ZTXQSY
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KRM9SVC258G1BB1FPTN01WKB
  • cancelRun - cancelling a running workflow | wrun_01KRM9T2KMEZEHNWT06A7Q23HJ
  • cancelRun via CLI - cancelling a running workflow | wrun_01KRM9TB8B978YR7EK8SED5EKF
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KRM9TP14S41319SGPM5XF7D4
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KRM9VA937SN1XNQKWPH23VC8
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KRM9VM77NW5K1C1PC7HSE3EH
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KRM9VVPPJBVZXBCX52AEXCNY
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KRM9VXRNG2RFGBRZ6ZVN3YZG
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KRM9VZXF7Y5T7EY2W1WTNQAF

Details by Category

❌ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 81 0 7
✅ example 81 0 7
✅ express 81 0 7
❌ fastify 80 1 7
✅ hono 81 0 7
✅ nextjs-turbopack 86 0 2
✅ nextjs-webpack 86 0 2
✅ nitro 81 0 7
✅ nuxt 81 0 7
✅ sveltekit 81 0 7
✅ vite 81 0 7
❌ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 82 0 6
✅ express-stable 82 0 6
✅ fastify-stable 82 0 6
✅ hono-stable 82 0 6
✅ nextjs-turbopack-canary 69 0 19
✅ nextjs-turbopack-stable 88 0 0
✅ nextjs-webpack-canary 69 0 19
✅ nextjs-webpack-stable 88 0 0
❌ nitro-stable 0 82 6
✅ nuxt-stable 82 0 6
✅ sveltekit-stable 82 0 6
✅ vite-stable 82 0 6
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 82 0 6
✅ express-stable 82 0 6
✅ fastify-stable 82 0 6
✅ hono-stable 82 0 6
✅ nextjs-turbopack-canary 69 0 19
✅ nextjs-turbopack-stable 88 0 0
✅ nextjs-webpack-canary 69 0 19
✅ nextjs-webpack-stable 88 0 0
✅ nitro-stable 82 0 6
✅ nuxt-stable 82 0 6
✅ sveltekit-stable 82 0 6
✅ vite-stable 82 0 6
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 82 0 6
✅ express-stable 82 0 6
✅ fastify-stable 82 0 6
✅ hono-stable 82 0 6
✅ nextjs-turbopack-canary 69 0 19
✅ nextjs-turbopack-stable 88 0 0
✅ nextjs-webpack-canary 69 0 19
✅ nextjs-webpack-stable 88 0 0
✅ nitro-stable 82 0 6
✅ nuxt-stable 82 0 6
✅ sveltekit-stable 82 0 6
✅ vite-stable 82 0 6
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 88 0 0
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 5 0 0
❌ mongodb 58 11 0
✅ redis-dev 5 0 0
❌ redis 62 7 0
✅ turso-dev 5 0 0
❌ turso 4 65 0
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 82 0 6
✅ e2e-local-dev-tanstack-start-stable 82 0 6
✅ e2e-local-postgres-nest-stable 82 0 6
✅ e2e-local-postgres-tanstack-start-stable 82 0 6
✅ e2e-local-prod-nest-stable 82 0 6
✅ e2e-local-prod-tanstack-start-stable 82 0 6

📋 View full workflow run


Some E2E test jobs failed:

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

Check the workflow run for details.

@pranaygp pranaygp marked this pull request as ready for review May 14, 2026 17:59
@pranaygp pranaygp requested a review from a team as a code owner May 14, 2026 17:59
Copilot AI review requested due to automatic review settings May 14, 2026 17:59
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

This PR fixes a deployment edge case in the SvelteKit Vercel adapter integration where workflow queue triggers could remain attached to shared/catchall function configs after the workflow-specific functions are copied out, resulting in unintended extra queue consumers.

Changes:

  • Added logic to strip workflow-related queue triggers from the shared source function’s .vc-config.json after copying.
  • Refactored the copy logic to reuse computed function directories (funcDir, sourceFuncDir) for clarity.
  • Added a patch changeset for @workflow/sveltekit.

Reviewed changes

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

File Description
packages/sveltekit/src/index.ts Adds stripWorkflowQueueTriggers() and applies it to the shared source function config to prevent stale queue subscriptions.
.changeset/stale-sveltekit-triggers.md Declares a patch release for @workflow/sveltekit documenting the fix.

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

Comment thread packages/sveltekit/src/index.ts Outdated
Comment on lines +6 to +7
const WORKFLOW_QUEUE_TOPICS = new Set(['__wkf_workflow_*', '__wkf_step_*']);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in bf8dfaf: the SvelteKit helper now reuses STEP_QUEUE_TRIGGER / WORKFLOW_QUEUE_TRIGGER from @workflow/builders instead of duplicating the topic strings.

@pranaygp pranaygp requested a review from TooTallNate May 14, 2026 21:46
@pranaygp pranaygp enabled auto-merge (squash) May 14, 2026 22:02
Copy link
Copy Markdown
Member

@TooTallNate TooTallNate left a comment

Choose a reason for hiding this comment

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

Approve

Clean fix for a real deployment bug. The root cause is exactly as described: SvelteKit's Vercel adapter writes a shared catchall function config (__data.json.func/.vc-config.json) that includes the workflow queue triggers, and the existing post-build hook copies it to dedicated flow.func/step.func outputs without ever clearing the source. Result: three (or more) deployment functions consuming the same queue.

What I verified

Idempotency of the strip helper across the two-iteration loop: First iteration (flow.func) reads source contents, copies to dest, overwrites dest config with the workflow-specific trigger, then strips workflow topics from source — both __wkf_workflow_* and __wkf_step_* are removed in one shot because WORKFLOW_QUEUE_TOPICS contains both. Second iteration (step.func) sees source with no remaining workflow triggers — filteredTriggers.length === experimentalTriggers.length short-circuits, no extra write. Final result: each dedicated func subscribes to exactly one workflow topic, source has none. ✅

Defensive layering in stripWorkflowQueueTriggers: missing file → return, non-array experimentalTriggers → return, no matching triggers → return without write, all-workflow → delete the property rather than leaving an empty array. Pure JSON in/out. Good hygiene.

New funcDir existence guard (the if (!fs.existsSync(funcDir)) continue; at the top of the loop) is a strict-mode improvement orthogonal to the queue-trigger fix — before this PR, fs.readdirSync(path.dirname(file)) would throw if SvelteKit didn't create the dest dir. Worth keeping.

Build + typecheck clean locally (pnpm turbo build --filter @workflow/sveltekit, pnpm typecheck). CI is green: 65 successes, 0 failures, 5 still in progress.

Three non-blocking observations — see inline

  1. Forward-port to main — same bug exists there (V2 only has flow.func, but the source is still shared). Per AGENTS.md the normal flow is main→stable via backport action.
  2. Optional unit tests for stripWorkflowQueueTriggers — the function is unusually testable (pure JSON-file transform) and the package currently has zero tests.
  3. Changeset wording — accurate but terse; would help users recognize the symptom in their deployment.

None of these are blockers. Approving.

Comment thread packages/sveltekit/src/index.ts Outdated

import { SvelteKitBuilder } from './builder.js';

const WORKFLOW_QUEUE_TOPICS = new Set(['__wkf_workflow_*', '__wkf_step_*']);
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.

Heads-up: this PR targets stable directly, but the same bug exists on main too — V2 there only writes flow.func (no step.func), but __data.json.func source can still retain the __wkf_workflow_* trigger after the copy step. Per AGENTS.md the normal flow is main→stable via the backport action.

Worth opening a companion PR against main so this fix doesn't regress on the next stable release. The WORKFLOW_QUEUE_TOPICS set there is just ['__wkf_workflow_*'] (no step), but the helper + call site are otherwise identical.

Non-blocking for this PR — fine to land first and forward-port separately.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call. I’m keeping this PR scoped to stable / 4.2.x because that was the requested release target, but main needs the same treatment as a separate follow-up PR.

Comment thread packages/sveltekit/src/index.ts Outdated
// a race to be created before svelte discovers entries
await builder.build();

function stripWorkflowQueueTriggers(file: string) {
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.

Optional: this is one of the most testable functions in the package — a pure transform over .vc-config.json contents. The package has zero tests today, so adding the first one would establish the pattern. Something like:

import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import fs from 'fs-extra';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';

// (export stripWorkflowQueueTriggers for testing, or pull it into a helpers module)

describe('stripWorkflowQueueTriggers', () => {
  let dir: string;
  beforeEach(() => { dir = mkdtempSync(join(tmpdir(), 'wf-sveltekit-')); });
  afterEach(() => { rmSync(dir, { recursive: true, force: true }); });

  it('removes workflow topics, keeps others', () => {
    const file = join(dir, '.vc-config.json');
    fs.writeJsonSync(file, {
      runtime: 'nodejs22.x',
      experimentalTriggers: [
        { type: 'queue/v2beta', topic: '__wkf_workflow_*' },
        { type: 'queue/v2beta', topic: '__wkf_step_*' },
        { type: 'queue/v2beta', topic: 'app_user_signup' },
      ],
    });
    stripWorkflowQueueTriggers(file);
    expect(fs.readJsonSync(file).experimentalTriggers).toEqual([
      { type: 'queue/v2beta', topic: 'app_user_signup' },
    ]);
  });

  it('deletes the array when all triggers were workflow', () => { ... });
  it('no-ops when file is missing', () => { ... });
  it('no-ops when experimentalTriggers is missing', () => { ... });
  it('no-ops when no triggers matched (idempotent)', () => { ... });
});

Would have caught the second-iteration idempotency I traced through during review (both topics are stripped on iter 1; iter 2 should no-op). Non-blocking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in bf8dfaf: I extracted the pure config transform into vc-config.ts and added focused coverage for preserving unrelated triggers, deleting empty trigger arrays, and leaving unrelated configs unchanged.

Comment thread .changeset/stale-sveltekit-triggers.md Outdated
'@workflow/sveltekit': patch
---

Remove stale workflow queue triggers from shared SvelteKit Vercel function configs.
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.

Wording nit: the changeset description is accurate but doesn't convey end-user impact. From a SvelteKit user's perspective the symptom they'll recognize in their changelog is duplicate / extra Workflow queue consumers in their deployment. Consider:

Suggested change
Remove stale workflow queue triggers from shared SvelteKit Vercel function configs.
---
'@workflow/sveltekit': patch
---
Fix duplicate Workflow queue consumers in deployed SvelteKit apps by stripping stale `__wkf_workflow_*` and `__wkf_step_*` triggers from the shared source function after copying them to the dedicated `flow.func` / `step.func` outputs.

Non-blocking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in bf8dfaf: updated the changeset to call out the duplicate Workflow queue consumers symptom for SvelteKit deployments.

@pranaygp
Copy link
Copy Markdown
Contributor Author

Forward-port to main is open in #1995.

@pranaygp pranaygp disabled auto-merge May 14, 2026 23:04
@pranaygp pranaygp merged commit 5b6a581 into stable May 14, 2026
92 of 95 checks passed
@pranaygp pranaygp deleted the pranaygp/codex/fix-sveltekit-stale-queue-triggers branch May 14, 2026 23:04
@github-actions github-actions Bot mentioned this pull request May 14, 2026
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