Skip to content

Conversation

@TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Dec 18, 2025

Added retry logic to World operations to improve resilience against transient failures.

What changed?

  • Implemented a retry mechanism for World operations using the async-retry package
  • Created a withRetry function that wraps async operations with configurable retry logic
  • Added a proxy-based approach to automatically apply retry logic to all World methods
  • Defined sensible defaults for retry attempts (3 retries, exponential backoff)
  • Added logic to identify retryable errors (network issues, server errors, timeouts)
  • Modified the World initialization to wrap all World instances with retry logic

@changeset-bot
Copy link

changeset-bot bot commented Dec 18, 2025

🦋 Changeset detected

Latest commit: a02365b

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

This PR includes changesets to release 12 packages
Name Type
@workflow/core Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/web-shared Patch
workflow Patch
@workflow/astro Patch
@workflow/sveltekit Patch
@workflow/world-testing 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

@vercel
Copy link
Contributor

vercel bot commented Dec 18, 2025

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

Project Deployment Review Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Dec 18, 2025 11:26pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Dec 18, 2025 11:26pm
example-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-astro-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-express-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-fastify-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-hono-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-nitro-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-nuxt-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workbench-vite-workflow Ready Ready Preview, Comment Dec 18, 2025 11:26pm
workflow-docs Ready Ready Preview, Comment Dec 18, 2025 11:26pm

@github-actions
Copy link
Contributor

github-actions bot commented Dec 18, 2025

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 286 0 11 297
✅ 💻 Local Development 262 0 8 270
✅ 📦 Local Production 262 0 8 270
✅ 🐘 Local Postgres 262 0 8 270
✅ 🪟 Windows 27 0 0 27
❌ 🌍 Community Worlds 110 10 0 120
Total 1209 10 35 1254

❌ Failed Tests

🌍 Community Worlds (10 failed)

mongodb (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 26 0 1
✅ example 26 0 1
✅ express 26 0 1
✅ fastify 26 0 1
✅ hono 26 0 1
✅ nextjs-turbopack 26 0 1
✅ nextjs-webpack 26 0 1
✅ nitro 26 0 1
✅ nuxt 26 0 1
✅ sveltekit 26 0 1
✅ vite 26 0 1
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 26 0 1
✅ express-stable 26 0 1
✅ fastify-stable 26 0 1
✅ hono-stable 26 0 1
✅ nextjs-turbopack-stable 27 0 0
✅ nextjs-webpack-stable 27 0 0
✅ nitro-stable 26 0 1
✅ nuxt-stable 26 0 1
✅ sveltekit-stable 26 0 1
✅ vite-stable 26 0 1
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 26 0 1
✅ express-stable 26 0 1
✅ fastify-stable 26 0 1
✅ hono-stable 26 0 1
✅ nextjs-turbopack-stable 27 0 0
✅ nextjs-webpack-stable 27 0 0
✅ nitro-stable 26 0 1
✅ nuxt-stable 26 0 1
✅ sveltekit-stable 26 0 1
✅ vite-stable 26 0 1
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 26 0 1
✅ express-stable 26 0 1
✅ fastify-stable 26 0 1
✅ hono-stable 26 0 1
✅ nextjs-turbopack-stable 27 0 0
✅ nextjs-webpack-stable 27 0 0
✅ nitro-stable 26 0 1
✅ nuxt-stable 26 0 1
✅ sveltekit-stable 26 0 1
✅ vite-stable 26 0 1
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 27 0 0
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 0
❌ mongodb 26 1 0
✅ redis-dev 3 0 0
✅ redis 27 0 0
✅ starter-dev 3 0 0
❌ starter 19 8 0
✅ turso-dev 3 0 0
❌ turso 26 1 0

📋 View full workflow run

Copy link
Member Author

TooTallNate commented Dec 18, 2025

@socket-security
Copy link

socket-security bot commented Dec 18, 2025

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​types/​async-retry@​1.4.91001009180100

View full report

Copy link
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 adds automatic retry logic to World operations to improve resilience against transient failures such as network issues and server errors.

  • Implements a configurable retry mechanism using the async-retry package with exponential backoff
  • Creates a proxy-based wrapper that automatically applies retry logic to all World methods
  • Defines logic to distinguish retryable errors (network failures, 5xx errors, timeouts) from non-retryable ones (4xx client errors)

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/core/package.json Adds async-retry runtime dependency and @types/async-retry dev dependency
pnpm-lock.yaml Updates lockfile with new dependencies and their transitive dependencies
packages/core/src/runtime/retry.ts Implements core retry logic including error detection, retry wrapper function, and proxy-based automatic wrapping
packages/core/src/runtime/world.ts Integrates retry logic by wrapping World instances with the retry proxy
.changeset/all-pens-heal.md Documents the change for the changelog
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The withRetry function incorrectly returns the result of calling bail(), which returns void, but the callback signature requires returning a value of type T. The fix is to call bail() without returning it, then throw the error to satisfy the type checker.

View Details
📝 Patch Details
diff --git a/packages/core/src/runtime/retry.ts b/packages/core/src/runtime/retry.ts
index f0f7c94..8a4dae0 100644
--- a/packages/core/src/runtime/retry.ts
+++ b/packages/core/src/runtime/retry.ts
@@ -130,7 +130,9 @@ export async function withRetry<T>(
       } catch (error) {
         // If the error is not retryable, bail immediately
         if (!isRetryableError(error)) {
-          return bail(error as Error);
+          bail(error as Error);
+          // This throw is unreachable, but ensures correct return type
+          throw error;
         }
         // Otherwise, throw to trigger a retry
         throw error;

Analysis

TypeScript compilation error: bail() return type incompatibility

What fails: TypeScript compiler fails on src/runtime/retry.ts line 126 due to incorrect return type for the bail() function callback.

How to reproduce:

cd packages/core
pnpm run build

Result:

src/runtime/retry.ts(126,3): error TS2322: Type 'void | T' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'void | T'.

Root cause: The async-retry library's bail() function has signature (e: Error) => void and does not return a value. However, the code was using return bail(error as Error), which attempts to return void when the function signature requires returning T. The fix calls bail() without returning its result, then throws the error to ensure the correct return type.

Fix on Vercel

Copy link
Member

@VaguelySerious VaguelySerious left a comment

Choose a reason for hiding this comment

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

This looks fine to solve the immediate issue, assuming we change the update calls to be re-tried too, since those seem pretty important to re-try.

On a higher level, I don't like that we're re-defining the entire interface. Was it not possible to use a JS getter proxy?

return true;
}

// Check for fetch-related errors or AbortError from timeouts
Copy link
Member

Choose a reason for hiding this comment

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

What is "AbortError from timeouts" referring to here?

return withRetry(() => this.world.runs.get(id, params));
},
update: (id: string, data: UpdateWorkflowRunRequest) => {
// Non-idempotent write - no retry
Copy link
Member

Choose a reason for hiding this comment

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

Isn't update idempotent? We should retry IMO

return withRetry(() => this.world.steps.get(runId, stepId, params));
},
update: (runId: string, stepId: string, data: UpdateStepRequest) => {
// Non-idempotent write - no retry
Copy link
Member

Choose a reason for hiding this comment

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

same here

return withRetry(() => this.world.hooks.list(params));
},
dispose: (hookId: string, params?: GetHookParams) => {
// Non-idempotent write - no retry
Copy link
Member

Choose a reason for hiding this comment

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

same here?

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