Skip to content

chore(ci): measure the local check on an idle host and rank the fixes #4427

Closed as not planned

Description

@devops-cli-service

Split from #4405.

Problem

The local full check devops ci took 11 min 39 s to 23 min 37 s on 2026-11-10 under a load of about 28, and one run waited more than an hour for a gate slot. AGENTS.md rule 5 makes a check that averages more than 5 minutes a P0 bug. The project has no three-run idle record of the ruff, mypy, test, docs and openspec steps, no split of the slowdown between load and the cost of the checks, and no ranked list of fixes.

Why deferred

The three-run idle measurement needs a host with no other agent. Several agents run pytest with xdist on the shared host, so no job can make the host quiet. The recorded data already shows the direction: the test row took 247 s alone and 440 s beside a second gate (src/devops_cli/config/defaults.py:474-480), and a full run took 2.5 minutes on a quiet host (docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md:21). The rest of #4405, the 50 slowest tests and the P0 mark for every check over 300 s, does not wait.

Acceptance criteria

  • Three runs of devops ci on an idle host record the wall time of each of the ruff, mypy, test, docs and openspec steps, and the issue holds a table of the idle and loaded times of each step.
  • The issue states the share of the slowdown that comes from load and the share that is the cost of the checks.
  • pytest --durations=50 lists the 50 slowest tests with their setup and call times, and the slowest test files; the issue names tests/commands/test_scan.py and its open failures test(scan): scan command tests reach real trivy and semgrep #4288 and fix(ci): scan tests reach the host scanner tools #4321.
  • The issue holds a ranked list of fixes, and one new issue holds each fix.
  • If the mean idle time of a step is more than 300 s, intake sets the priority of this issue to P0.

Proposed design

Problem statement

The local full check devops ci took 11 min 39 s to 23 min 37 s under a load of about 28, and one run waited more than an hour for a gate slot. AGENTS.md rule 5 makes a check that averages more than 5 minutes a P0 bug. The project lacks a three-run idle record of its ruff, mypy, test, docs and openspec steps, a split of the slowdown between load and the cost of the checks, and a ranked list of fixes. The three idle runs wait on a host with no other agent.

Acceptance criteria

Requirement: Idle and loaded step table

The change SHALL add docs/ci-performance.md with a table of the idle and loaded wall time of each devops ci step.

Scenario: Three idle runs recorded

  • WHEN A person runs uv run devops ci --check --no-cache three times on an idle host.
  • THEN The table holds three idle times and the recorded loaded time for each of the lint, format, typecheck, test, docs and openspec steps.

Requirement: Cache bypassed

Each of the three idle runs MUST pass --no-cache, so that the measured time is the cost of the checks and not a cached verdict.

Scenario: The method names the command

  • WHEN The report states how the three runs were made.
  • THEN The command holds --check --no-cache, and the report states that a cached run would return in seconds.

Requirement: Gate-slot wait apart

The report SHALL record the gate-slot wait apart from the step times and SHALL exclude it from the load and check-cost shares.

Scenario: Wait excluded from the shares

  • WHEN The report gives the load share and the check-cost share.
  • THEN The report gives the gate-slot wait in seconds for each run, and the two shares sum to 100 without it.

Requirement: Load and check cost split

The report SHALL state the share of the loaded mean that is the idle cost of the checks and the share that is the load-induced slowdown.

Scenario: Shares sum to 100

  • WHEN The report holds the idle and loaded means of each step.
  • THEN The report gives the check-cost share and the load share as percentages that sum to 100, with the gate-slot wait excluded.

Requirement: Slowest tests and files

The report SHALL list the 50 slowest tests with setup and call times, and the slowest test files, from pytest --durations=50.

Scenario: Slow test list names test_scan

Requirement: Ranked fixes with issues

The report SHALL hold a ranked list of fixes, and each fix SHALL name a new issue that states its acceptance criteria and links back to this issue.

Scenario: Each fix has an issue

Requirement: P0 trigger at 300 seconds

The report SHALL mark each step whose mean idle time is more than 300 s as a P0 trigger, and SHALL state that intake sets the priority label.

