Eager BFS resolution: pre-resolve all reachable actions upfront#4297
Draft
stefanpenner wants to merge 2 commits intoactions:mainfrom
Draft
Eager BFS resolution: pre-resolve all reachable actions upfront#4297stefanpenner wants to merge 2 commits intoactions:mainfrom
stefanpenner wants to merge 2 commits intoactions:mainfrom
Conversation
Thread a cache through PrepareActionsRecursiveAsync so the same action is resolved at most once regardless of depth. Collect sub-actions from all sibling composites and resolve them in one API call instead of one per composite. ~30-composite internal workflow went from ~20 resolve calls to 3-4. Fixes actions#3731 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ons upfront Before the recursive composite walk begins, a BFS loop iteratively: 1. Resolves pending actions in one batch API call 2. Downloads all tarballs in parallel 3. Scans downloaded action.ymls for composite sub-action references 4. Feeds newly discovered actions back into the loop This collapses all network I/O into a tight loop so the recursive walk is purely local (zero API calls, zero downloads). Key design detail: uses separate tracking for downloads (keyed by owner/repo@ref) vs scans (keyed by owner/repo/path@ref) so that different sub-paths within the same repo tarball are each scanned for their composite children. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 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
Builds on #4296 (batch + dedup). Before the recursive composite walk begins, a BFS loop eagerly discovers, resolves, and downloads all reachable actions so the recursion makes zero network calls.
The loop iteratively:
Task.WhenAll)action.ymlfiles for composite sub-action referencesKey design detail
Uses separate tracking for downloads (keyed by
owner/repo@ref— path excluded, since sub-paths share one tarball) vs scans (keyed byowner/repo/path@ref— so each sub-path'saction.ymlis scanned for its composite children independently).Without this distinction, sub-path actions like
myorg/monorepo/L2-01@mainwould be skipped aftermyorg/monorepo@mainwas already downloaded, leaving deeper composites undiscovered until the recursive fallback.Smoke test results
Tested with a self-hosted runner built from this branch vs stock (
main), using a 50-action composite tree across 21 repos with 5 depth levels.Action graph:
Results (run) (more complex graph, with more nested unique downloads)
main)With cached downloads (
ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE)When tarball downloads are instant (local cache / symlink), the bottleneck is purely resolve API calls:
Where the 4 calls come from
Each BFS wavefront discovers new repos that weren't in the previous wavefront's tarball:
checkout@v4+shard-1..5@main+resolution-test@main(7 unique)shard-6..10@main(5 new, discovered from L1 action.ymls)shard-11..15@main(5 new, from L2 action.ymls)shard-16..20@main(5 new, from L3 action.ymls)After wave 4, L4 composites reference
shard-1..5which are already downloaded → BFS terminates. Recursion finds everything cached.Test plan
ActionManagerL0tests pass (no regression)PrepareActions_EagerResolution_AllDownloadsBeforeRecursion— verifies all watermarks from earlier BFS wavefronts exist by the time the last resolve fires🤖 Generated with Claude Code