Speculative Checks
Instead of waiting for each PR to complete, the queue can test multiple PRs in parallel by assuming earlier PRs will pass.
Sequential vs Speculative
Section titled “Sequential vs Speculative”Sequential approach — each PR waits for the previous one to finish:
Speculative approach — all PRs test in parallel, assuming earlier ones will pass:
3x faster!
How It Works
Section titled “How It Works”- PR #1 enters the queue → test against
main - PR #2 enters the queue → test against
main + PR #1(assuming #1 will pass) - PR #3 enters the queue → test against
main + PR #1 + PR #2(assuming both will pass)
All three tests run simultaneously.
When Speculation Fails
Section titled “When Speculation Fails”If PR #1 fails, the speculation for PRs #2 and #3 was wrong. They were tested against a state that will never exist.
What happens:
- PR #1 is removed from the queue
- PRs #2 and #3 are automatically re-queued
- PR #2 now tests against
main(notmain + PR #1) - PR #3 tests against
main + PR #2
The speculation was wrong, but we only lost the time for one CI run. On average, this is still much faster than sequential testing.
Speculation Depth
Section titled “Speculation Depth”You can limit how far ahead the queue speculates:
| Depth | Behavior |
|---|---|
| 1 | No speculation (sequential) |
| 3 | Test up to 3 PRs ahead |
| Unlimited | Test all PRs in parallel |
Higher depth = more parallelism but more wasted CI if early PRs fail.
Best For
Section titled “Best For”- Teams with high PR volume
- Codebases with low failure rates in the queue
- When CI resources are not a constraint