Skip to content

Gate caps from measured leg walls instead of a hand table; weekly CI cap report (#8701) - #9124

Merged
squid-protocol merged 4 commits into
mainfrom
dynamic-timeouts
Nov 23, 2026
Merged

squid-protocol merged 4 commits into
mainfrom
dynamic-timeouts

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Why the Windows leg kept timing out (#8701)

Short answer: yes, it was "bump, fail, bump", but not in the YAML. The Full Suite Gate's caps were already planner-written (#5919), so there was no literal 25 to bump. The bumping moved into two hand-typed inputs of the planner:

Windows 3.12 shard 1 was planned for 18 minutes and measured 25 (all tests green, killed at the cap). Over the last 12 nightly Gate runs the Gate failed or was cancelled on 6 nights. Over the same 12 runs the measured walls were (p50 / p95 / max minutes): Windows 3.12 at 2 parts 18.9 / 25.1 / 25.1 (cut twice), Windows 3.11 at 3 parts 15.7 / 19.1 / 21.1 (once within 1 minute of its cap), macOS about 10 / 18 / 19.5, Ubuntu 9.3 / 17.2 / 17.4. Runner speed varies by about 30%, so a cap planned near the median fails on the slow night.

Two tools that measure exactly this already existed (ci_cap_headroom.py #5156, gate_leg_margin.py #8701), but nothing ever ran them.

What this changes

  1. The Gate reads its own history. suite_shard_plan.py --gate --history-runs 10 reads the measured wall of each (os, python, parts) leg over the latest 10 scheduled runs (the plan job already had a token and an API call). With 3 or more observations the measured worst wall x 1.3 floors the cap. A leg measured over its target at n parts is planned with one more part (up to the pool cap) before its cap is raised. A leg that was killed counts at its cap, so it raises its own next cap. History it cannot read never fails the plan; the table is the fallback and history only raises a cap above the durations plan, never cuts under it.
  2. A weekly CI cap report runs both existing tools (literal caps and Gate legs). A tight cap makes the run red, Main Watch opens main is red: CI cap report, and the fleet works that issue.

With today's history the live plan gives the same caps as before (Windows 3.12 at 3 parts has only 2 observations), so this changes nothing today. It changes what happens the next time a leg slows down.

Checked

  • 12 new tests (history parsing, a slow leg gets a part before a longer cap, a killed leg raises its cap, too few observations use the table, an unreadable history never fails the plan, the workflow wiring, the report workflow). 195 related workflow tests pass; ruff clean on my files.
  • Live: the plan with --history-runs 10 against GitHub ran and printed today's caps.
  • Not checked: the workflows themselves have not run in Actions; the first weekly report is Monday (or run it by hand with workflow_dispatch). The plan job's sparse checkout now includes gate_leg_margin.py and ci_rerun_stats.py, which a PR run of the Gate will exercise.

The other 96 jobs (measured today with the existing ci_cap_headroom.py, last 4 runs per workflow since 11-01)

98 literal-cap jobs reported, 4 tight, 10 with no recent run. Most have 5-75x headroom, so the Gate was the outlier. The tight ones:

  • evidence-refresh.yml det-mutation: cap 150 min, worst 104 min on the first four runs (1.4x); 124.7 min over 30 runs (1.2x)
  • graph-accuracy-audit.yml: cap 25 min, worst 18.4 min (1.4x)
  • tri-comparison-audit.yml and tri-comparison-history.yml: a run was stopped at 30.3 / 30.2 min by their 30-min cap

The four are fixed in the second commit (below).

The four other tight caps, planned the same way (second commit)

A small shared tool, tests/tools/job_cap_plan.py, plans a job's timeout-minutes as the worst measured wall of its recent runs x 1.3, clamped to a floor and a ceiling, and writes it as a plan-job output. Each workflow reads it as timeout-minutes: ${{ fromJSON(needs.<plan>.outputs.cap || '<old literal>') }}. If history cannot be read, or there are fewer than 5 runs, nothing is written and the old literal applies. It never fails the workflow, and one run whose jobs cannot be read (a transient 502) is skipped, not fatal.

  • tri-comparison-audit and tri-comparison-history: the two 30-minute stops were hangs, not slow work. In both, the job sat in the step "Install universal-ctags and verify it's the real thing" for about 29 minutes. A normal job takes at most 3.2 min (audit) and 8.2 min (history). Widening the window would only have let a hang last longer. So the planner does not count a job stopped in a setup step; their caps plan to 15 min (floor 15, ceiling 45, was a literal 30), and the install is bounded: 3 attempts, each under timeout 180, inside a 12-minute step cap (ci_retry retries a failed attempt but never a hung one). The same install in doom-rosetta.yml gets the same fix.
  • graph-accuracy-audit: worst measured 18.4 min x 1.3 gives 24 min (floor 20, ceiling 45, was a literal 25). Almost the same number, but it now moves with the workflow.
  • evidence-refresh det-mutation: over 53 recent runs the worst was 124.7 min, so the literal 150 was only 1.2x headroom. Planned cap today: 163 min (floor 150, ceiling 240); the step cap is the job cap minus 12. The job's own 130-minute work budget still ends the work first.

The weekly cap report no longer lists these four, because a planned cap is the planner's (the report only audits literal caps), and the Gate legs stay covered by gate_leg_margin.py.

Tested: 16 new tests (the maths and clamps, hang versus slow using the real tri-comparison shapes, matrix legs, unreadable history, one unreadable run, and the wiring of all four workflows plus the three ctags steps). The 1,055 related workflow and plan tests pass; ruff is clean on the new files (the remaining findings in files I touched are on main too). Existing tests that pinned the old literals were taught to read the planned fallback, the generated network-inventory doc was regenerated, and the known-apt line table was moved for the shifted lines.

Not verified: none of the five workflows have run in Actions with the new steps. The first PR run of each exercises them, and a failed plan step falls back to the old literal. Live, the planner reads today's history as above.

Not done

96 jobs across 55 workflows still have a literal timeout-minutes and only 10 are planner-driven. This PR does not rewrite those; the weekly report tells you which ones are tight.

🤖 Generated with Claude Code

…port (#8701)

The Full Suite Gate's caps came from per-test durations x hand-set speeds, floored by SLOWEST_SEEN_MIN, a table a
person re-typed after each red night (#8944 speed, #8975 pin: bump, fail, bump). suite_shard_plan.py --gate
--history-runs now reads the wall of each (os, python, parts) leg over the latest 10 scheduled runs (the plan job
already had a token): with 3+ observations the measured worst x 1.3 floors the cap, and a leg measured over its target
at n parts is planned with one more part (up to the pool cap) before its cap is raised. A cut leg counts at its cap, so
a killed leg raises its own next cap. History that cannot be read never fails the plan.

ci-cap-report.yml runs the two tight-cap tools (ci_cap_headroom.py, gate_leg_margin.py) weekly; a tight cap is a red
run, which Main Watch turns into an issue the fleet works.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol
squid-protocol marked this pull request as ready for review November 23, 2026 15:31
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 3 commits November 23, 2026 10:45
…and det-mutation from measured wall time; bound the ctags install that hung

job_cap_plan.py plans a job's timeout-minutes as worst measured wall x 1.3 clamped to [floor, ceiling] and falls back to the
workflow's current literal when history cannot be read (never fails the workflow). A job stopped in a setup step is a
hang, not evidence the work needs longer: both tri-comparison runs stopped at 30 min were 'Install universal-ctags' hung
~29 min (normal job <= 8 min), so their cap goes to 15 and the install is bounded (3 attempts x 180 s under a 12-min step cap,
in tri-comparison-audit, tri-comparison-history and doom-rosetta). det-mutation: the literal 150 was 1.2x its worst real run
(124.7 min); it is now planned (floor 150 so det_mutation.py's 130-min budget still ends the work first). Existing tests that
pinned the old literals are taught to read the planned fallback; the network-inventory doc and the apt line table are updated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… planner test independent of the committed durations

- test_every_workflow_is_a_listed_gate_or_says_why_not: ci-cap-report.yml goes in NOT_GATES with its reason.
- test_a_leg_measured_slow_at_n_parts...: it read the real durations, and in CI's merge with main Windows 3.12 already planned
  4 of 4 parts (GATE_MAX_PARTS), so it could not add a fifth. Now pins the maximum: with room it adds a part; at the maximum it adds none
  and the cap still covers worst x 1.3.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol
squid-protocol merged commit 061a7d6 into main Nov 23, 2026
51 checks passed
@squid-protocol
squid-protocol deleted the dynamic-timeouts branch November 23, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant