Repository navigation
Conversation
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 19, 2026 22:55
f858a1b to
4029b4b
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 20, 2026 03:21
4029b4b to
d8db906
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 20, 2026 05:01
d8db906 to
41befdd
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 20, 2026 06:38
41befdd to
ed7da9b
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 20, 2026 16:28
ed7da9b to
83c6ee9
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 22, 2026 01:11
83c6ee9 to
f961aa4
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 22, 2026 02:13
f961aa4 to
3816a12
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 22, 2026 07:11
3816a12 to
1897538
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 22, 2026 11:16
1897538 to
a97c149
Compare
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 24, 2026 21:28
15db19f to
5420da8
Compare
Lang sends a ReadStream and gets a ResolveStreamRead with the page. The core_stream_read marker keeps the offsets, the count and a digest of a page. Core refuses the command until it runs reads.
A read gives one Store answer as its page, and a core_stream_read marker records its offsets, count and digest. Before a completion each read with no answer gets one check, a Store outage fails the task, and a replay reads the Records again in bounded parts.
The tests drive a Worker on a mock server that writes History as a server does, with properties for replays and focused tests for the checks, the outages, the budgets and the forced tasks.
The dev server writes and pages the History, so the tests show a paged replay, held pages, checks, a drain over the read limit and an outage.
moetemp
force-pushed
the
moe/streams-direct-read
branch
from
November 25, 2026 21:20
fc07aab to
df69d1d
Compare
A read that max_task_read_results holds back now makes Core ask for the next task, as a held page does. So a Workflow whose only open work is such a read no longer waits for another event.
The read job and command move to 18 and 24, after the append numbers. The settings test now checks each setting that can't be zero.
moetemp
added a commit
that referenced
this pull request
Nov 25, 2026
The new read design of #1819 wins in each conflict. The metric hooks of this branch move to the new append, read and replay read code paths.
The check deadline, the read result budget of a task and the three replay bounds are no longer Stream settings. Tests still set them through fields that exist only in test builds.
The read marker goes through the same size check as the append marker. A boundary test covers both kinds, and a Worker test fails a task with 1,200 failed reads in its markers.
The filter of replayed commands at a forced failure keeps only the fail command, so Core doesn't need to remove lang's commands here. A test shows that a Stream marker with no call sends one fail command.
At one activation index a read result goes first, as an append result does, in the first run and in a replay with chunking on and off.
The test lets the read pass the gate only once the read is at the Store, so the order of the spawned calls can't stall it. A doc says what the check of a failing completion skips.
The JSON rules of the append marker doc are removed, so the read marker doc says its own JSON form.
A read whose ref has no Store name runs on the Store of the Worker's only Stream runtime, as an append does. Its marker records that name, and a replay compares it with History.
The doc pointed to the rule of the append marker, which names only an open append.
The entry keeps the command, the job, the read limit, the marker and the replay, in the style of the append entry. The proto docs have the rest.
A read picks its Store as an append does. The docs of ReadStream and StreamReadResult.store say so, and two tests cover it, live and in a replay.
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 was changed
This PR lets Core read a Stream for Workflow code. Its base is #1801.
ReadStreamis a command for Core. A read gives one page, which is one answer of the Store, in aResolveStreamReadjob. The page has the Records that the Store has at once.wait, but at most to the read limit of its task. Then it gives a page with no Record, andwait_cutsays if the limit cut the wait.StreamSettings::read_timesets the limit, half the Workflow Task timeout by default, counted from the end of a replay.waitstarts again in the next task. So an idle Stream makes no new task.StreamStoreUnavailable:, as for an append.core_stream_readmarker. A replay reads the Records from the Store again. If they are gone or differ, it fails the task, or the Workflow withWorkflowErrorType::StreamReplay. A replay reads 8 entries at a time, for at most 4 runs of the Worker at a time, and tries a Store in an outage for at most 3 s.StreamSettings::read_timeis the one setting that reads add.core_stream_readmarker has the same 1 MiB bound on its data as an append marker. An activation whose read marker has more fails its task with a message that starts withStreamMarkerTooLarge:.Why?
A library that iterates a Stream in Workflow code needs each Record while its Producer still runs. With a Local Activity, each page costs one marker and one Workflow Task. With this PR, the pages of one activation share one marker, which keeps no Records, and an idle Stream makes no Workflow Task.
This point is open.
Reviewer's guide
More than half of the ~8,800 added lines are tests.
ReadStreamandResolveStreamReadin the protos, andStreamReadResultinexternal_data.proto, for the rules of a read and what its marker keeps.streams/calls.rsandReadLimitinstreams/mod.rs, for the read limit, the call before a completion, and when Core asks for a new task.streams/read.rsmakes the marker entry and the page.streams/replay.rsandstreams/digest.rs, for how a replay reads the Records again and compares them with the marker.managed_run.rs,workflow_stream.rs,wft_extraction.rsandhistory_update.rs, which every Workflow runs. A replay reads its Records in a stage next to the History fetch, and a completion can wait for its calls to the Store.workflow_machines.rs, for the look-ahead of a read marker. A read result goes before a Local Activity result of the same activation, as an append result does in feat: let Core append to a Stream for Workflow code #1801.Checklist
core_tests/streams/reads.rswith a mock server that writes History as a server does and a test Store. Tests against a dev server (tests/integ_tests/workflow_tests/streams.rs) show a paged replay, held pages, the call before a completion, a drain past the read limit, and an outage.