Skip to content

[cli] [core] Probe deployment specVersion before CLI start#1629

Merged
VaguelySerious merged 17 commits intomainfrom
peter/cli-specversion-probe
Apr 7, 2026
Merged

[cli] [core] Probe deployment specVersion before CLI start#1629
VaguelySerious merged 17 commits intomainfrom
peter/cli-specversion-probe

Conversation

@VaguelySerious
Copy link
Copy Markdown
Member

Summary

Based on #1627. CLI start command now probes the target deployment's specVersion via health check before calling start(), ensuring the correct queue transport is used.

  • Health check always uses JSON transport (specVersion: SPEC_VERSION_LEGACY) so the probe works against both old and new deployments
  • Adds deploymentId option to HealthCheckOptions for targeted health checks
  • Falls back to the existing run's specVersion if health check fails (e.g. old deployment without health check support)

Other paths that call start() without knowing specVersion

Call site Knows specVersion? Notes
CLI start Now probed This PR
recreateRunFromExisting (web dashboard replay) Yes Uses run.specVersion from original run
User code (import { start } from 'workflow') N/A Runs ON the deployment, so SPEC_VERSION_CURRENT is correct
Testing server (world-testing) No Not production-relevant

Test plan

  • packages/core unit tests pass (580/580)
  • Full build passes
  • e2e: CLI start against old deployment uses JSON transport
  • e2e: CLI start against new deployment uses CBOR transport
  • e2e: CLI start with health check timeout falls back to run specVersion

🤖 Generated with Claude Code

VaguelySerious and others added 13 commits April 6, 2026 15:56
Bump SPEC_VERSION_CURRENT to 3 and fix isLegacySpecVersion to check
against SPEC_VERSION_LEGACY instead of SPEC_VERSION_CURRENT, preventing
v2 runs from being incorrectly treated as legacy when the version bumps.

Add JsonTransport and DualTransport to world-vercel queue: the handler
uses DualTransport (CBOR-first, JSON fallback) to accept messages from
both old and new deployments, while the send path selects CBOR or JSON
based on the target run's specVersion. Pass specVersion through queue
opts from start(), reenqueueRun(), wakeUpRun(), and resumeHook().

Only include runInput in the queue payload for specVersion >= 3, creating
clean separation between old and new behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bump specVersion to 3. Use JSON transport for queue messages targeting
older deployments (specVersion < 3), CBOR for new ones. Handler uses
dual transport that deserializes both formats, so new deployments can
receive messages from old and new senders.

Fixes replay/reenqueue from the dashboard to older deployments that
expect JSON queue messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace SPEC_VERSION_CURRENT comparisons with named constants
(SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_EVENT_SOURCING)
so future SPEC_VERSION_CURRENT bumps don't shift existing feature gates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hardcoded specVersion: 2 with SPEC_VERSION_CURRENT so
the test tracks spec version bumps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Both the HTTP health check endpoint (?__health) and the queue-based
health check stream now return specVersion, allowing observability
tools to query deployment capabilities.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
…d, causing `toEqual` to fail due to exact equality mismatch.

This commit fixes the issue reported at packages/core/e2e/e2e.test.ts:1550

**Bug explanation:**

The `withHealthCheck` handler in `packages/core/src/runtime/helpers.ts` returns a JSON response with three fields: `{ healthy: true, endpoint: url.pathname, specVersion: SPEC_VERSION_CURRENT }`. However, the HTTP-based health check e2e test in `packages/core/e2e/e2e.test.ts` (lines 1549-1553 and 1567-1571) uses `toEqual` to assert against objects that only have two fields: `{ healthy: true, specVersion: SPEC_VERSION_CURRENT }`, missing the `endpoint` field.

In Vitest, `toEqual` performs exact deep equality checking. When the actual response object contains `{ healthy: true, endpoint: "/.well-known/workflow/v1/flow", specVersion: "..." }` but the expected object only has `{ healthy: true, specVersion: "..." }`, the assertion fails because the actual object has an extra `endpoint` property not present in the expected object.

This affects both the flow endpoint health check assertion and the step endpoint health check assertion.

**Fix explanation:**

