Skip to content

Added the stream records, commands, events, and task carriage. - #1

Open
moedash wants to merge 9 commits into
mainfrom
moe/AI-198-stream-protos
Open

moedash wants to merge 9 commits into
mainfrom
moe/AI-198-stream-protos

Conversation

@moedash

@moedash moedash commented Sep 14, 2026

Copy link
Copy Markdown
Owner

What changed?

This PR adds the public API surface for server-side streams: the two stream commands, the two event types, and the Workflow Task fields that carry consumed ranges. OpenAPI specs are regenerated. from_offset and to_offset carry an AIP-140 exemption, a rename would ripple into every vendored and generated copy.

The record is the wire format. StreamRecord carries its kind (StreamRecordKind, unspecified reads as data), producer_id (empty when the owning Workflow wrote it), attempt and sequence next to body, metadata and topic, so every store keeps the same bytes and a payload codec applies to body like to any other payload. The command is AppendStreamRecords, the event is WorkflowStreamRecordsAppended with a record_count, a consumed range is a StreamRange, and WorkflowTaskCompletedEventAttributes.consumed_stream_ranges sits at the end of the message. Three WorkflowTaskFailedCause values are added for a refused AppendStreamRecords command, a refused SubscribeStream command, and a task whose recorded stream range can no longer be served. The SubscribeStreamCommandAttributes.stream_id comment states that an owned name is resolved before a standalone id.

Fixes AI-198

Why?

A workflow's publish has to commit with its Workflow Task, and its reads have to be replayable. That needs first-class commands and events, not markers. Everything server-side in the prototype builds on these protos.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

buf lint, buf breaking against upstream main, api-linter and the codegen checks are green in CI. The server PR's functional tests exercise these shapes end to end.

@moedash moedash closed this Sep 16, 2026
@moedash moedash reopened this Sep 16, 2026
A half-open range reads as `from_offset`/`to_offset` in the server's own
protos, and AIP-140 rejects both names.
`make http-api-docs` picks up the stream slices on the poll response and
the two new event types, so the committed specs were stale.
The server fails the task instead of the RPC when a stream command is rejected or a recorded range cannot be served, and needs causes the SDK can show.
The publish command comment claimed no event. The run id, message fields and name precedence had no comments.
The record is the wire format every store keeps and every language reads, so it carries its kind, producer, attempt and sequence itself instead of a private envelope inside the body. The body is the user's payload, so a codec applies to it like to any other payload.
The SDKs call an entry a record and a cursor a single position, and `temporal.api` already uses "message" for protocol envelopes. One noun on the wire keeps History readable next to user code.
@moedash moedash changed the title Added the stream messages, commands, events, and task carriage. Added the stream records, commands, events, and task carriage. Sep 21, 2026
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