Skip to content

Preserve sub-orchestration parent link across ContinueAsNew#31

Open
pinodeca wants to merge 3 commits into
mainfrom
pinodeca/continue-parent-link
Open

Preserve sub-orchestration parent link across ContinueAsNew#31
pinodeca wants to merge 3 commits into
mainfrom
pinodeca/continue-parent-link

Conversation

@pinodeca

Copy link
Copy Markdown
Contributor

Preserves the parent link when a sub-orchestration rolls over with ContinueAsNew, so the logical child can still notify its parent when a later execution completes or fails.

Summary:

  • Derive ContinueAsNew parent linkage from the previous execution history in WorkItemReader.
  • Preserve the same link in the dispatcher poison/new-history path.
  • Add an e2e regression where a parent awaits a child that continues-as-new multiple times before completing.

Validation:

  • cargo fmt
  • cargo nt -E 'test(test_workitem_reader_with_can) | test(test_workitem_reader_can_preserves_parent_link_from_history) | test(test_workitem_reader_can_carry_forward_prepended) | test(sample_sub_orchestration_continue_as_new_fs)'

None,
history_mgr.parent_instance.clone(),
history_mgr.parent_id,
Some(carry_forward_events.clone()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we wire this into WorkItem::ContinueAsNew event directly instead of pulling from the history?
Needs to be backcompat though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4f9d29c. The parent link (parent_instance/parent_id) is now stamped directly onto WorkItem::ContinueAsNew by the CAN producer in execution.rs, and the consumers read it from the work item.

For backcompat, both new fields are #[serde(default)] + skip_serializing_if, so old enqueued messages deserialize cleanly and the wire format is unchanged. To stay correct during rolling upgrades (a CAN enqueued by an older node that didn't stamp the fields), the consumers fall back to deriving the link from the previous execution's history when the fields are absent. Added test_workitem_reader_can_preserves_parent_link_from_work_item for the direct path and kept ..._from_history for the fallback path.

pinodeca added 2 commits June 22, 2026 19:34
Address review feedback: wire parent_instance/parent_id directly into
WorkItem::ContinueAsNew instead of deriving solely from prior execution
history. Fields are optional (#[serde(default)]) for backward compatibility;
consumers fall back to history for messages enqueued by older runtimes.
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.

2 participants