You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A branch's duration estimate falls back to the all-branch figure once 20+ newer runs exist on other branches #373
DurationEstimator.EstimateDuration (BuildMonitor/DurationEstimator.cs ~L41-64) takes the 20 most recent successful runs across all branches first. Only then does it filter that sample by branch:
So a branch only gets its own estimate when at least MinSamplesForEstimate of its successes are among the 20 newest successes of the whole workflow.
Failure scenario
A repository's CI workflow has frequent PR and dependabot runs.
Within the last 20 successful runs, main has fewer than three. Runs are never pruned and every poll adds more, so this is common on an active repository.
build.CalculateEstimatedDuration("main") (BuildMonitor.cs:889) finds too few main runs in that sample and silently falls back to the all-branch estimate.
If main runs take a different length of time, for example because they also pack and release, everything derived from that estimate is wrong for main:
the shown estimate
the ETA
the progress ring
the RunSync poll interval (Run.CalculateETA → RunSync.cs)
This happens even though main may have plenty of history just outside the window.
The existing test ABranchWithEnoughHistoryUsesItsOwnEstimate uses only a handful of runs, so it never reaches the 20-run cap.
Suggested fix
Filter by branch before Take(MaxSamplesToConsider), so the branch estimate uses that branch's own 20 most recent successes.
Keep a separate top-20 across all branches for the fallback.
GetEstimationStats (~L205-212) does the same thing; fix it the same way or remove it if it is unused.
Add a test: 5 older main successes of one duration, then 20+ newer successes on another branch of a very different duration. The main estimate must reflect the main runs.
Area / suggested assignment:DurationEstimator.EstimateDuration and GetEstimationStats (BuildMonitor/DurationEstimator.cs), plus the CalculateEstimatedDuration and Run.CalculateETA → RunSync consumers. Owner: @matt-edmondson
Duplicates / in progress: Not a duplicate, and no open PR in BuildMonitor. Related:
Next step: filter by branch before Take(MaxSamplesToConsider). Keep a separate all-branch top-20 for the fallback. Then add the suggested test: 5 older main runs, followed by 20+ newer runs on another branch with a very different duration.
Activity
matt-edmondson commentedon Oct 19, 2026
Triage
main(or any branch that runs less often) silently gets the all-branch duration estimate. Its ETA, progress ring and RunSync poll interval are then wrong. No data is lost, and the fallback is a plausible number, so this is wrong rather than broken. It gets worse over time because runs are never pruned (Runs are never pruned, so every branch that ever ran keeps its own table row forever and the app data file grows without bound #313).DurationEstimator.EstimateDurationandGetEstimationStats(BuildMonitor/DurationEstimator.cs), plus theCalculateEstimatedDurationandRun.CalculateETA→RunSyncconsumers. Owner: @matt-edmondsonmainfeeds the same poll-interval path.mainfaster.Take(MaxSamplesToConsider). Keep a separate all-branch top-20 for the fallback. Then add the suggested test: 5 oldermainruns, followed by 20+ newer runs on another branch with a very different duration.Generated by Claude Code