Conversation
vdusek
added this pull request to stack #1152
September 30, 2026 17:17
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/child-run-concurrency-limit #1155 +/- ##
====================================================================
+ Coverage 93.29% 93.36% +0.06%
====================================================================
Files 54 54
Lines 3804 3916 +112
====================================================================
+ Hits 3549 3656 +107
- Misses 255 260 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Stacked on #1154.
When the parent run was started with a
max_total_charge_usd, its named child runs share that budget. A namedActor.startorActor.callreserves a charge limit for its child from the part of the budget the parent hasn't charged or reserved for other children. Without an explicitmax_total_charge_usdthe child gets all of that part, and a higher value is lowered to it. A start in flight counts as reserved, so parallel starts can't overspend. When the budget is used up, a named start raises aRuntimeError.The reservations live in the child run registry, so they survive a migration of the parent.
ChargingManagersubtracts them from the parent's own remaining budget, which keeps the whole tree of runs within the limit. When a child finishes, only itsusage_total_usdstays reserved. A failed child that gets replaced keeps its charge counted, and a resurrected child gets a new limit that includes its own earlier reservation. Runs without anamearen't tracked and pass their limit through unchanged.Two differences from the proposal in the issue, both based on apify-core:
isMaxTotalChargeUsdSetByUser. That flag is read once from the parent run.usageTotalUsdkeeps growing for about 3 minutes after a run finishes, so an early read under-reports the charge. The SDK re-reads a finished child until then and only stores the charge as final after that.Closes #1139
✍️ Drafted by Claude Code