Fix workflow stack traces (no more evalmachine)#256
Merged
Conversation
🦋 Changeset detectedLatest commit: 8c93c65 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c93cf92 to
0343d72
Compare
0343d72 to
984e756
Compare
1f0f74d to
b128b07
Compare
b128b07 to
3ffca64
Compare
This was referenced Nov 8, 2025
Merged
TooTallNate
reviewed
Nov 9, 2025
TooTallNate
reviewed
Nov 9, 2025
TooTallNate
approved these changes
Nov 9, 2025
Member
TooTallNate
left a comment
There was a problem hiding this comment.
Couple small nits/questions, but otherwise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Workflow code executes in a VM context via
runInContext(), which defaults toevalmachine.<anonymous>in stack traces, making debugging difficult:Fixes #151
Solution
This PR implements comprehensive source map support for workflow stack traces by:
runInContext()Changes
Core Runtime
packages/core/src/source-map.ts(NEW) - Source map remapping logic using@jridgewell/trace-mappingpackages/core/src/workflow.ts- UseparseWorkflowName()to extract clean file paths and pass asfilenameparameter torunInContext()packages/core/src/runtime.ts- Apply source map remapping to workflow error logsBuilder Configuration
packages/builders/src/base-builder.ts- Set intermediate workflow bundle to usesourcemap: 'inline'(the VM-executed code needs inline source maps)Tests
packages/core/src/workflow.test.ts- Added test for nested stack tracespackages/core/e2e/e2e.test.ts- Added e2e test for cross-file error stack tracesworkbench/example/workflows/helpers.ts(NEW) - Test helper module for verifying cross-file stack tracesworkbench/example/workflows/99_e2e.ts- AddednestedErrorWorkflowandcrossFileErrorWorkflowwith helper functionsDependencies
@jridgewell/trace-mappingto@workflow/corefor pure-JS source map processing (no WASM dependency)Results
Before
After - Simple Error
After - Nested Functions (Same File)
After - Cross-File Errors (Imported Modules)
Stack traces now correctly show:
evalmachine.<anonymous>)Testing
Fixes #151
This is part 1 of 3 in a stack made with GitButler: