fix(workflows): keep in-step preambles out of the workflow VM bundle - #942
Merged
Conversation
Exporting resolveInStepPreambles from the 'use step' file made workflow-mode SWC keep its harnessSessionsRedis / sessionStore dynamic imports in the canvas bundle, so Vercel failed prod with node:crypto (blobStore) and postgres (db/index). Move the helper to inStepPreambles.ts and import it only inside the step body.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
Summary
Production deploy of #940 (
3b449d9) failednpm run buildwith:lib/sessions/blobStore.ts—node:cryptoin a workflow functiondb/index.ts—postgresin a workflow functionCause: adversarial #940 exported
resolveInStepPreamblesfrommodelGenerateStep.tsso tests could pin the stores-absent notes fold without driving the'use step'wrapper. That file is statically imported by the'use workflow'entry. Workflow-mode SWC DCE keeps exported non-step functions in the canvas bundle, so the helper'sawait import('../tenancy/harnessSessionsRedis')/await import('../sessions/sessionStore')pulled BlobcreateHashandpostgresinto the workflow VM.Fix: move the helper to
lib/workflows/inStepPreambles.ts(no directives).modelGenerateStepdynamically imports it inside the'use step'body so the workflow transform stubs the import away. Tests import the new module directly.Verification
npm run typecheckexit 0vitest run --changed— 5 files / 190 passedHARNESS_SKIP_FETCH=1 npm run build— green (workflows build complete (78 steps, 2 workflows)). This is the Vercel plugin that failed on feat(agent): durable working-notes block on the session envelope (plan #938) #940.staticGraph.test.tsassertsmodelGenerateStep.tsexports only the step function and does not statically import./inStepPreambles.Notes
Refs #940