Skip to content

Add support for readable streams in workflows local dev#13145

Merged
Caio-Nogueira merged 1 commit intomainfrom
caio/workflows-readable-stream
Apr 7, 2026
Merged

Add support for readable streams in workflows local dev#13145
Caio-Nogueira merged 1 commit intomainfrom
caio/workflows-readable-stream

Conversation

@Caio-Nogueira
Copy link
Copy Markdown
Contributor

@Caio-Nogueira Caio-Nogueira commented Mar 31, 2026

We recently added workflows support for ReadableStream<Uint8Array>. We want to mirror behavior on local dev as well


A picture of a cute animal (not mandatory, but encouraged)


Open with Devin

@Caio-Nogueira Caio-Nogueira requested review from a team as code owners March 31, 2026 14:49
@Caio-Nogueira Caio-Nogueira requested a review from penalosa March 31, 2026 14:50
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 1dd568d

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

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

@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 31, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/workflows
  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR adds ReadableStream<Uint8Array> support to the local dev workflows engine by chunking streams into SQL storage, replaying them on cache hit, and handling various error/timeout/rollback scenarios.

Issues

  1. streamOutputRolledBack on WorkflowTimeoutError is never set (low severity) — The StreamWriteTimeoutError type defines streamOutputRolledBack?: boolean and context.ts:536-541 reads it from the thrown error, but no code path ever sets this property to true on any error object. The read always evaluates to undefined (falsy), so the guard at line 704 is effectively dead. This is harmless since rollbackStreamOutput is idempotent, but the plumbing is misleading. If this is forward-looking (for production parity), a comment would help. Otherwise it can be removed.

  2. Missing changeset (low severity) — The changeset bot flagged this. Since this changes user-visible behavior (stream outputs in local dev), a changeset for workflows-shared is likely needed unless the no-changeset-required label applies.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 31, 2026

Review posted on PR #13145. The PR is well-structured overall -- the stream chunking/replay infrastructure in streams.ts is solid, error handling is thorough with proper rollback on failures, and the test coverage is good (including edge cases for locked streams, unsupported chunks, oversized chunks, restart cleanup, TypedArray normalization, and timeout+rollback).

I flagged two low-severity items:

  1. The streamOutputRolledBack property on WorkflowTimeoutError is typed and read but never actually set to true anywhere, making the check dead code. Harmless but misleading.
  2. A missing changeset (already flagged by the bot).

github run

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 31, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13145

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13145

miniflare

npm i https://pkg.pr.new/miniflare@13145

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13145

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13145

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13145

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13145

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13145

wrangler

npm i https://pkg.pr.new/wrangler@13145

commit: 1dd568d

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 6 additional findings.

Open in Devin Review

@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch 2 times, most recently from 9820806 to 6470c27 Compare March 31, 2026 15:16
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

Changeset Review

File: .changeset/all-fans-march.md

Package: @cloudflare/workflows-shared
Version Type: minor

Review

  1. Version Type: ✅ minor is appropriate for a new feature (ReadableStream support)

  2. Changelog Quality: ✅ Clear description explaining what the feature does and its benefit (overcoming 1MB limit per step output)

  3. Markdown Headers: ✅ No h1/h2/h3 headers found

  4. Analytics: ✅ Not applicable - no analytics collection mentioned

  5. Dependabot: ✅ Not a dependency update changeset

  6. Experimental features: ✅ Not applicable - this is adding new functionality to an internal package


✅ All changesets look good

devin-ai-integration[bot]

This comment was marked as resolved.

@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch from 6470c27 to 8e4a68d Compare March 31, 2026 15:36
devin-ai-integration[bot]

This comment was marked as resolved.

@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch 2 times, most recently from 79d8cd7 to 90665df Compare March 31, 2026 16:00
@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch from 90665df to a55b2b5 Compare March 31, 2026 16:59
devin-ai-integration[bot]

This comment was marked as resolved.

@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch 2 times, most recently from d106ced to 132fe45 Compare April 1, 2026 09:36
devin-ai-integration[bot]

This comment was marked as resolved.

@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch from 132fe45 to ba9269e Compare April 1, 2026 11:04
@pombosilva pombosilva self-requested a review April 1, 2026 12:30
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Apr 1, 2026
@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch from ba9269e to 864c356 Compare April 1, 2026 12:32
@Caio-Nogueira Caio-Nogueira force-pushed the caio/workflows-readable-stream branch from 864c356 to 28d6ed5 Compare April 1, 2026 12:40
Copy link
Copy Markdown
Contributor

@penalosa penalosa left a comment

Choose a reason for hiding this comment

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

Approving from a Wrangler perspective. I haven't closely reviewed the workflows-shared code

@Caio-Nogueira Caio-Nogueira self-assigned this Apr 2, 2026
@penalosa penalosa force-pushed the caio/workflows-readable-stream branch from 28d6ed5 to 1dd568d Compare April 7, 2026 08:41
@workers-devprod
Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/workflows
  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@Caio-Nogueira Caio-Nogueira added this pull request to the merge queue Apr 7, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 7, 2026
@Caio-Nogueira Caio-Nogueira added this pull request to the merge queue Apr 7, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 7, 2026
@Caio-Nogueira Caio-Nogueira added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit 5b60405 Apr 7, 2026
51 checks passed
@Caio-Nogueira Caio-Nogueira deleted the caio/workflows-readable-stream branch April 7, 2026 10:08
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants