Skip to content

feat: let Workflow code create, describe and append to Streams - #2187

Draft
moetemp wants to merge 7 commits into
moe/streams-apifrom
moe/streams-workflow-appends
Draft

moetemp wants to merge 7 commits into
moe/streams-apifrom
moe/streams-workflow-appends

Conversation

@moetemp

@moetemp moetemp commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

Workflow code can create, describe and append to Streams. Core runs the appends. Create and describe run as Local Activities, because Core has no commands for them. New Workflows turn off Workflow Task chunking.

Why?

A replay must give Workflow code the same append results without writing to the Store again. Core records each result in History, so the replay takes it from there. This needs Core up to #1882.

Reviewer's guide

Review after #2129.

  1. Read temporalio/worker/_workflow_streams.py and the bridge code that calls the Python Stores.
  2. Check StreamConfig in temporalio/streams.py, including what a selector must do on replay. Then check how Store names and limits reach Core.
  3. Check the chunking change and the Worker tests that replay appends.

Checklist

  • Run Python lint and the Stream tests.
  • Check the Producer identity and Workflow Task retries against a local server.

@moetemp
moetemp added this pull request to stack #2189 December 2, 2026 22:49
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from 029ddfb to e638446 Compare December 2, 2026 22:59
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch 2 times, most recently from b184ddb to e95bb88 Compare December 2, 2026 23:24
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from e95bb88 to 0676296 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-appends branch from 0676296 to bf26d40 Compare December 3, 2026 09:58
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from bf26d40 to 088aad0 Compare December 3, 2026 10:04
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from 088aad0 to 52c7788 Compare December 3, 2026 10:14
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from 52c7788 to 5eba2b6 Compare December 3, 2026 16:59
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch 4 times, most recently from b0794c6 to 73788b7 Compare December 4, 2026 00:26
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from f538dd2 to a26bb3c Compare December 5, 2026 00:53
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from a26bb3c to 54b45ce Compare December 5, 2026 06:52
Workflow code can't call a Store itself, since a replay must get the
same answers. Core runs each append on the Python Store through the
bridge and records its result in History, and a create or a describe
runs in a Local Activity of the SDK. In this commit a Workflow read
reaches that Local Activity, which refuses it, so the Workflow Task
fails.
A Stream create or describe runs as a Local Activity, and a Workflow
Task that waits for one can complete with no command. Chunking merges
such tasks in a replay, so Workflow code can get a result in another
activation than in the first run. Core records the choice in the first
completed Workflow Task, so a Workflow that started earlier keeps it.
Explain once why Workflow code never calls a Store: an append is a
Core command whose result a marker records, and create and describe
run as Local Activities. Say why the selector must be stable on
replay and why a Store outage fails the task. Only docstrings,
comments and the README change.
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from 54b45ce to 16248a2 Compare December 6, 2026 10:15

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