Scenario: Step over 300 seconds

  • WHEN The mean idle time of a step is more than 300 s.
  • THEN The report marks that step as a P0 trigger and names the 300 s threshold of AGENTS.md rule 5.

Requirement: Report linked from the router

The change SHALL link docs/ci-performance.md from README.md and docs/index.md, so that the documentation walk from AGENTS.md reaches it within two links.

Scenario: Two-link walk reaches the report

  • WHEN uv run pytest tests/invariants/test_agents_md.py -k within_two_links runs on the change.
  • THEN The test passes and the walk from AGENTS.md reaches docs/ci-performance.md through README.md.

Existing Tool Considered

hyperfine (open, Apache-2.0, maintained; last commit 2026-10-12, fetched 2026-11-10 at https://github.com/sharkdp/hyperfine) times repeated runs and exports JSON, but it gives no per-step split of devops ci and no slow-test ranking. No timing code is needed for those: devops ci prints each step's wall time (src/devops_cli/commands/ci.py:554) and its test row already passes --durations=10 (src/devops_cli/commands/ci.py:643, src/devops_cli/config/constants.py:706), so pytest --durations=50 gives the 50 slowest tests.

Key questions

  • Which tool measures the three runs of devops ci?: devops ci prints the wall time of each step itself (src/devops_cli/commands/ci.py:554), and its CI cache records the same duration_seconds (src/devops_cli/ci/cache.py:50), so the three runs need no custom timing code. hyperfine --runs 3 adds repeated whole-run statistics and JSON export, but it has no per-step split. Read the per-step times from the three devops ci --check --no-cache outputs. (best practice) [sources: src/devops_cli/commands/ci.py:554, src/devops_cli/ci/cache.py:50, https://github.com/sharkdp/hyperfine]
    • Chosen: devops ci output plus hyperfine. devops ci prints and caches each step's seconds; hyperfine repeats the whole run and exports JSON.
    • Rejected: GNU time. It measures one run and gives no per-step split, repeated statistics or JSON.
    • Rejected: custom timing script. It repeats what devops ci already prints and caches, and adds code to keep.
  • Where should the report live?: Add docs/ci-performance.md, link it from the documentation list in README.md and from the Primary Guides of docs/index.md. README.md is one link from AGENTS.md (AGENTS.md:29), so the new page is within two links and the invariant test passes (tests/invariants/test_agents_md.py:321). The issue then links the page. (best practice) [sources: tests/invariants/test_agents_md.py:321, AGENTS.md:29, README.md:52, docs/index.md:5]
    • Chosen: Committed report. It is durable, reviewable, and the two-link test and docs check can check it offline.
    • Rejected: Issue body only. No offline test can check it, and refine needs a testable criterion.
    • Rejected: Pull request description only. It is lost after merge and no offline test can check it.
  • How should the change split load from check cost?: Compare the median idle time of each step with its loaded time from the same step, and report the idle check cost and the load-induced slowdown as shares of the loaded mean that sum to 100. The loaded times come from the duration_seconds of the host's CI cache entries (src/devops_cli/ci/cache.py:50), as feat(ci): limit how many CPU-heavy gates run at once on one host #2336 read them. Record the gate-slot wait apart and exclude it: devops ci starts the step clock after the slot and records the wait as devops_cli_ci_gate_slot_wait_seconds (CONTRIBUTING.md:77). (best practice) [sources: src/devops_cli/config/defaults.py:476, docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md:21, src/devops_cli/ci/cache.py:50, openspec/changes/archive/2026-10-27-2336-ci-gate-slots/proposal.md:43, CONTRIBUTING.md:77, openspec/specs/ci-gate-admission/spec.md:95]
    • Chosen: Per-step median delta. It shows which step grows under load and which is slow when idle.
    • Rejected: Whole-run ratio. It hides the step that causes the slowdown.
    • Rejected: Synthetic CPU load. It does not reproduce the agents' pytest xdist load.
  • What is the P0 threshold for a check?: AGENTS.md rule 5 sets P0 for a check that averages more than 5 minutes, or 300 s (AGENTS.md:13). CONST_CI_TEST_BUDGET_SECONDS is 300.0 for the test step (src/devops_cli/config/constants.py:705), and docs/TESTING.md:172 says the budget measures the mean of the Tests & Coverage check on main, not one local run. [sources: AGENTS.md:13, src/devops_cli/config/constants.py:705, docs/TESTING.md:172]
  • Who sets the P0 priority?: Intake sets the priority label; an agent sets no priority (AGENTS.md:23). The report marks each step whose mean idle time is over 300 s as a P0 trigger, and intake sets the priority of the issue. [sources: AGENTS.md:23]
  • How should the change list the slowest tests?: Run uv run pytest --durations=50; the test row already passes --durations=10 (src/devops_cli/commands/ci.py:643, src/devops_cli/config/constants.py:706), and --durations prints the seconds of each test for setup, call and teardown (openspec/changes/archive/2026-10-27-2356-coverage-floor-and-test-cost/design.md:25). The repo's own per-test measurement used --durations=0 -n0 (openspec/changes/archive/2026-10-24-2098-review-workspace-from-caller/proposal.md:48), which gives stable times without xdist. [sources: src/devops_cli/commands/ci.py:643, src/devops_cli/config/constants.py:706, docs/TESTING.md:189, openspec/changes/archive/2026-10-27-2356-coverage-floor-and-test-cost/design.md:25, openspec/changes/archive/2026-10-24-2098-review-workspace-from-caller/proposal.md:48]
  • Which devops ci steps does the table hold?: The table holds lint and format for ruff, typecheck for mypy, and test, docs and openspec, the names that devops ci prints (src/devops_cli/commands/ci.py:741, :759, :767, :733, :807, :868). The issue's "ruff" and "mypy" rows are these three checks. [sources: src/devops_cli/commands/ci.py:741, src/devops_cli/commands/ci.py:759, src/devops_cli/commands/ci.py:767, src/devops_cli/commands/ci.py:733, src/devops_cli/commands/ci.py:807, src/devops_cli/commands/ci.py:868]
  • Must the three runs bypass the cache?: Yes. devops ci reuses a cached verdict by default (--cache is True, docs/commands/ci.md:15), so runs 2 and 3 of an unchanged tree would return in seconds. Run uv run devops ci --check --no-cache three times, the form the required CI rows use (docs/SDLC.md:200, docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md:31). (best practice) [sources: docs/commands/ci.md:15, docs/SDLC.md:200, docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md:31]
    • Chosen: --check --no-cache. It measures the checks and changes no file between runs; it is the form the required CI rows use.
    • Rejected: Default cached run. Runs 2 and 3 return a cached verdict in seconds, so the table would not hold the cost of the checks.
  • How does the issue get an idle host for the three runs?: A person provides a host with no other agent, or runs the three runs in a window when the shared host is quiet. No repository code can make the host idle: several agents run pytest with xdist on it (src/devops_cli/config/defaults.py:476). Until then, the measurement waits. (a person decides)

Open questions

  • How does the issue get an idle host for the three runs? (a person decides)

Fit

Fits in one pull request.

Suspected block

An idle host with no other agent for the three uv run devops ci --check --no-cache runs.

Dependencies

None.

Activity

  1. added
    source/agent
    type/chore
    scope/ci
    status/new
    value/medium
    effort/medium
    on Nov 10, 2026
  2. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    ContributorAuthor

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

    • Type: type/chore. The chore prefix of the title gives the type.
    • Scope: scope/ci. The (ci) scope of the title gives the scope.
    • Priority: P2-Medium. The measurement supports the slow-check fixes but does not change user behavior by itself.
    • Value: Medium. The idle-host data and the ranked list guide the fixes for a check that exceeds 5 minutes.
    • Effort: Medium. The work needs three runs on an idle host, and other agents keep the shared host busy.
    • Related: chore(ci): the local test row takes over 5 minutes #4405, which asks for a different change. Both items address the slow local check; item 4405 is the umbrella item, and the candidate measures each step on an idle host and ranks the fixes.
  3. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 1ca0133 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.

    • How does the issue get an idle host for the three runs? (a person decides)
  4. dan-petty commented on Nov 11, 2026

    @dan-petty
    Owner

    Closed as not planned: superseded by the CI audit of 2026-11-11

    The audit measured the full suite with per-test coverage contexts, profiled the causes and ranked the fixes. Each fix has its own issue, in plan order:

    1. perf(test): stage gate tests parse every test file per call #4509: parse only the test modules that name the registry
    2. perf(ci): run only the required checks on the release PR #4637: run only the required checks on the release PR
    3. fix(ci): run the job-time alarm on the schedule only #4634: run the job-time alarm on the schedule only
    4. refactor(pr): devops pr update acts only on a failed check #4674 and feat(git): refuse a push that does not hold origin/main #4670: stop pure rebases (folded into the iteration-lane push items)
    5. perf(ci): move the four path checks into filtered workflows #4653: move the four path checks into filtered workflows
    6. perf(ci): build the Service image once for its test shards #4642: build the Service image once for its test shards
    7. perf(ci): stop the cache export of pull request image builds #4646: stop the cache export of PR image builds
    8. perf(ci): cancel superseded CodeQL runs and idle triggers #4651: cancel superseded CodeQL runs and idle triggers
    9. perf(ai): compile one call pattern per symbol in ast graph #4662: compile one call pattern per symbol in ast graph
    10. fix(test): bootstrap-k8s test waits 45 s for the Docker poll #4466: bootstrap-k8s test busy-spin
    11. fix(test): refine failure tests wait 60 s on real retries #4459: refine failure tests real retries
    12. fix(github): pace mutations through the clock seam #4666: pace mutations through the clock seam
    13. chore(ci): keep the per-test times and skip reasons of CI #4673: keep the per-test times and skip reasons of CI
    14. fix(ci): test shards take up to 11 minutes, over the budget #4250: balance the test shards by measured time
    15. fix(ci): set job timeouts from the measured run times #4677: set job timeouts from the measured run times
    16. fix(ci): give the test row and the index build own timeouts #4683: give the test row and the index build own timeouts
    17. test(roadmap): run the limit and monitor tests with small limits #4688: run the limit and monitor tests with small limits
    18. fix(roadmap): judge the registry of the checked-out tree #4695: judge the registry of the checked-out tree
    19. perf(tests): parse the source trees once per worker #4700: parse the source trees once per worker
    20. perf(tests): remove fixed waste in six slow tests #4706: remove fixed waste in six slow tests
    21. fix(tests): refuse real sleeps in tests #4669: refuse real sleeps in tests
    22. fix(tests): close the UDP, DNS and git gaps of the network floor #4711: close the UDP, DNS and git gaps of the network floor
    23. fix(tests): repair the bwrap contract suite and gate it #4715: repair the bwrap contract suite and gate it
    24. test(roadmap): run each implement scenario once with subtests #4722: run each implement scenario once with subtests
    25. perf(ci): skip bytecode compile and unused caches in test jobs #4727: skip bytecode compile and unused caches in test jobs
    26. perf(ci): build the Runner and MCP images in one bake job #4649: build the Runner and MCP images in one bake job
    27. perf(k8s): put the dependencies in their own image layers #4550: sync dependencies before the source copy (folded)
    28. test(dry-run): drop repeated guards and twin cases #4731: drop repeated guards and twin cases
    29. refactor: Delete unused functions after manual caller check #1910: delete src symbols that only tests call
    30. chore(ci): the local test row takes over 5 minutes #4405: show the over-budget shard line as a warning (folded)
    31. perf(ci): direct pytest runs ignore the gate slot #4525: direct pytest runs take the gate slot
    32. perf(ci): run the in-image suite nightly and on image PRs #4644: run the in-image suite nightly and on image PRs (owner decision O1)
    33. perf(ci): build the devcontainer only on its own inputs #4658: build the devcontainer only on its own inputs (owner decision O2)
    34. perf(ci): test each merge once, on the main push #4639: test each merge once, on the main push (owner decision O3)
    35. ci(pages): build the docs site from a workflow with a docs filter #4656: build the docs site from a workflow with a docs filter (owner decision O5)

    The shared host is never idle, so the idle three-run table cannot be made. The CI runner times gate the merge, and the audit measured them.

  5. removed
    status/new
    on Nov 11, 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/p2-mediumscope/cisource/agenttype/chorevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions