Fail fast in df.start() when the engine hand-off fails#282
Merged
Conversation
df.start() writes its df rows in the caller's transaction and hands the workflow to the durable engine over a separate connection. A failed hand-off was swallowed (logged), so the caller committed an instance row for a workflow that never started and would never run. Raise on a failed hand-off instead, aborting the caller's transaction so the instance rows roll back with it. The caller gets a clear, retryable error rather than a silently stuck instance. The pgrx unit-test build does not run the background worker, so the hand-off always fails there; that build logs instead of aborting (matching the existing validate_database test-build carve-out) so df.start()'s graph construction stays unit-testable. Test: tests/e2e/sql/25_start_fail_fast.sql.
This was referenced Jul 1, 2026
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.
Problem
df.start()writes itsdf.instances/df.nodesrows in the caller's transaction, then hands the workflow to the durable engine over a separate connection. If that hand-off fails, the error is currently swallowed (logged) anddf.start()returns normally — so the caller commits an instance row for a workflow that was never started and will never run.Change
On a failed hand-off,
df.start()now raises, aborting the caller's transaction so the instance rows roll back with it. The caller gets a clear, retryable error instead of a silently stuck instance.The pgrx unit-test build does not run the background worker, so the hand-off always fails there; that build logs instead of aborting (matching the existing
validate_databasetest-build carve-out) sodf.start()'s graph construction stays unit-testable.Tests
tests/e2e/sql/25_start_fail_fast.sqlforces the hand-off to fail (marks the worker not-ready) and assertsdf.start()raises and commits no row, then confirms a normal start still completes once readiness is restored.Local: unit 194 · E2E 37 · upgrade 36 · fmt/clippy clean.