Skip to content

perf(ci): the Tests & Coverage check averages 382 s on main, over the 5-minute limit #2699

Description

@dan-petty

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

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 main is 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

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#2369, #2371, #2373, #2164

Activity

  1. added
    source/agent
    type/infra
    status/new
    value/high
    effort/medium
    on Oct 29, 2026
  2. dan-petty commented on Oct 29, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/infra. perf(ci) prefix maps to type/infra; the change is a CI performance target and a runner check.
    • Priority: P1-High. A required check exceeds its 5-minute budget on every main push.
    • Value: High. Every pull request and main push waits on this check.
    • Effort: Medium. Requires profiling runner steps, coordinating sibling cuts, and adding a regression check.
    • Related: perf(ci): each test shard collects only its own test files #2371, which asks for a different change. 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.
  3. added
    priority/p1-high
    on Oct 29, 2026
  4. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    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.

  5. added
    scope/ci
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Oct 30, 2026
  6. removed
    status/in-review
    on Oct 30, 2026
  7. added a commit that references this issue on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/cisource/agenttype/infravalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions