Repository navigation
Description
Problem
The local full check devops ci is slow under load. Measured on 2026-11-10 with several agents on one host (load about 28): the test row took 11 min 39 s, 16 min, 19 min and 23 min 37 s; the mypy step alone took 5 min 20 s; a run waited more than one hour on the lock .data/agent/ci.lock behind others. The project rule says a build or check that averages more than 5 minutes is a P0 bug (AGENTS.md rule 5).
What to find out
- The time of each step on an idle host (the test row, mypy, ruff, docs, openspec), for three runs.
- The share of the slowdown that comes from load (many agents run pytest with xdist at once) and the share that is the cost of the checks.
- The slowest test files and test setup costs (
pytest --durations=50), and whether a few modules cost most of the time. - The GitHub runner times of the same checks (they are the ones that gate a merge).
- Whether the lock policy should change: a limit on agents running the full check, a shared result cache keyed by tree hash, or scoped checks (
devops cifor changed paths).
Done when
A table of times (idle and loaded), the top slow tests, and a ranked list of fixes are in this issue, with a fix issue for each. If an idle run exceeds 5 minutes, this issue becomes P0.
Related: the CI speed rule, tests/commands/test_scan.py failures (#4288, #4321) that add time.
Alternatives check of 2026-11-11: not-applicable.
Class: chore, no search.
Tool: none found.
Proposed design
Problem statement
The local full check devops ci and the required check Tests & Coverage take more than 5 minutes. AGENTS.md rule 5 calls a check that averages over 5 minutes and 1 minute of tolerance a P0 bug. The issue records the times, the slowest tests and a ranked list of fixes, each with its own issue. The gate names an over-budget check only for the test step, and it prints that line as plain text that the check page does not show. This change makes the gate name each check over 300 s, print the line as a ::warning:: workflow command, and list the 50 slowest tests.
Acceptance criteria
Requirement: Each check over the budget is named
The gate SHALL print one over-budget finding that names each check whose duration is more than 300 s and states the 300 s budget.
Scenario: A slow typecheck step is named
- WHEN the typecheck step takes 320 s and the lint step takes 10 s in one run
- THEN the finding names the typecheck step and the 300 s budget, and it does not name the lint step
Requirement: An over-budget check shows on the check page
The gate MUST print the over-budget finding as a GitHub Actions ::warning:: workflow command.
Scenario: A shard over the budget shows a warning
- WHEN a test shard takes 393 s and the gate prints its over-budget finding
- THEN the output line starts with
::warning::and holds the check name, its duration and the 300 s budget
Requirement: The test row asks for the 50 slowest tests
The test row SHALL pass --durations=50 to pytest.
Scenario: The pytest arguments hold fifty durations
- WHEN the test row builds its pytest arguments
- THEN the arguments hold
--durations=50and hold no--durations=10
Requirement: A run inside the budget prints no finding
The gate MUST print no over-budget finding when every check takes 300 s or less.
Scenario: A run at the budget is quiet
- WHEN every check takes 300 s or less
- THEN the output holds no over-budget finding
Existing Tool Considered
The alternatives check of 2026-11-11 in the issue body records not-applicable (class chore, no search) and names no tool. The change uses two existing tools: pytest's built-in --durations=50 gives the slowest tests, and the documented GitHub Actions ::warning:: workflow command puts the over-budget line on the check page. The change extends the summary that devops ci already prints and builds no timing harness. A custom harness would cost about 40k tokens to build, 10k tokens a month to keep and fix, and 3 days.
Key questions
- Which parts of the check report already exist in
devops ci?:devops ciprints one summary row for each check with its duration. The test row parses pytest's durations report throughslowest_testsinsrc/devops_cli/ci/diagnostics.py, and the count of entries is a constant insrc/devops_cli/config/constants.py. One plain over-budget line exists for the test step atsrc/devops_cli/commands/ci.py:1385. The change extends these three points and adds no second timing script. [sources: src/devops_cli/commands/ci.py:1385, src/devops_cli/commands/ci.py, src/devops_cli/ci/diagnostics.py, src/devops_cli/config/constants.py] - Does the gate report a slow typecheck step today?: No. The over-budget line covers the test step only. On 2026-11-12 a
devops ci typecheckrun under a load average of 44 stopped withmypy ... --strict src timed out after 1800.0 seconds, and the gate named no over-budget step. [sources: src/devops_cli/commands/ci.py:1385, src/devops_cli/ci/typecheck.py] - How does an over-budget check reach the pull request check page?: Print the over-budget line as a
::warning::workflow command. The runner turns it into a warning annotation on the check page, and no workflow file changes. (best practice) [sources: src/devops_cli/commands/ci.py:1385, .github/workflows/ci.yml]- Chosen: Print a
::warning::workflow command. The runner shows the line as a warning annotation, and the check names and the budget stay in one place. - Rejected: Add an annotation step to
ci.yml. It copies the check names and the 300 s budget into the workflow, so the two lists drift. - Rejected: Keep the plain line. The audit found that nobody sees the line on the check page, so an over-budget run stays silent.
- Chosen: Print a
- How many slowest tests does the test row ask for?: Raise the count from 10 to 50. The issue asks for
pytest --durations=50. The loaded run of 2026-11-11 needed 60 entries to show that 50 of the slowest tests are intests/roadmap/, which is the largest block of the loaded test time. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/commands/ci.py, openspec/specs/ci-test-shards/spec.md]- Chosen: Raise the count to 50. The issue names
--durations=50, and 10 entries hid the roadmap tests that hold most of the loaded test time. - Rejected: Keep the count at 10. The ten entries of the loaded run missed the slowest block, so the report could not rank the fixes.
- Chosen: Raise the count to 50. The issue names
- Should the gate's lock policy change to a limit, a shared result cache or scoped checks?: Keep the limit on concurrent full checks,
ci.gate_slots. A directuv run pytestthat starts workers fromaddoptsnow takes a slot too. Do not add a shared result cache: ADR 0014 records that the cache helped in only 1 of 186 passing runs. Do not gate on scoped checks: ADR 0014 rejects the changed tests as the gate, and ADR 0004 keeps CI authoritative. (best practice) [sources: CONTRIBUTING.md:108, src/devops_cli/ci/gate_slots.py, docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md, docs/adr/0004-ci-is-the-authoritative-gate.md]- Chosen: Keep the
ci.gate_slotslimit. The project already implements it, records the wait, and tunes the slot count from that metric. - Rejected: Add a shared result cache keyed by tree hash. A cached verdict can pass a tree whose checks never ran, and ADR 0014 measured almost no reuse.
- Rejected: Gate on scoped checks for the changed paths. ADR 0014 rejects the changed tests as the gate, and a scoped run can miss a regression outside the changed paths.
- Rejected: Raise the number of slots. Two gates side by side ran past the 300 s test budget and used most of the 2048 process ids of the container.
- Chosen: Keep the
- Is the required check over the 5 minute budget?: Yes. The issue records a mean of 503 s (max 630 s) for
Tests & Coverageover the last 20 push runs onmain, and about 500 s for the local test row on an idle host at 22,497 items. Both exceed the 300 s budget plus the 60 s tolerance of AGENTS.md rule 5, so the issue is a P0 bug. [sources: AGENTS.md, openspec/specs/ci-job-time/spec.md, docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md, src/devops_cli/config/defaults.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
choreprefix of the title gives the type.(ci)scope of the title gives the scope.The local check is slow under load but the project still functions; it blocks developer speed, not end users.Faster local checks reduce developer wait time and improve iteration speed for the team.Requires three timed runs, xdist analysis, pytest durations, and a written report with a ranked fix list.Both concern 'devops ci' exceeding the 5-minute budget, but the candidate delivers a diagnostic report with ranked fixes while #748 delivers the speed fix itself.devops-cli-service commentedon Nov 10, 2026
Status set to Ready at efe3884 (see proposed design in issue body).
Moved to new items: #4427.
dan-petty commentedon Nov 11, 2026
Measurement of the check times (2026-11-11)
Result: the required check
Tests & Coveragetakes more than 5 minutes on the GitHub runners, where no host load applies: 503 s on average over the last 20 runs onmain. The estimate for the local test row on an idle host is also more than 5 minutes (about 500 s). By AGENTS.md rule 5, this is a P0 bug.1. Required checks on the GitHub runners
Sources: the Actions API for
ci.yml(141 successful runs from 2026-10-28 to 2026-11-11, 10 a day), anduv run devops ci job-time(the last 20 push runs onmain). The test check is timed from the first shard start to the end of the join job.Tests & Coverage, last 20 runs onmain(devops ci job-timeexits 1)Tests & Coverage, 2026-11-04 to 06Tests & Coverage, 2026-11-07 to 11Static Analysis, last 20 runs onmain(devops ci job-time)Static Analysis, 2026-10-28 to 11-06Static Analysis, 2026-11-07 to 11Semantic PR titlepr-title.ymlwas not in the sample)The parts of
Tests & Coverage(means):The mean test step of a shard grew by 60% from the first period to the second. The suite grew from 11,651 test functions in 782 files (2026-11-04) to 14,695 in 1,105 files (2026-11-11): +26%, about 430 functions a day. Run 42938256840 on
mainhad 22,497 items in 4 shards, with 200.8 s, 299.6 s, 306.4 s and 368.9 s of pytest. With a perfect balance this gives 294 s for each shard and about 381 s for the check. Thus a balance alone (#4250) cannot bring the check under 300 s.2. The local check (devcontainer, 16 CPUs, WSL2)
No idle run was possible: other agents ran pytest during the whole window. The idle column holds the records of
src/devops_cli/config/defaults.pyand a linear estimate.testtypecheck(mypy)security(bandit)test-treeopenspecstartup-importsdocslintToday's full gate:
uv run devops ci --check --no-cacheatorigin/main776054b, from 02:22 UTC, the only holder of the gate slot. Thenuv run pytest -p no:cacheprovider --durations=60with no coverage, at a load of 35 to 50: 22,504 passed in 2,006 s. One worker hung for more than 16 minutes indecide_all(#4513), and pytest-timeout did not stop it.3. Where the time goes
tests/roadmap/(1,700 s of 2,296 s), mostlyimplement/andstage/, at 25 to 53 s each under load and 4 to 11 s on the runner. No single test is the cause; this is the next area to profile.test_bootstrap_k8s_warns_when_docker_daemon_downwaits 45 s (_wait_for_docker_daemonpolls withtime.sleep(2)and does not use the clock seam). Three tests oftests/roadmap/refine/test_roadmap_refine_failure_class.pywait 30 s, 15 s and 15 s, because a module fixtureclockshadows the sharedClockFake.[roadmap-service-activity]made 9,000 to 12,000 evaluation rounds: 63.8 s on the runner, 214 s today, a median of 147 s in 24 local logs. With--dist worksteal, the local row cannot end before its slowest test.test_local_ai_commands_run_cleanly[ai ast graph]: 35.7 s on the runner, 115 s today.tests/commands/test_scan.pyruns on fakes now (fix(ci): scan tests reach the host scanner tools #4321, merged in test(scan): fake the scanners in the scan command tests #4440; test(scan): scan command tests reach real trivy and semgrep #4288 closed). It is not in the 60 slowest tests.4. The effect of the host load
pytestover a list of test files in another worktree 458% (17 processes), other scripts about 250%. The 16 workers of the gate got 25% to 43% of a CPU each.uv run pytesttakes no gate slot, so the slot limits onlydevops ciruns.So the 11 to 30 minutes on the host are mostly load and queue. But the test row alone is over 300 s on the runner, and by the estimate on an idle host too.
5. Ranked fixes
decide_allClockFakein the refine failure-class testsTwo more points, with no issue:
uv run devops ci test <paths>for the tests that they change, and let the required checks run the full suite, asdocs/SDLC.mdsays. The full local gate is optional (ADR 0014).devops-cli-service commentedon Nov 11, 2026
Alternatives check: not-applicable
Class: chore. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-11. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 11, 2026
Scope from the CI audit (2026-11-11)
Add one fact and one change to this issue.
src/devops_cli/commands/ci.py:1385) as a plain line with no annotation, and the shard passes. Nobody sees it on the check page.::warning::workflow command, so that the PR check page shows it. The design of this issue already names each check that is over 300 s.The audit filed a fix issue for each measured cause of the slow test row, in plan order:
dan-petty commentedon Nov 12, 2026
A new measurement on 2026-11-12:
uv run devops ci typecheckin a new worktree stopped at its own limit. The output wasmypy ... --strict src timed out after 1800.0 seconds(elapsed 30 min 47 s). The load average was about 44 on 16 CPUs, with several agents on one host.mypy --stricton 2 changed modules finished with no issue in the same worktree.devops-cli-service commentedon Nov 26, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
devops-cli-service commentedon Nov 28, 2026
Released in v0.236.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.236.0
devops-cli-service commentedon Nov 28, 2026
Live since 2026-11-28 17:56 UTC