Repository navigation
Description
Problem or Motivation
The required check "Tests & Coverage" runs longer than 5 minutes on main. AGENTS.md rule 5 says that a build or check that averages more than 5 minutes is a P0 bug.
Measured on 2026-10-29 from the check runs of the last six commits on main (start to completion):
| main commit | result | duration |
|---|---|---|
| 9e8317b | success | 378 s |
| 9c7a5f5 | success | 396 s |
| 31fe55c | success | 398 s |
| c462318 | success | 380 s |
| 2305871 | success | 359 s |
The average is about 382 s, which is 6 minutes 22 seconds. Pull request 2698 ran the check in 437 s. The full devops ci on a workstation took 3 minutes 19 seconds on the same tree, so the GitHub runner is about twice as slow as the workstation for this check.
Proposed Solution & Architectural Design
- Find where the 382 s go on the runner: the setup steps (
uv sync, tool installs, cache restore), the 16 test workers' start, the coverage measurement, and the tests themselves. Read the step durations of one run withdevops gh runs view <run_id>. - Cut the largest part first. The open items that cut a part of it are perf(ci): the startup-import tests start 56 interpreters and take 204 s of the suite's 2,423 s #2369 (startup-import tests start 56 interpreters), perf(ci): each test shard collects only its own test files #2371 (what each of the 16 workers repeats at start), perf(ci): measure coverage and branch cost #2373 (what coverage and branch measurement cost) and ci(gate): checks of committed files and tool configuration run as devops ci rows, not as pytest tests that start the tool #2164 (checks of committed files that run as pytest tests). This item owns the target: the check averages under 5 minutes on the runner.
- Add a check that fails when the average of the last ten runs of the job goes over the limit, so the problem is seen when it returns. Do not skip a test or lower a threshold.
Target Subsystem
SDLC, Git & PR Governance (.github/workflows/ci.yml, devops ci, tests/).
Existing Tool Considered
pytest-xdist (already used with -n logical --dist worksteal), pytest --durations, and the step timings that GitHub Actions records. Nothing new is built for the measurement. Related: #2369, #2371, #2373, #2164.
Acceptance criteria
- The mean duration of "Tests & Coverage" over ten consecutive runs on
mainis under 300 s, stated in this issue with the run ids. - The step that took the most time is named, with its before and after durations.
- A check fails when the job's average of the last ten runs goes over 300 s.
- No test is skipped and no threshold is lowered.
Proposed design
Problem statement
The required Tests & Coverage CI check averages 382 s on GitHub runners, exceeding the 300 s limit set by AGENTS.md rule 5. The goal is to bring the average under 300 s and add a guard check that fails when the average of the last ten runs exceeds the limit. The related items #2369, #2371, #2373 and #2164 each cut a part of the time. This item owns the target and the guard.
Acceptance criteria
Requirement: Mean duration under limit
The mean duration of the Tests & Coverage job over ten consecutive runs on main SHALL be under 300 s.
Scenario: Ten runs complete under the limit
- WHEN Ten consecutive runs of the Tests & Coverage job on main complete
- THEN The mean of their durations is under 300 s and the run ids are stated in the issue
Requirement: Largest step identified
The step that consumed the most time SHALL be named with its before and after durations.
Scenario: Step duration is recorded
- WHEN The check is measured before and after the change
- THEN The issue names the slowest step and states its duration before and after
Requirement: Duration guard check
A check SHALL fail when the average duration of the last ten runs of the Tests & Coverage job exceeds 300 s.
Scenario: Average exceeds the limit
- WHEN The average of the last ten completed runs of the Tests & Coverage job is over 300 s
- THEN The check exits with a non-zero status and the pipeline fails
Requirement: No test skipped or threshold lowered
No test SHALL be skipped and no quality threshold SHALL be lowered as part of this change.
Scenario: Test count is unchanged
- WHEN The change is applied and the test suite runs
- THEN The number of tests collected and executed is the same as before the change
Existing Tool Considered
No check has run. The tools already in use are pytest-xdist (parallel execution with -n logical --dist worksteal), pytest --durations (slow-test identification), and GitHub Actions step timings (step-level measurement). They lack a mechanism to fail the pipeline when the average run time exceeds a threshold. The guard is a small addition to the existing devops ci command.
Key questions
- How should the duration guard check be implemented?: A new step at the end of the test job in .github/workflows/ci.yml that runs a devops ci subcommand. The subcommand uses devops gh runs to fetch the last ten completed runs of the Tests & Coverage job, computes the mean duration, and exits non-zero when the mean exceeds 300 s. (best practice) [sources: AGENTS.md, .github/workflows/ci.yml]
- Chosen: Step in the test job using a devops ci subcommand. The project uses devops ci for all CI checks (AGENTS.md rule 5) and devops gh for GitHub API calls (rule 7). A step in the test job runs after the tests complete, so the current run is included in the ten-run average.
- Rejected: Separate job that depends on the test job. Adds a second job and a dependency edge. The guard is a property of the test job duration, so it belongs in that job.
- Rejected: A standalone script in a new workflow file. The project keeps all CI checks in ci.yml (ADR 0004). A new workflow file would fragment the gate.
- What is the 300 s limit based on?: AGENTS.md rule 5 states: A build or check that averages more than 5 minutes is a P0 bug. Five minutes equals 300 s. [sources: AGENTS.md]
Open questions
- What is the largest time consumer in the 382 s check? (missing verified source)
- Are perf(ci): the startup-import tests start 56 interpreters and take 204 s of the suite's 2,423 s #2369, perf(ci): each test shard collects only its own test files #2371, perf(ci): measure coverage and branch cost #2373 and ci(gate): checks of committed files and tool configuration run as devops ci rows, not as pytest tests that start the tool #2164 dependencies of this item? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
perf(ci) prefix maps to type/infra; the change is a CI performance target and a runner check.A required check exceeds its 5-minute budget on every main push.Every pull request and main push waits on this check.Requires profiling runner steps, coordinating sibling cuts, and adding a regression check.Both address test-job timing on the runner; #2371 cuts worker startup while the candidate owns the overall 300 s target and the regression check.devops-cli-service commentedon Oct 29, 2026
Refine cannot set this item to Ready at 244bafb until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
chore(main): release 0.22.1 (#2765)