Repository navigation
test(perf): replace 20 absolute wall-clock budgets with runner-calibrated work units (#15055) - #15207
Merged
Merged
Conversation
…ated work units (#15055)
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
…clear the 600-line ceiling (#15055)
This was referenced Aug 28, 2026
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.
Thinking Path
autobot-backend/system_benchmarks_performance_test.pycontained 20 assertions comparingwall-clock milliseconds against a hardcoded constant.
:311(processor_startup_time < 500.0)is the one that fired: passed on run 32837489748, failed on 32839088246 (547.2ms) and
33154304714 (538.9ms).
I confirmed the load-not-code claim rather than inheriting it.
git diff --stat 591c0a080 90d88bb60is one file,repo_tests/tests_that_return_instead_of_asserting_test.py, which thatselection deselects; the same diff scoped to the benchmark module is empty. One test flipped
pass to fail with no reachable code change.
Raising the number was not an option and neither was deleting the check. What I did instead is
the move this repository has already made twice: measure the quantity the assertion always
meant. #14930 turned an absolute RSS ceiling into an RSS delta; #13162 replaced two clock
races in this same file with the properties they were proxying (cache identity, peak
concurrency). The clock budgets had never had that treatment.
Two defects were hiding behind one symptom, and CI proved the second one.
ratio against a work unit — the cost of a fixed, deterministic slice of pure-Python work
measured in the same process, in the same moment. A runner that is uniformly slow inflates
numerator and denominator alike and the ratio holds.
component is now constructed once and discarded, then measured on a second construction, so
the number excludes the one-time lazy
import torchthat lands on whichever test constructsfirst. My first commit asserted that this one-time import was most of the 500ms. CI
falsified that: run 33156790797 put the WARM construction at 466.351ms. The constructor
genuinely costs that on every instantiation, so the 500ms constant sat about 7% above
the true per-construction cost — and a budget with 7% of headroom does not need runner
weather to become a coin toss, it only needs a little. Raising the constant would have bought
a green run or two and nothing more.
The 466ms is recorded as suspect, not blessed: #15054 has
VisionProcessor's CLIP load raisingTypeErroron the pinned transformers, so that constructor is timed on an error path. Itsbudget is documented as a ceiling to ratchet down once #15054 lands.
What Changed
autobot_shared/perf_work_budget.py(new) — the unit, the calibration, the assertion andthe doctrine, following
autobot_shared/live_service_probe.py, the test-support module #14930added for the same suite. Shared rather than local so
performance_benchmarks_test.pycan adoptit.
assert_within_work_budgetfails on three distinct conditions: over budget, nothingmeasured, and calibration measured nothing.
autobot_shared/perf_work_budget_test.py(new, 8 tests) — guards on the harness itself,deliberately unmarked so they run in the normal gate rather than the marker-excluded one.
autobot-backend/system_benchmarks_performance_test.py— all 20 sites converted. Finalbudgets and the units CI reported on run 33161132835:
< 1.0ms< 50.0ms< 2.0ms< 5.0ms< 100.0ms< 500.0ms< 10.0ms< 15.0ms< 1.0ms< 5.0ms< 100.0ms:311, the flake)< 500.0ms< 200.0ms< 1000.0ms< 10.0ms< 5.0ms< 25.0ms< 500.0ms< 100.0ms< 2000.0msNot one hardcoded millisecond budget remains. Budgets were derived from observation, not
comfort: five local runs gave a per-site high, run 33156790797 measured the local-to-CI
conversion (
Config manager startup0.459 local vs 1.474 CI, so ~3.2x), and after the firstgreen run I ratcheted them down to 8x the highest observation (3x for the large steady
sites) —
Memory manager startupcame down from a 20-unit first-observation ceiling to 1.0,Large config file loadingfrom 1300 to 420,Single multimodal processingfrom 150 to 50.Site 12 is the one deliberately wide budget, and the reason is in the file: it read 315.602,
177.909 and 114.306 units across three CI runs — a 2.76x spread in the ratio, not merely in
the milliseconds. Calibration cannot normalise it, because the cost is model-file and HF-cache
disk I/O and a CPU-bound yardstick does not track a disk-bound numerator. 600 is ~1.9x the worst
reading. That limitation is stated rather than hidden.
Also:
measure_execution_time/measure_async_execution_timeusetime.perf_counter()instead oftime.time()— a duration needs the monotonic clock; a wall-clock delta can go backwardsacross an NTP step.
only printed, and this selection runs
-n auto, where xdist captures worker stdout, so a greenrun reported nothing — precisely how the old constants went years without being re-derived. An
autouse fixture routes each site through
record_propertyinto the--junitxmlfilemarker-tests.yml already uploads as
marker-suite-reports. That artifact is where the CIcolumn above comes from.
.github/workflows/marker-tests.yml— the blocker note claimed test(perf): startup benchmarks assert absolute wall-clock budgets and fail on runner load — passed and failed on the same code minutes apart #15055 is why the cron iswithheld; corrected to leave bug(ml): every transformers from_pretrained call passes resume_download, removed in the pinned v5 — vision and audio model loading raises TypeError #15054 and the ten-green-runs requirement.
MARKER_MIN_PASSEDdeliberately left at 34: a floor is raised to what a run reports, not to a prediction.
Editing this file is also what makes the marker suite run on this PR.
Verification
Three consecutive green marker-suite runs on the real runner, the job that produced every
recorded failure of this test:
de7384457512ba0bcaa7e945a9deac410d72Regression-sensitivity mutation — the criterion that separates a fix from a disabled test.
Three genuine slowdowns injected into the code under test, each run against the final
budgets:
A — 30M iterations of real work added to
MultiModalProcessor.__init__, the exact path:311times:
B — 200k iterations (~12.8ms, a realistic eager scan) added to
ConfigManager.__init__:C — 30k iterations (~1.8ms) added to
MemoryManager.__init__:C is the important one: after the ratchet-down, a 1.8ms addition to a constructor fails,
against a clean baseline of 0.022 units. These are not order-of-magnitude-only detectors. All
three mutations were reverted by restoring pristine copies and confirming with
diff -q, andgit status --porcelainwas empty before committing.Load tolerance — measured, not asserted. 25 sites x 5 full local runs while the machine was
already busy, comparing the coefficient of variation of the raw milliseconds against the
calibrated units:
No artificial load was generated — the machine's own concurrent work supplied it. Two honest
limits. For sites measuring single-digit microseconds the units are no steadier than the
milliseconds, because timer granularity rather than contention sets their spread; their
headroom is ~50x, so neither noise source can reach the budget. And site 12 is not normalised at
all, for the disk-I/O reason given above — that is why it, alone, keeps a wide budget.
Vacuity probe. The assertion cannot pass by measuring nothing, and this is a permanent test
rather than a one-off demonstration —
autobot_shared/perf_work_budget_test.py, 8 passing:A zero, negative or absent
elapsed_msfails with "the operation under test did not run"; azero calibration fails rather than being divided by;
test_budget_still_fails_when_exceededisthe counterpart guard proving the assertion is not unconditionally green; and
test_measurements_reach_the_recorderguards the reporting path the budgets are re-derived from.What I ran locally: the benchmark module plus the harness tests — 22 passed, repeatedly;
scripts/check_python_file_size.py --audit-ceilingsclean;black --line-length=120 --checkand
isort --profile=blackclean.What a local pass could not tell me: this interpreter is Python 3.10.12 and pytest reports
90 of 206 declared versions unsatisfied — notably torch and sentence-transformers are
absent, so the
MultiModalProcessorpaths CI exercises do not run here. Every figure in theCI column above therefore comes from the uploaded junit artifact, not from this machine. I also
could not reproduce a loaded-runner failure on demand, since generating artificial load here is
off-limits while live CI runs.
Scope kept. #15054 is still open, so the multimodal constructor remains on the
resume_downloadTypeErrorbranch. This change is orthogonal to it: a ratio against a same-runbaseline is correct whichever branch the constructor takes, and the budget for that site is
explicitly labelled as a ceiling to lower once #15054 lands.
Model Used
Claude Opus 5 (1M context)
Refs #15055 — two of the issue's four acceptance criteria are outside this PR: #15054 is not
fixed here, and the "ten consecutive scheduled runs" criterion needs the cron, which is
deliberately still withheld. Four marker-suite runs are cited above.