Repository navigation
Conversation
moetemp
force-pushed
the
moe/brook/review/s7-workflow-streams
branch
from
October 26, 2026 00:14
b298e44 to
90966d6
Compare
moetemp
force-pushed
the
moe/brook/review/s6-redis-memory
branch
2 times, most recently
from
October 26, 2026 02:08
326073b to
d018d29
Compare
moetemp
force-pushed
the
moe/brook/review/s7-workflow-streams
branch
2 times, most recently
from
October 26, 2026 08:44
1c5e48f to
84f1587
Compare
moetemp
force-pushed
the
moe/brook/review/s6-redis-memory
branch
2 times, most recently
from
October 27, 2026 09:07
b5bb616 to
f5a8d77
Compare
moetemp
force-pushed
the
moe/brook/review/s7-workflow-streams
branch
2 times, most recently
from
October 27, 2026 09:17
c3f30a4 to
b9572b1
Compare
moetemp
force-pushed
the
moe/brook/review/s6-redis-memory
branch
from
October 27, 2026 09:17
f5a8d77 to
6d49da8
Compare
moetemp
force-pushed
the
moe/brook/review/s7-workflow-streams
branch
2 times, most recently
from
October 28, 2026 07:54
925cf34 to
cc8e51c
Compare
moetemp
force-pushed
the
moe/brook/review/s6-redis-memory
branch
from
October 28, 2026 07:54
026e0a3 to
11cd676
Compare
Each write has the epoch of the Workflow Task that runs it, so the Store withdraws the writes of a failed task. A close is a regular Activity, which runs only after its Workflow Task commits.
moetemp
force-pushed
the
moe/brook/review/s7-workflow-streams
branch
from
October 28, 2026 08:05
cc8e51c to
e7710c0
Compare
moetemp
force-pushed
the
moe/brook/review/s6-redis-memory
branch
from
October 28, 2026 08:05
11cd676 to
c68482a
Compare
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 adds Workflow Streams (
workflow.create_stream,create_stream_nowait,stream_handleandWorkflowStream), which write through Local Activities.<workflow id>:<first run id>:<name>, with an optional backend name. So a task retry, a retry run and the run after continue-as-new get the same Stream. A publish to a Stream that nobody created raisesStreamNotFoundError.temporalio.workflow.ReadOnlyContextError. In a validator it fails the Workflow Task, as other read-only actions do.resultandfailureas the input of the close Activity, so the payload size limit applies to them. They stay there, since only a regular Activity runs after its task commits. To move them out, a Store needs a call that keeps a close result until the close, and no Store has one yet.Depends on S6 (#376), and on G3 (#369) through
feature-streams. No changelog fragment, since S9 has the Streams entry.Part of the Brook review series.
Why?
This is the main use of Streams. An agent Workflow writes its turns to a Stream, and a client or a UI reads them as the Workflow writes them.
This PR is over the size target, since the Workflow handle, the Local Activities and the interceptors only test together. If you want it smaller, I can split it in two.
close_at_run_end,_take_owned_streamsand their tests). About 300 lines.Open question. Workflow Streams use private parts of the Workflow runtime. This is the hook API that would replace them. Should the SDK add it?
workflow.unsafe.run_local(key, factory)gives state that lives as long as the run. It replaces the attribute on_Runtime.current().workflow.unsafe.outbound_interceptor(cls)gives the run's outbound interceptor of that class, orNone. It replaces the walk of the_outboundchain.workflow.unsafe.fail_run(error)fails the run witherrorafter the current callbacks, as if the run raised it. It replaces_current_activation_error, which the error of a_nowaitcall sets.workflow.unsafe.is_failure_exception(error)tells iferrorfails the run, and not only the Workflow Task. It replaces_Runtime.workflow_is_failure_exception.workflow.unsafe.payload_converter(context=False)andworkflow.unsafe.failure_converter(context=False)give the converters with no serialization context. They replace_context_free_payload_converterand_context_free_failure_converter.A publish future sets a flag when a caller gets its result or its error, so the code doesn't read
Future._log_traceback.Checklist
poe lint,poe gen-docsandpytest tests/contrib/streamson both backends, with Redis 8 and Redis 7.0 (CI's version on Ubuntu). Fork CI passes, except the arm jobs, since the fork has no arm runners.