Skip to content

feat: add resurrect_with_parent for aborted child runs - #1271

Open
vdusek wants to merge 1 commit into
fix/abort-unnamed-child-runsfrom
feat/resurrect-child-runs-with-parent
Open

vdusek wants to merge 1 commit into
fix/abort-unnamed-child-runsfrom
feat/resurrect-child-runs-with-parent

Conversation

@vdusek

@vdusek vdusek commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Part 4 of 7 of the target state of Actor composability, section 8.3. Stacked on #1250.

  • New option resurrect_with_parent: bool | None = None on Actor.start, Actor.call, Actor.start_task, and Actor.call_task. It is stored in the record the same way as abort_with_parent.
  • On ABORTING, the SDK sets abortedWithParent in the records of the runs it aborts. It writes the registry once before it sends the abort requests, and once more with what the requests returned.
  • In a later process of the parent, a call under the key resurrects the ABORTED run, clears abortedWithParent, and returns the active run. A run that is still ABORTING is waited for first. If the resurrect request fails, the call raises and the record stays as it is.
  • A run whose abort request fails does not keep abortedWithParent. A call that sees the run in another status than ABORTING or ABORTED clears the flag.
  • The write of the flags has its own limit of 2 seconds, so a slow key-value store does not stop the abort requests.
  • The SDK never resurrects a child that failed, timed out, or was aborted by someone else.

Two known gaps of the specification are handled this way:

  • A run that was already recorded as finished before the abort does not get abortedWithParent, unless the abort request returns it ABORTING.
  • Before the first resurrection in a process, the SDK asks the API whether the parent run itself is ABORTING. If it is, the process resurrects nothing. This covers a parent that is migrated or rebooted while it is being aborted.

An E2E test covers the whole path: the parent is aborted, the child is aborted with it, the parent is resurrected, and the same call resurrects the child.

✍️ Drafted by Claude Code

@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Nov 20, 2026
@vdusek
vdusek added this pull request to stack #1274 November 20, 2026 16:35
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.07407% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.09%. Comparing base (9c926b6) to head (3c84975).

Files with missing lines Patch % Lines
src/apify/_child_runs.py 98.92% 1 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##           fix/abort-unnamed-child-runs    #1271      +/-   ##
================================================================
+ Coverage                         93.94%   94.09%   +0.14%     
================================================================
  Files                                54       54              
  Lines                              4014     4115     +101     
================================================================
+ Hits                               3771     3872     +101     
  Misses                              243      243              
Flag Coverage Δ
e2e 30.74% <17.59%> (-0.38%) ⬇️
integration 49.42% <17.59%> (-0.88%) ⬇️
unit 91.49% <99.07%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek added the adhoc Ad-hoc unplanned task added during the sprint. label Nov 20, 2026
@vdusek vdusek self-assigned this Nov 20, 2026
@vdusek
vdusek force-pushed the feat/resurrect-child-runs-with-parent branch from 0b5b934 to 2ad4871 Compare November 20, 2026 17:52
@vdusek
vdusek marked this pull request as ready for review November 20, 2026 17:58
@vdusek
vdusek requested review from Pijukatel and barjin November 20, 2026 17:58
@vdusek
vdusek force-pushed the feat/resurrect-child-runs-with-parent branch from 2ad4871 to 3c84975 Compare November 20, 2026 18:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant