Harden runtime lease recovery and event publishing#15
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThe workflow core now supports checkpoint recovery for reclaimed runs. The runtime renews active leases, recovers stale executions during sweeps, exposes recovery limits and results, and supports best-effort live event publishing through configured or per-call publishers. ChangesWorkflow runtime reliability
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant WorkflowRuntime
participant ExecutionStore
participant RunWorkflow
participant EventPublisher
WorkflowRuntime->>ExecutionStore: claim stale execution
WorkflowRuntime->>RunWorkflow: drive with recovery enabled
RunWorkflow->>ExecutionStore: replay checkpoints
RunWorkflow-->>WorkflowRuntime: emit workflow events
WorkflowRuntime->>EventPublisher: best-effort publish events
WorkflowRuntime-->>WorkflowRuntime: return recovered result
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Contributor
🚀 Changeset Version Preview2 package(s) bumped directly, 6 bumped as dependents. 🟩 Patch bumps
|
More templates
@tanstack/react-template
@tanstack/react-template-devtools
@tanstack/solid-template
@tanstack/solid-template-devtools
@tanstack/template
@tanstack/template-devtools
@tanstack/workflow-cloudflare
@tanstack/workflow-core
@tanstack/workflow-netlify
@tanstack/workflow-railway
@tanstack/workflow-runtime
@tanstack/workflow-store-cloudflare-d1
@tanstack/workflow-store-drizzle-postgres
@tanstack/workflow-vercel
commit: |
tannerlinsley
marked this pull request as ready for review
July 21, 2026 21:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
sweep()by replaying durable checkpointsWhy
The execution-store contract already supported lease heartbeats and stale-run claims, but the runtime driver did not use them. A worker crash could therefore leave a run stuck as
running, while long steps could outlive their lease. The runtime also collected core events to completion without exposing core's live publisher hook.This makes leases operational, gives sweeps a complete crash-recovery path, and provides the live event seam needed by streaming integrations without changing durable event semantics.
Impact
Existing workflows continue to run unchanged.
sweep()now returns arecoveredcollection and acceptsmaxRecoveredRuns. Valid lease durations behave as before; invalid non-positive or non-finite durations now fail before mutating the store.Validation
pnpm test:prSummary by CodeRabbit
New Features
Documentation
Tests