Added the missing `endpoint` field to both `toEqual` assertions:
- For the flow endpoint: `endpoint: '/.well-known/workflow/v1/flow'` (the pathname portion of `/.well-known/workflow/v1/flow?__health`)
- For the step endpoint: `endpoint: '/.well-known/workflow/v1/step'` (the pathname portion of `/.well-known/workflow/v1/step?__health`)

These values match what `url.pathname` returns in the handler (the `?__health` query parameter is not part of the pathname). This makes the test assertions exactly match the actual response structure from the handler.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: VaguelySerious <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Update HealthCheckResult to include specVersion and parse it from the
stream response, so observability tools can query deployment capabilities
through both the HTTP and queue-based health check paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use Record<string, unknown> instead of narrower casts that tsc
rejects as insufficient overlap.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CLI start command now queries the deployment's health check endpoint
to determine its specVersion before calling start(). This ensures the
correct queue transport is used (JSON for old deployments, CBOR for
new). Falls back to the run's specVersion if health check fails.

Health check always uses JSON transport (specVersion: SPEC_VERSION_LEGACY)
so the probe works against both old and new deployments. Also adds
deploymentId option to HealthCheckOptions for targeted health checks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 7, 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 7, 2026 5:52pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Apr 7, 2026 5:52pm
example-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-astro-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-express-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-fastify-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-hono-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-nitro-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-nuxt-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workbench-vite-workflow Ready Ready Preview, Comment Apr 7, 2026 5:52pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Apr 7, 2026 5:52pm
workflow-swc-playground Ready Ready Preview, Comment Apr 7, 2026 5:52pm

@VaguelySerious VaguelySerious requested a review from a team as a code owner April 7, 2026 00:22
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 7, 2026

🦋 Changeset detected

Latest commit: 51fb2ab

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

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

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
❌ ▲ Vercel Production 878 1 67 946
✅ 💻 Local Development 854 0 178 1032
✅ 📦 Local Production 854 0 178 1032
✅ 🐘 Local Postgres 854 0 178 1032
✅ 🪟 Windows 78 0 8 86
❌ 🌍 Community Worlds 16 60 8 84
✅ 📋 Other 216 0 42 258
Total 3750 61 659 4470

❌ Failed Tests

▲ Vercel Production (1 failed)

hono (1 failed):

🌍 Community Worlds (60 failed)

mongodb-dev (1 failed):

  • dev e2e should rebuild on imported step dependency change

redis-dev (1 failed):

  • dev e2e should rebuild on imported step dependency change

turso-dev (1 failed):

  • dev e2e should rebuild on imported step dependency change

turso (57 failed):

  • addTenWorkflow | wrun_01KNMH5VCWZ2YQDPP365WEZTM4
  • addTenWorkflow | wrun_01KNMH5VCWZ2YQDPP365WEZTM4
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNMH75H1GT8X09J9WS5F6FA6
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNMH63YAHQKDCZQT1EPYKGX8
  • promiseRaceWorkflow | wrun_01KNMH699ZAQD55FBQV3XNHM7X
  • promiseAnyWorkflow | wrun_01KNMH6C1XSP0EZ96TT0J5E8PF
  • importedStepOnlyWorkflow | wrun_01KNMH7GSJTNP0DX1PGSPFNTZZ
  • hookWorkflow | wrun_01KNMH6S06RS6VXGS41PF3GWSB
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNMH76KMG0ZCB7ST88V553JE
  • webhookWorkflow | wrun_01KNMH7H30FD15T64RRS74743D
  • sleepingWorkflow | wrun_01KNMH7TG251JCYH1HS6DV9PKV
  • parallelSleepWorkflow | wrun_01KNMH87BSQPDNQBW8RR8GMHVR
  • nullByteWorkflow | wrun_01KNMH8B46P0EM2F1T1T2EQT07
  • workflowAndStepMetadataWorkflow | wrun_01KNMH8DKDK9H0CTSMSMJYV7J1
  • fetchWorkflow | wrun_01KNMHBA5EJNGZ9Y10R47QQ7TS
  • promiseRaceStressTestWorkflow | wrun_01KNMHBD0VT8JK2JD5N8JDTNTX
  • 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_01KNMHF707573TY2VWEG6X4DNH
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNMHFWK8Q44KY5E9X4R9ASHD
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNMHGM9JGZWZSBXT32C90R37
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNMHHA40QC8M5BFCX3WRN9DS
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNMHHKY5FCTHAD7DQ2RGH0AW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNMHHT09G8K4G7EG4F36D42G
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNMHHWDR6ZZGV5585HXJBY19
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNMHJBHXQHBXCB06Q1RQ364Z
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNMHJHYZ7X33V0S840FX5W9Q
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNMHJRQ8QEZG1WYA9X4NE9G4
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNMHJZB674R8TQ8TN8AA026X
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNMHK64J28XRFGM5X10GD015
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNMHKCJH3BSFD5V6A5DJSKV8
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNMHKJXNGX0BC6AG4EP84PH0
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNMHKW4R2DSSHKGVJXT66ZGB
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNMHM4QSV8SW6786SA9H6NFD
  • cancelRun - cancelling a running workflow | wrun_01KNMHMC10ES9NS6ZW9MAK03E4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNMHMMSK0AGPXGJR7JK82QDR
  • 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_01KNMHMZYT36WW88RZPBQRKBH1
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNMHNKEWEEQWTPPWGB7YNWSW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNMHNY2NHRBQ53J3TY57ZGSR
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNMHP4PAJEEA4DPSG64JC7M6
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNMHP6N2TBYR581JBV88ESXE
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KNMHP8T5FNQQ8Z6MNZH87SNG

