Skip to content

[Brook] Added the Activity and client stream handles over Core. - #154

Closed
moetemp wants to merge 9 commits into
moe/brook/v2/p2e-provider-pluginfrom
moe/brook/v2/p3b-outside-handles
Closed

moetemp wants to merge 9 commits into
moe/brook/v2/p2e-provider-pluginfrom
moe/brook/v2/p3b-outside-handles

Conversation

@moetemp

@moetemp moetemp commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR adds the stream handles an Activity and a client use to read and write a Workflow's stream through Core.

  • get_stream_handle() and activity_handle() return a StreamHandle with read, latest and producer.
  • A producer hashes before the codec, encodes the bodies and calls the generated append. It moves its sequence only when an append succeeds.
  • An Activity sends a typed ActivityProducer and Core derives <activity id>@<scheduling run id>, so every SDK writes the same producer id (DD-44).
  • Every read follows the run chain across Continue-as-New and ends only with the chain. chain_run_id= opens an older chain of a reused Workflow id. An Activity's handle names its scheduling run's chain, so its appends land there.
  • Reads are long polls that hand back Core's state. Both sides use the Workflow's WorkflowSerializationContext, so a context-aware codec decodes the records.
  • A Local Activity gets StreamUnsupportedError. Its attempt isn't durable, so its first append after a crash would be refused as stale.
  • The changelog fragment says what Brook ships. Activities and clients append, and outside readers follow from a cursor.

Why?

Core owns owner checks, cursors, dedupe and supersession. So a handle is a thin loop over the stub with the codec on both sides (DD-88).

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

tests/contrib/streams/test_outside_handles.py runs on the dev server.

@moetemp

moetemp commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Combined into #241.

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