Repository navigation
Conversation
iter to the Workflow Stream, with Direct reads and appends in Coreiter to the Workflow Stream, with Direct reads, appends and closes in Core
moetemp
force-pushed
the
moe/streams-direct
branch
from
November 15, 2026 18:51
a5fa03c to
7dabd9f
Compare
moetemp
force-pushed
the
moe/streams-direct
branch
from
November 15, 2026 20:23
7dabd9f to
f7eb673
Compare
This was referenced Nov 16, 2026
moetemp
force-pushed
the
moe/streams-direct
branch
from
November 16, 2026 17:14
4e0334b to
b556665
Compare
moetemp
force-pushed
the
moe/streams-direct
branch
from
November 16, 2026 17:33
b556665 to
dd3836f
Compare
moetemp
force-pushed
the
moe/streams-direct
branch
3 times, most recently
from
November 17, 2026 06:51
88cddf9 to
5fe21e2
Compare
iter to the Workflow Stream, with Direct reads, appends and closes in Core
moetemp
force-pushed
the
moe/streams-direct
branch
from
November 17, 2026 22:18
b6df792 to
23d8c57
Compare
2 of 3 tasks
moetemp
force-pushed
the
moe/streams-direct
branch
from
November 17, 2026 22:48
23d8c57 to
4bae65f
Compare
moetemp
force-pushed
the
moe/streams-direct
branch
2 times, most recently
from
November 18, 2026 15:14
29aef59 to
6b014ea
Compare
Core makes a Workflow's read, append and close inside the Workflow Task, with one marker for the task. A create and a describe run in a Local Activity.
Core gave the Worker two read settings, so `StreamConfig` passes them on with the same checks. A gap trades latency for fewer activations of Workflow code.
A read, an append and a close of Workflow code go through Core, which records the marker. Core gets a runtime that runs the Python Store's calls on the Worker's event loop, so the refusal of such a Store is gone.
A bug in a Store never gets better, so a retry only delayed the error. Such an exception reaches Workflow code on the first try as a non-retryable `STORAGE_CORRUPT`, and an outage still retries.
The Workflow `Stream` has `read`, `read_pages` and `read_page` from commit 07b565b6 of the nexgen fork. A Stream call no longer reaches the generic hook, so the page count test uses `start_read_records`.
The Redis Store moved to its own package, with the tests of its outages. The test of a Worker with no Workflows keeps its proof on a small Store of the bridge that fails to build its runtime.
The next commit takes the memory Store out of the bridge. `DictStreamStore` now has the wait of a read that Core needs, with the resend and the fence of a batch. The test that compared the limits of a client read with a Workflow read leaves, since a client read of a Python Store has no check.
Core's Stream crate has one `StreamStore` trait and no Store of its own, so the bridge keeps only the adapter that calls a Store written in Python. The `streams` cargo feature goes, since Core links the crate in every build.
moetemp
force-pushed
the
moe/streams-direct
branch
from
November 18, 2026 18:28
6b014ea to
340a1a7
Compare
2 of 3 tasks
Workflow code passes its Records to one `append` call, and a flush by time has no meaning there.
A Store doesn't have to refuse a lower epoch of a Producer. Each Record has what a reader needs to tell the attempts apart.
This branch has not been deployed
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.
What changed?
This PR gives Workflow code the Streams API. Workflow code reads a Stream with the same
read,read_pagesandread_pageas a client, and it appends to a Stream and closes it. Core makes these three calls itself, inside the Workflow Task.It's a prototype, created for the purpose of getting your feedback on the API. Its base is #2129, and Core's side is temporalio/sdk-rust#1801.
wait, a call waits that long for a new Record and then gives an empty page. With nowait, it gives what is in the Stream. Workflow code gets each page as it arrives, at most 256 Records in one activation.append. Core writes the Records with the Workflow as the Producer and the Workflow Task as the epoch.close. It takes effect after its Workflow Task is in History, so an awaited close spans two Workflow Tasks. A Workflow Task that fails closes nothing, and its retry can still append.create_streamanddescriberun in a Local Activity.BufferedAppender. It's for client and Activity code, and it raisesRuntimeErrorin Workflow code. Workflow code passes its Records to oneappendcall.core_streammarker for each Workflow Task with a Stream result, whatever the number of Records. By default it has a range, a count and a digest, and a replay reads the Records from the Store again. Withworkflow_read_replay_from=StreamReplaySource.HISTORYit has the Records.StreamReplayError, or the Workflow with that class inworkflow_failure_exception_types.StreamConfig:workflow_read_page_records(the cap of 256),workflow_read_min_gap(an opt-in least time between two batches, for fewer activations on a slow Stream) andworkflow_read_ahead_bytes(4 MiB).StreamStore. The bridge has one adapter, which runs the Store's method as a task on the Worker's event loop, never on a Workflow thread. The Stream runtime of feat: add theStreamStoretrait and the Stream runtime totemporalio-streamssdk-rust#1799 checks each request and each answer, and it refuses a batch over thelimitsof the Store. The docs ofStreamStorelist what a Store must do for Workflow code.It depends on two things that have no release yet.
Streamgets its poll iterators from feat: generate the@nexus.polliterators for the Workflow target moetemp/nexgen#123, which is on a fork.Why?
A library that iterates a Stream in Workflow code needs each Record while its Producer still runs. ADK is an example, since its own loop reads the model through an async generator.
It has these costs.
workflow_read_min_gaptrades latency for it.How did you test it?
The tests are in
tests/nexus/test_stream_direct.pyandtests/nexus/test_stream_store_workflow.py. They run on the local dev server with a Store that is written in Python, with a Workflow cache and with none.Link to a test plan if any -