Skip paths archive sibling messages but never terminalize sibling step_tasks rows, leaving status='started' tasks on completed runs - #649
Merged
Conversation
🦋 Changeset detectedLatest commit: 10e698a The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
View your CI Pipeline Execution ↗ for commit a9045de
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
jumski
force-pushed
the
issue-638-terminalize-skipped-tasks
branch
from
August 27, 2026 18:48
5ec80bf to
70395b4
Compare
jumski
force-pushed
the
issue-638-terminalize-skipped-tasks
branch
from
August 28, 2026 06:54
70395b4 to
a9045de
Compare
Contributor
Author
Skip paths archived sibling queue messages but left their step_tasks rows queued/started, so completed runs carried active task rows (#638). fail_task and _cascade_force_skip_steps now terminalize active sibling tasks first via UPDATE ... RETURNING capturing message_ids, then archive only those ids. This enforces step_tasks-before-PGMQ lock order and fixes a reproduced deadlock against requeue_stalled_tasks, which locks task rows before queue rows. start_tasks returned pre-update candidates; when a concurrent skip won the task-row lock, the guarded UPDATE claimed zero rows yet start_tasks still returned the task, so workers executed skipped handlers. The tasks CTE is now the UPDATE ... RETURNING itself; all downstream CTEs and the result consume only claimed rows. Rejected alternative: joining the guarded update by run_id+step_slug+task_index produced a quadratic plan (~20s with 10k map tasks). Kept the indexed message_id+flow_slug+status='queued' predicate (max ~6ms). Migration regenerated as 20260827180017_pgflow_terminalize_skipped_tasks.sql: adds 'skipped' to valid_status, installs both functions, and backfills orphaned active tasks under skipped steps (failed-run rows out of scope, #645). Tests: returns_only_claimed_tasks.test.sql (suppressed-claim regression), queue-order trigger in skip_archives_sibling_messages.test.sql; full suite 280 files / 1262 assertions pass.
jumski
force-pushed
the
issue-638-terminalize-skipped-tasks
branch
from
August 28, 2026 07:08
a9045de to
10e698a
Compare
Contributor
🚀 Production Deployment: Website✅ Successfully deployed to production! 🔗 Production URL: https://pgflow.dev 📝 Details:
Deployed at: 2026-08-28T09:20:29+02:00 |
Contributor
🔍 Preview Deployment: Website✅ Deployment successful! 🔗 Preview URL: https://pr-649.pgflow.pages.dev 📝 Details:
_Last updated: _ |
10 tasks
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.

Summary
skippedas a terminalstep_tasks.statusvalue.fail_taskor_cascade_force_skip_stepsskips their parent step, while preserving message archival, events, counters, callbacks, and return values.@pgflow/corepatch changeset.Checks
pnpm nx verify-migrations core --skip-nx-cachepnpm nx gen-types core --skip-nx-cachewith no generated type diffpnpm nx verify-gen-types core --skip-nx-cachepnpm nx test:pgtap core --skip-nx-cache— 279 files, 1,259 testsfailed,completed,started,queuedbecomesfailed,completed,skipped,skipped/usr/bin/git diff-tree --check HEAD^ HEADpnpm nx fix-sql corehits the existing local toolchain errorsqruff: error: unexpected argument '--force' found; direct Sqruff formatting reported no changes.Closes #638