Skip to content

feat: let Workflow code read a Stream - #2188

Draft
moetemp wants to merge 2 commits into
moe/streams-workflow-appendsfrom
moe/streams-workflow-reads
Draft

moetemp wants to merge 2 commits into
moe/streams-workflow-appendsfrom
moe/streams-workflow-reads

Conversation

@moetemp

@moetemp moetemp commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

This PR lets Workflow code read a Stream, and a StreamRef[T] decodes in a dataclass, a list and an optional. The Core pin moves to the head of Core #1819, with the read protos regenerated.

Why?

A replay reads the Records again from the Store, so History stays small. This is the only Python PR that waits for Core #1819.

Reviewer's guide

Review after #2187. Read the 2 commits in order.

  1. Let Workflow code read a Stream. The Core pin, the read protos, then the read path and stream_read_time.
  2. Decode a StreamRef[T] in a dataclass, a list and an optional.

Checklist

  • Regenerate the read bindings at the updated Core pin.
  • Run Python lint and focused Stream tests.

@moetemp
moetemp added this pull request to stack #2189 December 2, 2026 22:49
@moetemp
moetemp force-pushed the moe/streams-workflow-reads branch 2 times, most recently from 8a09e49 to b5dd883 Compare December 2, 2026 23:14
@moetemp
moetemp force-pushed the moe/streams-workflow-reads branch from b5dd883 to 7d0638b Compare December 2, 2026 23:24
@moetemp
moetemp force-pushed the moe/streams-workflow-reads branch from 7d0638b to 9af7a99 Compare December 3, 2026 08:49
@moetemp
moetemp removed this pull request from stack #2189 December 3, 2026 09:00
@moetemp
moetemp added this pull request to stack #2202 December 3, 2026 09:00
@moetemp
moetemp force-pushed the moe/streams-workflow-reads branch 2 times, most recently from 9729789 to 7a7f865 Compare December 3, 2026 10:04
Core runs each read and records the offset, the count and the digest of
its page, so a replay reads the Records from the Store again and checks
them. `stream_read_time` bounds how long reads keep a Workflow Task
open, and `StreamReplayError` lets a Workflow fail when Records changed.
A ref in Workflow or Activity input must keep its body type, since a
read converts each body to it. Only `StreamRef` takes the two new
decoding paths, since a change for any other type would alter the
replay of existing Workflow Histories.
@moetemp
moetemp force-pushed the moe/streams-workflow-reads branch from 7a7f865 to a8fe761 Compare December 3, 2026 10:14

This branch has not been deployed

No deployments
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.

1 participant