Skip to content

fix(runtime-sdk): Make NonRetryableError raised in a workflow step non-retryable - #266

Merged
hoodmane merged 2 commits into
cloudflare:mainfrom
hoodmane:hoodmane/workflow-nonretryable
Sep 18, 2026
Merged

hoodmane merged 2 commits into
cloudflare:mainfrom
hoodmane:hoodmane/workflow-nonretryable

Conversation

@hoodmane

Copy link
Copy Markdown
Contributor

The Workflows engine decides whether to retry a failed step from the JS error's
name. A Python exception reaches it as a Pyodide PythonError whose message is the
traceback, so workers.workflows.NonRetryableError was silently retried like any
other error. This adds a new workflows.js shim that fixes the translation of
NonRetryableError to JavaScript so this works

@ryanking13 ryanking13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I left some comments but it looks good overall

Comment thread packages/runtime-sdk/src/workers/utils.py
Comment thread packages/runtime-sdk/src/workers/utils.py Outdated
Comment thread packages/runtime-sdk/src/workers/utils.py
Comment thread packages/runtime-sdk/src/workers/workflows.js
Comment thread packages/runtime-sdk/tests/test_in_workerd.py
@hoodmane
hoodmane force-pushed the hoodmane/workflow-nonretryable branch 2 times, most recently from a7e2715 to 5c68efa Compare September 18, 2026 20:37
…ith the SDK

wrangler registers `.js`/`.mjs` files under `python_modules/workers/` as ES modules,
so JavaScript can ship inside the `workers` package and be loaded at runtime.
…n-retryable

The Workflows engine decides whether to retry a failed step from the JS error's
name. A Python exception reaches it as a Pyodide PythonError whose message is the
traceback, so `workers.workflows.NonRetryableError` was silently retried like any
other error.  This adds a new workflows.js shim that fixes the translation of
NonRetryableError to JavaScript so this works correctly.
@hoodmane
hoodmane force-pushed the hoodmane/workflow-nonretryable branch from 5c68efa to 2ccc864 Compare September 18, 2026 20:45
@hoodmane
hoodmane merged commit 1c1980a into cloudflare:main Sep 18, 2026
14 of 15 checks passed
@hoodmane
hoodmane deleted the hoodmane/workflow-nonretryable branch September 18, 2026 21:04
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