Skip to content

Fix step-level getWritable() stream timeout on Vercel#1518

Merged
VaguelySerious merged 1 commit intovercel:mainfrom
ceolinwill:fix/step-getwritable-stream-timeout
Mar 26, 2026
Merged

Fix step-level getWritable() stream timeout on Vercel#1518
VaguelySerious merged 1 commit intovercel:mainfrom
ceolinwill:fix/step-getwritable-stream-timeout

Conversation

@ceolinwill
Copy link
Copy Markdown
Contributor

Description

Fixes #770

The step-level getWritable() used .pipeTo() to pipe serialized data to the server. .pipeTo() only resolves when the stream closes, but users typically call writer.releaseLock() without closing. This caused the ops promise (passed to waitUntil()) to never resolve, keeping the Vercel function alive until runtime timeout.

PR #678 fixed this for the stream revivers in getStepRevivers/getExternalRevivers by using flushablePipe + pollWritableLock, but the step-level getWritable() (which is what users call via import { getWritable } from 'workflow') was not updated.

This PR applies the same flushablePipe + pollWritableLock pattern to getWritable() so the ops promise resolves as soon as the user releases the writer lock and all pending writes are flushed.

How did you test your changes?

Added packages/core/src/step/writable-stream.test.ts with two tests:

  • releaseLock without close — previously hung (reproduces the bug), now resolves
  • explicit close — continues to work as before

All existing tests pass (pnpm test in packages/core).

PR Checklist - Required to merge

  • 📦 pnpm changeset was run to create a changelog for this PR
    • During beta, we only use "patch" mode for changes. Don't tag minor/major versions.
    • Use pnpm changeset --empty if you are changing documentation or workbench apps
  • 🔒 DCO sign-off passes (run git commit --signoff on your commits)
  • 📝 Ping @vercel/workflow in a comment once the PR is ready, and the above checklist is complete

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: ceolinwill <4393133+ceolinwill@users.noreply.github.com>
@ceolinwill ceolinwill requested a review from a team as a code owner March 25, 2026 16:54
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: 4ba509e

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

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

@ceolinwill
Copy link
Copy Markdown
Contributor Author

@vercel/workflow This PR is ready for review.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 25, 2026

@ceolinwill is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
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.

Thanks, LGTM, running some more validations before merging

@VaguelySerious VaguelySerious merged commit c739b99 into vercel:main Mar 26, 2026
70 of 103 checks passed
@ghost ghost mentioned this pull request Mar 26, 2026
@ceolinwill ceolinwill deleted the fix/step-getwritable-stream-timeout branch March 26, 2026 23:24
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.

Streaming timeouts (vercel world)

2 participants