Repository navigation
ci(backend): rebalance unit shards by wall weight, LPT slices, one typecheck - #23796
Merged
Merged
Conversation
test_registered_runtime_image_sources_are_closed staged and AST-walked all 18 registered runtime image contracts in one pytest process: ~183s of CI wall, the single heaviest file in the unit suite, unlisted in the shard weights table and capable of serializing a shard lane's final quarter (PR #23789 shard 3, 724s against the 720s budget). The walk now runs as the same test in two files, split by parity of the sorted contract name, so every contract is still checked exactly once, a newly registered contract lands in exactly one half by construction, and the deal can spread the halves across shards. Measured on this checkout: halves 33.6s / 33.8s. The moved node IDs inherit their fast-unit duration-guard allowlist entry.
…pecheck Four near-misses against the 720s shard budget tonight (#23767 754/740s, #23771 762s, #23789 724s) with main at ~681s left ~5% headroom. Three causes, each fixed at its layer, measured from the six shard logs of the last 20 main-branch runs (40333043889..40458587600, per-file wall time from each file's ::group:: marker to its last path-bearing line + 0.7s tail): - Weights priced pytest time, not wall time. Per-file import/collection startup is what the scheduler actually consumes; the old table missed a 183s file entirely (unlisted) and underpriced a 130s file at 36.7s and the sub-2s default at 1.1s vs a measured 1.66s wall mean. Rebuilt as p90 wall seconds (1982 entries); DEFAULT_WEIGHT 1.66. - Slices launched alphabetically, so heavy files started late and serialized their shard's tail. Each shard's slice now keeps deal order, turning test.sh's four worker slots into a longest-processing-time schedule. - All six shards ran the identical full-tree pyright (~99s each; ~8m of runner time per main commit, ~99s of every shard's 720s budget). It is deterministic over the same checkout every shard sees, so only shard 1 runs it; its failure still fails the workflow for the commit, and the deal reserves shard 1's capacity (load[0] += 360) so all shards finish level. Simulated over all 20 runs with the shipped deal and scheduler: worst shard 607s (budget 720, target 640, was 718-762 observed; per-shard makespans 594-595s except shard 1's 504s). Runner pin tests updated to the new contract: shard-1-only typecheck, offset-aware deal, deal-ordered slices.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ecks Review round 1 (Luna, SHIP with one minor): the 360s deal reservation for shard 1's type check also applied to changed-files runs where needs-typecheck.sh skips the check entirely, handing shard 1's capacity to its siblings for nothing (projected max ~570s vs ~556s on such runs). The boundary decision is now made once before the deal and both the reservation and the typecheck step key off it.
Git-on-my-level
added a commit
that referenced
this pull request
Nov 2, 2026
…parse off the CPU guard (#24406) ## What Root fixes for the two CI guards that tripped on main run 41468678725 (2026-11-02, no pytest failures): 1. **Backend unit shard 1 wall 730s over the 720s budget.** The deal's p90 wall table (`backend_unit_shard_weights.tsv`) was five days stale (2026-10-27, PR #23796): 302 files added to main since were priced at the 1.66s `DEFAULT_WEIGHT`, including `test_batch_vendor_outage_drills.py` at a measured **74.7s p90**, so the deal leveled on fiction. Shard 1's pyright reservation was also under-measured: shipped 90s, remeasured over 16 main runs at median 96s / p75 100s / max 113s. - Regenerate the table from the last 20 main runs (41386368018..41438174663): 2259 entries, 302 newly priced. - Raise the typecheck reservation to the measured 100s (deal load offset 360 → 400). - `DEFAULT_WEIGHT` 1.66 → 1.70 (fresh mean below the 2s floor). - Projection (same simulator as PR #23796): worst shard **687s, level across all six** (702s under the stale table). 2. **Backend unit shard 6 fast-unit CPU guard:** `test_translation_config.py::test_prod_binds_no_nllb_translation_endpoint` measured 1.03s CPU against the 1.00s limit (all 40 tests in the file passed). The `backend/deploy/runtime_env.yaml` parse under `yaml.SafeLoader` costs ~0.33s CPU locally and ~1s on a CI runner. This applies the autouse `CSafeLoader` fixture that `test_backend_runtime_env_validator.py` already ships for large manifests — same safe YAML schema, measured **0.044s** locally (~7x cheaper). Locally the test now measures 0.15s CPU. ## Measured evidence - Wall weights: p90 of per-file walls over 20 main-branch runs (parser + simulator from PR #23796, scratch `shardbudget/scripts`). Typecheck delta: per-run shard-1 overhead minus sibling median, 16 runs with parseable spans. - YAML parse CPU (M-series, `process_time`, best of 3): SafeLoader 0.326s → CSafeLoader 0.044s for the 4592-line runtime_env.yaml. - Local CI shard (exact CI envs: WARN 0.1 / FAIL 1.0, file isolation, 4 workers): `test_translation_config.py`, `test_backend_unit_ci_runner.py`, `test_workflow_contracts.py` — all pass, no fail-limit offenders. ## Residual risk (owner decision, not this PR) A perfectly leveled deal still projects ~687s against the 720s budget with roughly ±45s observed runner variance (green-run shard walls 433–698s; the failing run 730s), so occasional overage remains structurally possible — the suite has grown past what 6 shards × 4 lanes fits comfortably at this budget. The 7th-shard / budget-raise lever and splitting the 74.7s `test_batch_vendor_outage_drills.py` (runtime_image-split precedent) stay deliberate owner decisions, tracked on card `margin50-variable-margin`. Failure-Class: none Both guards were measurement-staleness flakes on green tests; no product failure class applies.
MichaelC001
pushed a commit
to MichaelC001/omi
that referenced
this pull request
Nov 3, 2026
…parse off the CPU guard Two independent guards tripped on main run 41468678725 (2026-11-02), no pytest failures: 1. Shard 1 wall 730s over the 720s budget. The deal's p90 wall table was five days stale (2026-10-27, PR BasedHardware#23796): 302 files added since were priced at the 1.66s default, including test_batch_vendor_outage_drills.py at a measured 74.7s p90, so the deal leveled on fiction; and shard 1's pyright reservation was under-measured (shipped 90s; remeasured over 16 main runs 2026-11-02: median 96s, p75 100s, max 113s). Regenerate the table from the last 20 main runs (41386368018..41438174663), raise the reservation to the measured 100s (load offset 360->400), and move DEFAULT_WEIGHT to the fresh 1.70s mean. Projected worst shard: 687s, level across all six (702s under the stale table). A perfectly leveled deal still projects ~687s against 720s with about +/-45s observed runner variance, so residual overage risk is structural (the suite has grown past 6 shards x 4 lanes at this budget); the 7th-shard/budget lever stays a deliberate owner decision on card margin50-variable-margin. 2. Shard 6 fast-unit CPU guard: test_prod_binds_no_nllb_translation_endpoint measured 1.03s CPU against the 1.00s limit with all 40 tests passing. The runtime_env.yaml parse under SafeLoader costs ~0.33s CPU locally and ~1s on a CI runner; apply the autouse CSafeLoader fixture that test_backend_runtime_env_validator.py already ships for large manifests (same safe schema, measured 0.044s locally, ~7x cheaper).
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.
What
Backend unit CI shard walls keep grazing the 720s regression budget: #23767 754/740s, #23771 762s, #23789 724s, with main at ~681s (~5% headroom). This rebalances the shards to a simulated worst shard of 607s (target 640s, 11% headroom) without touching
.github/workflows, the 720s budget, or the shard count.Three causes, each fixed at its layer:
test_runtime_image_contracts.pyat ~183s wall was unlisted and dealt at the 1.1s default — and underpricedtest_cross_service_deploy_contract.pyat 36.7s vs a measured 130s. Rebuilt as p90 wall seconds over the last 20 main-branch runs (1982 entries, ≥2s floor), attribution-free from each file's::group::marker to its last path-bearing line +0.7s tail;DEFAULT_WEIGHT1.1 → measured 1.66.test.sh's four worker slots run a longest-processing-time schedule.load[0] += 360) so shards finish level.Plus the split the brief asked for: the 183s closure walk (
test_registered_runtime_image_sources_are_closed, 18 registered image contracts staged + AST-walked in one process) becomes the same test in two files split by parity of the sorted contract name — every contract still checked exactly once, new contracts land in exactly one half by construction. Halves measured 33.6s / 33.8s locally. Moved node IDs inherit their fast-unit duration-guard allowlist entry.Evidence
/Volumes/Ephemeral/scratch/shardbudget/(20 main runs × 6 shard logs; per-file p90s are tight across runs, e.g. runtime_image 179.7–185.7s over 20 samples).backend/test.shover the seven changed/pinning test files — all green (runner pins 94, workflow contracts 14, allowlist pin 2, runtime_image trio 63+1+1).Notes for review
.github/, which this lane does not touch.test_cross_service_deploy_contract.py(130s wall, now correctly weighted) is the next split candidate if walls creep again; not split here to keep the diff reviewable.Review
needs-typecheck.shskips the check, handing shard 1's capacity to siblings for nothing (~570s vs ~556s projected max on such runs). Fixed in e0fc220: the boundary decision is computed once before the deal, and both the reservation and the typecheck step key off it (verified: with the check reserved → shard 1 empty in a tiny fixture; without → 7/6 even split; runner pin tests 94 + workflow contracts 14 green locally).