Repository navigation
Description
Same pattern as #5882, generalized, and the CI half of squid-protocol/promoter-bot#34.
Problem
Every sharded workflow fixes its own shard count and timeout-minutes by hand. They are re-measured after something times out or crawls:
- Det Sweep
DB2_MAX_SHARDS=4, with the db2 timeout raised 18 -> 30 (CI: Det Sweep db2 shards time out at 30 min, not 18 #5869, Det Sweep: db2 shards don't scale with the Db2 case count (fixed 4 shards, 6-min Db2 start per shard, 31 cases unbalanced) #5882). - CICS Crucible shards
[1,2,3,4](ci: shard the CICS Crucible PR job (Part of #5498) #5530). - Doom Rosetta
SHARDS: "4". - Smoke
--splits 3(CI critical path: rebalance full-suite part 3 (move evidence --deltas, refresh durations); measure ground-truth split #5133). - Full Suite Gate per-leg
splits/timeoutJSON, re-capped four times (Full Suite Gate: macOS legs cancelled at the 45-minute limit on every main run #4576 -> pipeline: windows 3.10 is the gate's 40-min critical path; macOS 70% of billed minutes -- one leg per Python, right-sized caps #4903 -> CI: shard every full-suite-gate leg in 2 parts (Part of #5152) #5155 -> full-suite-gate: windows 3.11 cap 33 min, step timeout keeps the log of a stall (Part of #5764) #5766 -> CI: OS-leg headroom, no false-red cancelled main runs, actionlint gate, bg-job helper #5776; Siblings of #5152: CI legs outgrowing their fixed timeout caps #5156 open). - Evidence Refresh Db2 / sweep / records parts.
Only Ground Truth (ci_layout.py, #5616) and the det planner's narrow path size themselves. The pool is fixed (20 concurrent GitHub-hosted jobs) while cases and suites grow every day: Db2 cases went 45 -> 70 in 4 days.
Proposal: one planner, measured inputs
A small shared module (next to tests/tools/det_sweep_plan.py / ci_layout.py) that each sharded workflow's plan job calls:
- Shards =
ceil(estimated work / target shard minutes), capped by the workflow's share of the 20-job pool. The share can shrink under queue pressure, asci_layoutdoes today. - Timeout = p95 of the measured shard duration × margin (e.g. 1.5), floored and ceilinged. It is emitted by the plan, not hardcoded in YAML.
- Durations: every shard writes measured per-case or per-part seconds into the durations cache (CI v3 (nice-to-haves after CI v2 / #4825) #4847 / Siblings of #4980: CI network fetches without retry/pin (apt, npm, docker pull) #5048). Cases without a measurement fail the plan loudly after a grace period instead of silently unbalancing shards (the 31-of-70 Db2 cases in Det Sweep: db2 shards don't scale with the Db2 case count (fixed 4 shards, 6-min Db2 start per shard, 31 cases unbalanced) #5882).
- Fixed setup cost (e.g. Db2's ~6 min start) is part of the model, so the planner trades shard count against startup.
Order
- Db2 in Det Sweep and Evidence Refresh. This is Det Sweep: db2 shards don't scale with the Db2 case count (fixed 4 shards, 6-min Db2 start per shard, 31 cases unbalanced) #5882's asks 1, 2 and 4 via the planner.
- CICS Crucible and Doom Rosetta.
- Smoke parts (CI critical path: rebalance full-suite part 3 (move evidence --deltas, refresh durations); measure ground-truth split #5133) and Full Suite Gate legs (Siblings of #5152: CI legs outgrowing their fixed timeout caps #5156).
Acceptance
- No sharded PR workflow has a hand-set shard count or
timeout-minutesfor its shard jobs. - A 7-day window with case growth shows no shard timeouts and a slowest/fastest shard ratio ≤ 1.3.
- Adding cases needs no YAML edit.
Related: #5882, #5869, #5156, #5133, #5135, #5616, #5262.
🤖 Generated with Claude Code
Plan (Opus rescue of PR #6081)
Already merged: #6037, #6059 (Db2 counts, timeouts and measured setup in Det Sweep and Evidence Refresh), #6050, #6068 (CICS Crucible and DOOM-rosetta). Closed: #6081. Its approach was to have det_sweep_plan.py read the live queue itself, and that was wrong.
Steps, in order. Each step is one Sonnet-sized PR of at most 5 hand-written files.
- Det Sweep queue depth comes from the workflow, not the planner. This is a workflow edit, so it needs an
allow_workflowsitem or the owner.- Add
actions: readto theplanjob in.github/workflows/det-sweep.yml. - On a pull request, both plan steps ("Plan the sweep" and "Plan from the port diff") get the waiting count from
python3 tests/tools/ci_layout.pywithGH_TOKENset. Add a small--print-waitingflag there if needed. Pass the count todet_sweep_plan.pywith the existing--waiting. An empty value means calm. - Do not change
det_sweep_plan.py's imports. - Acceptance: a test pins the step wiring;
test_ground_truth_plan.pyandtest_det_sweep_fast.pystay green; the plan summary of a real PR run showswaiting.
- Add
- Det Sweep non-Db2 shard count from durations. Replace the fixed
MAX_SHARDS = 6/PER_SHARD = 3indet_sweep_plan.pywithci_shard_plansizing, whichdet_sweep_plan.pyalready imports.- Acceptance: unit tests at 45, 70 and 140 cases keep the slowest/fastest ratio at or below 1.3 and stay within the pool cap.
- Smoke parts (CI critical path: rebalance full-suite part 3 (move evidence --deltas, refresh durations); measure ground-truth split #5133).
smoke-test.ymlhard-codes--splits 3and the part job'stimeout-minutes: 30. Plan both from.test_durationswith a planner module next toci_shard_plan.py. This is a workflow edit, so it needsallow_workflows.- Acceptance: no literal split count or part timeout is left in
smoke-test.yml, and a test asserts that.
- Acceptance: no literal split count or part timeout is left in
- Full Suite Gate legs (Siblings of #5152: CI legs outgrowing their fixed timeout caps #5156). Replace the per-leg
splits/timeout/step_timeoutJSON infull-suite-gate.ymlwith a plan-job output. Per-OS slowdown factors come from the measured leg times. This is a workflow edit, so it needsallow_workflows.- Acceptance: no hand-set leg JSON is left.
- Calibration check (no code). Once steps 1–4 have run for 7 days, read the shard timings and confirm there are no shard timeouts and the slowest/fastest ratio is at or below 1.3. Post the numbers here. Then close the issue.
Pitfalls the failed attempts hit
test_ground_truth_plan.pyfollows tool module names as plain words through any file the ground-truth tests reach, andtest_det_sweep_fast.pyreachesdet_sweep_plan.py. Naming or importingci_layout,post_merge_dispatchand the like indet_sweep_plan.py, even in a comment, failstest_no_skippable_tool_is_reached_by_the_jobs_tests. Keep queue and API reads in the workflow.det_sweep_plan.py --eventdefaults topull_request. Any live read keyed on that event fires inside unit tests.- Evidence Refresh's
laneuses a sparse checkout. Anythingdet_sweep_plan.pyimports there must be in that checkout, or be imported lazily with a fallback. - Workflow edits need an
allow_workflowsitem or the owner. Two runs here shipped Python changes that do nothing until a later workflow edit. Put the wiring and its test in the same PR.
What to reuse from the closed branch (churn/5919-20261022T2258Z): the test shape in test_ci_shard_plan.py (--waiting wins, an unreadable queue plans calm), moved to test the workflow step instead.
Activity
Drop the workflow edits (need the owner); planner imports ci_shard_pl…
Det Sweep db2/shard timeouts come from the plan; Evidence Refresh lan…
Evidence Refresh db2-part/sweep/records matrices and timeouts come fr…
Drop the workflow edits (need the owner); the planner and its tests s…
CI planner: CICS Crucible and DOOM-rosetta shard counts and timeouts …
CI planner: Smoke parts and Full Suite Gate legs from measured durati…
CI planner: Db2 shard setup from measured timing, predicted shard rat…
CI planner slice 2 workflows: CICS Crucible and DOOM-rosetta read sha…
Drop the det-sweep.yml edit (needs the owner); keep the planner's que…
squid-protocol commentedon Oct 22, 2026
Churn run
5919-20261022T2325Z(host melek) ended without a PR. RESTART verified: PR closed, plan in #5919; queued shard-sizing slice (non-workflow)Det Sweep: size the non-Db2 shard count from measured durations (Part…
Det Sweep: read the PR queue depth in the workflow and pass it as --w…
6 remaining items
CI: nightly durations calibrated to wall x JOBS; Gate leg caps floore…
Equivalence E2E: shard count, matrix and timeout from the plan job (P…
squid-protocol commentedon Nov 17, 2026
Step 5 calibration: 2026-11-06 .. 2026-11-16 (measured from CI)
Verdict: FAIL on the slowest/fastest ratio; leave open. No shard timed out.
Method: GitHub Actions job
started_at/completed_atfor the latest runs (up to 40 per workflow, created on or after 2026-11-06). Per run, the ratio is the slowest over the fastest successful sibling shard job (jobs under 60 s dropped). This is job wall time (setup + queue-free run), not the sweep-only time thatdet_sweep_timing.pyreports, so it is a looser measure than the Db2 acceptance in #5882. Timeouts counted as jobs with conclusiontimed_out.timed_outjobsRead:
timed_outjobs across 7 workflows (about 190 runs read).Remaining slices (each <= 5 hand-written files)
det/crucible/ smoke report jobs write per-shard test-phase seconds (setup split out) into the step summary, using thedet_sweep_timing.py reportshape; then re-read a week. Files:tests/tools/det_sweep_timing.py(or a sibling),tests/tools/ci_digest.py, one test, one workflow edit (needs the owner'sallow_workflows).least_durationover.test_durationswith a per-part fixed-cost term insuite_shard_plan.py; add a test at the current duration file asserting the planned ratio <= 1.3. Files:tests/tools/suite_shard_plan.py, its test.crucible_shard_plan.pyplus its test, using LOC/case weights from the measured durations.Script used (scratch, not committed): job durations via
actions/workflows/<id>/runsandruns/<id>/jobs.squid-protocol commentedon Nov 17, 2026
Churn run
5919-20261117T0419Z(host nyx) ended without a PR. calibration no-code: ratio fails 1.3, no timeouts; slices posted on issue; slice 2 queuedsquid-protocol commentedon Nov 17, 2026
Claimed by promoter-bot host
nyx, lease renewed 2026-11-17T04:41Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove theclaim:nyxlabel.Suite shard plan: pin the planned balance of Smoke parts and Gate leg…