Skip to content

fix(workflows): keep in-step preambles out of the workflow VM bundle - #942

Merged
btipling merged 1 commit into
mainfrom
fix/workflow-notes-preamble-export
Sep 4, 2026
Merged

fix(workflows): keep in-step preambles out of the workflow VM bundle#942
btipling merged 1 commit into
mainfrom
fix/workflow-notes-preamble-export

Conversation

@btipling

@btipling btipling commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Production deploy of #940 (3b449d9) failed npm run build with:

  • lib/sessions/blobStore.tsnode:crypto in a workflow function
  • db/index.tspostgres in a workflow function

Cause: adversarial #940 exported resolveInStepPreambles from modelGenerateStep.ts so 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's await import('../tenancy/harnessSessionsRedis') / await import('../sessions/sessionStore') pulled Blob createHash and postgres into the workflow VM.

Fix: move the helper to lib/workflows/inStepPreambles.ts (no directives). modelGenerateStep dynamically imports it inside the 'use step' body so the workflow transform stubs the import away. Tests import the new module directly.

Verification

  • npm run typecheck exit 0
  • vitest run --changed — 5 files / 190 passed
  • HARNESS_SKIP_FETCH=1 npm run buildgreen (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.
  • Pin: staticGraph.test.ts asserts modelGenerateStep.ts exports only the step function and does not statically import ./inStepPreambles.

Notes

Refs #940

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.
@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
invincible Ignored Ignored Sep 4, 2026 8:30am UTC

Request Review

@btipling
btipling merged commit 25db136 into main Sep 4, 2026
3 checks passed
@btipling
btipling deleted the fix/workflow-notes-preamble-export branch September 4, 2026 08:39
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.

plan: agent working memory — session-owned notes block (A2, source #550)

1 participant