Skip to content

Preserve Workflow Streams after workflow closure - #976

Draft
brianstrauch wants to merge 1 commit into
mainfrom
codex/preserve-workflow-streams-after-closure
Draft

brianstrauch wants to merge 1 commit into
mainfrom
codex/preserve-workflow-streams-after-closure

Conversation

@brianstrauch

@brianstrauch brianstrauch commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

What was changed

Active subscriptions continue polling through Updates. After Describe confirms completion, failure, cancellation, termination, or timeout, subscriptions query the confirmed run for all remaining retained pages and finish after final delivery. The synchronous __temporal_workflow_stream_poll Query shares PollInput/PollResult and read-only batch collection with the Update. It returns immediately and clamps stale offsets to the retained base.

Accepted-run tracking is local to each subscription attempt. Query errors, failed descriptions, and unconfirmed closure remain errors; terminal reads stay pinned across workflow ID reuse. Existing truncation, draining, cancellation, conversion, and continue-as-new behavior is preserved.

The reserved Query exception is exact; linked cancellation, RPC timeouts, disposal, and independent reusable enumerations remain intact.

Why?

Subscribing after closure, or closing a run during an accepted poll, could previously end the subscription before its unread retained tail was delivered. Query draining makes retained stream contents available after closure without adding history events.

Checklist

  1. How was this tested:
  • Native Workflow Streams suite: all 40 tests passed with CARGO_INCREMENTAL=0.
  • Managed client/wire/reserved-name regressions: 15 tests passed.
  • Managed compilation with analyzers, formatting verification, and package/API validation passed.
  • Covered every terminal status, cold replay/unchanged history, pagination/filtering/truncation, reusable enumerations, ID reuse, rejection/missing handlers, malformed Describe, and the shared wire vector.
  • The incremental native build was killed by a machine command-line filter matching a substring in a generated object filename; disabling Cargo incremental compilation allowed the native build and tests to complete without changing security settings.
  • Local validation used the implementation checkout; CI will validate the current-main base.
  1. Any docs updates needed?

Updated the stream guide/API comments and release notes. Workers must be upgraded before upgraded clients use closed-stream reads; retained history and an available compatible worker are required.

  1. Breaking changes / Server PR:

Subscription signatures and existing wire types are unchanged. No Server, Core, or protobuf change is required. Upgraded clients surface missing poll Query errors from older workers.

Coordinated SDK PRs

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