feat(speculation): allocator contract and sticky impl - #450
Open
behinddwalls wants to merge 1 commit into
Open
Conversation
This was referenced Jul 28, 2026
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
from
July 28, 2026 19:32
86a9654 to
10e097e
Compare
behinddwalls
marked this pull request as ready for review
July 28, 2026 19:59
sbalabanov
requested changes
Jul 28, 2026
sbalabanov
left a comment
Contributor
There was a problem hiding this comment.
critical comment about failing fast
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
2 times, most recently
from
July 29, 2026 18:24
bf09ae6 to
6977b91
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
2 times, most recently
from
July 29, 2026 22:41
d6f1dfe to
af1efe4
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
2 times, most recently
from
July 29, 2026 23:18
2b3a122 to
32e21b9
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
from
July 29, 2026 23:18
32e21b9 to
00ca258
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
from
July 30, 2026 01:19
00ca258 to
80c246f
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
from
July 30, 2026 07:31
80c246f to
0049b73
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
from
July 31, 2026 18:50
0049b73 to
992f696
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
2 times, most recently
from
August 3, 2026 23:03
8a57108 to
9f63cad
Compare
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
from
August 4, 2026 01:58
9f63cad to
5a83bb7
Compare
This was referenced Aug 4, 2026
## Summary ### Why? Ranked candidates need a budget policy: something must decide which paths get the queue's limited concurrent-build slots, without double-funding paths that are already running or finished. ### What? Adds `submitqueue/extension/speculation/allocator` — the budget-spending contract the standard Speculator hands its candidate stream to — plus the `sticky` implementation and mocks. The Allocator owns terminal-path suppression: it reconciles the stream against the stored path sets by path ID, so an in-flight candidate keeps the slot it already holds and a terminal one is skipped. Budget accounting reads path status and nothing else — pending, building, and cancelling paths hold a slot until their builds actually stop — and the unit is deliberately coarse: one slot per concurrent build. `sticky` fills only free slots and never preempts a running build; its policy counterpart is a preempting allocator. Output is all-or-nothing (a partial list would fund an arbitrary prefix of the ranking), and a stored path with no status fails fast rather than guessing whether it holds a slot. ## Test Plan ✅ `bazel test //submitqueue/extension/speculation/allocator/...` — terminal candidates skipped per status, in-flight candidates kept, budget exhaustion, context cancellation, corrupt-status failure. ✅ `make fmt`, `make gazelle`, `make mocks`
behinddwalls
force-pushed
the
preetam/speculation-allocator
branch
from
August 4, 2026 05:11
5a83bb7 to
23a30ad
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
Why?
Ranked candidates need a budget policy: something must decide which paths get the queue's limited concurrent-build slots, without double-funding paths that are already running or finished.
What?
Adds
submitqueue/extension/speculation/allocator— the budget-spending contract the standard Speculator hands its candidate stream to — plus thestickyimplementation and mocks.The Allocator owns terminal-path suppression: it reconciles the stream against the stored path sets by path ID, so an in-flight candidate keeps the slot it already holds and a terminal one is skipped. Budget accounting reads path status and nothing else — pending, building, and cancelling paths hold a slot until their builds actually stop — and the unit is deliberately coarse: one slot per concurrent build.
stickyfills only free slots and never preempts a running build; its policy counterpart is a preempting allocator. Output is all-or-nothing (a partial list would fund an arbitrary prefix of the ranking), and a stored path with no status fails fast rather than guessing whether it holds a slot.Test Plan
✅
bazel test //submitqueue/extension/speculation/allocator/...— terminal candidates skipped per status, in-flight candidates kept, budget exhaustion, context cancellation, corrupt-status failure.✅
make fmt,make gazelle,make mocksIssues
Stack