Node state-transition model#263
Open
pinodeca wants to merge 3 commits into
Open
Conversation
…s_new df.loop called continue_as_new inline in the main orchestration, so every new generation restarted from graph.root_node_id, re-executing prefix nodes on every iteration. Each df.loop() node now spawns a dedicated child sub-orchestration (execute_loop) that owns continue_as_new; the parent awaits it and runs any suffix nodes exactly once. Relies on duroxide PR #31 (parent link preserved across continue_as_new), pulled in as a git dependency until merged and released. Co-authored-by: copilot-swe-agent <copilot@github.com> Co-authored-by: pinodeca <32303022+pinodeca@users.noreply.github.com>
Nested loops and loop bodies containing JOIN/RACE branches hung forever
because duroxide auto-generated child instance IDs ({parent}::sub::{event_id})
reset their event counter on each continue_as_new generation, so every loop
generation re-derived the same child ID and collided with the previous
(now terminal) child.
Use schedule_sub_orchestration_with_id with a deterministic,
generation-qualified child ID ({instance}::e{execution_id}::{tag}::{node_id})
at all loop/join/race spawn sites.
Add nested-loop, loop-in-JOIN-branch, and non-root while-loop regression
tests, and a USER_GUIDE note that each df.loop runs as its own child
orchestration.
68283e0 to
44c171e
Compare
pinodeca
added a commit
that referenced
this pull request
Jun 23, 2026
Adds docs/node-state-model.md, a design proposal consolidating the node-status work for issues #240 (skipped downstream nodes) and #171 (race-loser nodes left running/pending). Defines instance and node lifecycle states, legal transitions, a coarse status set plus nullable status_reason, loop iteration-scoping/reset semantics, and prior-art alignment with Airflow/Temporal/BPMN/Step Functions. The #240 skipped-node work shipped earlier in PR #249; this PR (#263) defines the consolidated model and will add the remaining implementation (cancelled, status_reason, race-loser reconciliation, loop reset) after review. Design only; implementation to follow on this PR.
Squash of the node-state-model proposal, the execution-id proposal, and the temporary exec-id implementation plan. Rebased onto the df.loop sub-orchestration fix (PR #228, copilot/fix-loop-restart-issue).
73d219d to
7ab6b3f
Compare
3a4255f to
b26327a
Compare
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
Introduces a formal node & instance state-transition model for
pg_durable, then implements it. This consolidates two related node-status gaps:running/pendingafter aRACEresolves; they should reach a terminal state.skipped(initialskippedsupport landed in WIP: start issue #240 implementation for skipped downstream node status #249; this PR formalizes the model and itsstatus_reason).What's here now
The first commit adds the design proposal: docs/node-state-model.md. It defines:
pending,running,completed,failed,skipped,cancelled) plus a nullablestatus_reason(upstream_failed,branch_not_taken,race_lost,scope_cancelled) — avoiding an ever-growing enum under the strict schema-upgrade contract.THEN/IF/LOOP/JOIN/RACE/BREAK).df.nodesrow behaves acrosscontinue_as_new, and the body-subgraph reset that prevents stale terminal marks leaking between iterations.ContinueAsNew), BPMN 2.0 (withdrawn), and AWS Step Functions.pending → skippedterminal sweep) and df.instance_nodes leaves race-loser nodes running or pending after race completion #171 (running → cancelledsubtree reconciliation at race resolution).Plan
This PR starts as a design proposal for review. After incorporating colleague feedback, the implementation (status set additions,
status_reasoncolumn, race-loser reconciliation, and loop-reset) will land on this same PR.Upgrade & migration
The model is explicit about backward compatibility: new status/
status_reasonrequire install + upgrade DDL, and every reconciliation activity must no-op gracefully against schemas that predate the relevant column/status (the schema-probe pattern already used forskipped).