Details by Category

❌ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 79 0 7
✅ example 79 0 7
✅ express 79 0 7
✅ fastify 79 0 7
❌ hono 78 1 7
✅ nextjs-turbopack 84 0 2
✅ nextjs-webpack 84 0 2
✅ nitro 79 0 7
✅ nuxt 79 0 7
✅ sveltekit 79 0 7
✅ vite 79 0 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 72 0 14
✅ express-stable 72 0 14
✅ fastify-stable 72 0 14
✅ hono-stable 72 0 14
✅ nextjs-turbopack-canary 61 0 25
✅ nextjs-turbopack-stable 78 0 8
✅ nextjs-webpack-canary 61 0 25
✅ nextjs-webpack-stable 78 0 8
✅ nitro-stable 72 0 14
✅ nuxt-stable 72 0 14
✅ sveltekit-stable 72 0 14
✅ vite-stable 72 0 14
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 72 0 14
✅ express-stable 72 0 14
✅ fastify-stable 72 0 14
✅ hono-stable 72 0 14
✅ nextjs-turbopack-canary 61 0 25
✅ nextjs-turbopack-stable 78 0 8
✅ nextjs-webpack-canary 61 0 25
✅ nextjs-webpack-stable 78 0 8
✅ nitro-stable 72 0 14
✅ nuxt-stable 72 0 14
✅ sveltekit-stable 72 0 14
✅ vite-stable 72 0 14
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 72 0 14
✅ express-stable 72 0 14
✅ fastify-stable 72 0 14
✅ hono-stable 72 0 14
✅ nextjs-turbopack-canary 61 0 25
✅ nextjs-turbopack-stable 78 0 8
✅ nextjs-webpack-canary 61 0 25
✅ nextjs-webpack-stable 78 0 8
✅ nitro-stable 72 0 14
✅ nuxt-stable 72 0 14
✅ sveltekit-stable 72 0 14
✅ vite-stable 72 0 14
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 78 0 8
❌ 🌍 Community Worlds
App Passed Failed Skipped
❌ mongodb-dev 4 1 0
❌ redis-dev 4 1 0
❌ turso-dev 4 1 0
❌ turso 4 57 8
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 72 0 14
✅ e2e-local-postgres-nest-stable 72 0 14
✅ e2e-local-prod-nest-stable 72 0 14

📋 View full workflow run


Some E2E test jobs failed:

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

Check the workflow run for details.

Both the HTTP (?__health) and queue-based health check endpoints
now return the @workflow/core package version, allowing observability
tools to identify exactly which SDK version a deployment is running.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@VaguelySerious VaguelySerious merged commit a6bcea9 into main Apr 7, 2026
92 of 99 checks passed
@VaguelySerious VaguelySerious deleted the peter/cli-specversion-probe branch April 7, 2026 18:03
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.

2 participants