Skip to content

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

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

moetemp wants to merge 4 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

This PR lets Workflow code create, describe and append to Streams. Core runs appends.
Create and describe use Local Activities. New Workflows disable Workflow Task chunking.

Why?

Replay must return the same append results without repeating Store writes.
Core records these results in History. This needs Core through
#1882.

Reviewer's guide

Review after #2129.

  1. Read temporalio/worker/_workflow_streams.py and the bridge that calls Python Stores.
  2. Check how StreamConfig supplies Store names and limits to Core.
  3. Check the Workflow Task chunking change and worker-level append replay tests.

Checklist

  • Run Python lint and focused Stream tests.
  • Check 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
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.
@moetemp
moetemp force-pushed the moe/streams-workflow-appends branch from 088aad0 to 52c7788 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