Skip to content

Preserve Workflow Streams after workflow closure - #3160

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.

Listener completion waits until the final delivery stage finishes, preserving backpressure.

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:
  • Workflow Streams suite: 46 tests passed against both the in-process test server and dev server.
  • Final malformed-Describe/run-ID guards passed the 4 focused driver tests.
  • Spotless passed.
  • Covered terminal statuses, pinned pagination and ID reuse, cold replay/unchanged history, wire compatibility, error propagation, and listener backpressure through final-page completion.
  • 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