Skip to content

perf(ci): pytest start-up and collection on the GitHub runner take half of today's 45 seconds #1735

Closed

Description

@dan-petty

Split from #1725 (CI time budget), so that this row is one issue delivered by one pull request.

Friction

On the GitHub runner, the gate's test step spends about 45s of 266s on start-up and collection. Every xdist worker collects all 11,099 tests: 8.4s serially on a quiet host and 22.9s at load 20. A narrowed -n 0 run of two 0.02s tests took 20.5s of wall time.

Remedy

Cut collection and session start-up at their source, for example:

  • imports a test module doesn't need at collection;
  • session fixtures that do work every run;
  • collection that every worker repeats.

Measure on the runner before and after.

Acceptance criteria

Revised after measuring #1763 on the runner. Start-up and collection went from 38.3s to 27.5s. The rest is each of the four xdist workers rewriting the test modules cold, which pytest cannot reuse across fresh checkouts without new machinery.

  • On the runner, the test row neither rebuilds its environment nor compiles site-packages per worker, and its start-up and collection drop from 38.3s, measured from the CI log.
  • A narrowed run of two trivial tests takes under 5s of wall time on a quiet host.
  • uv run devops ci passes.

Activity

  1. added this to the v0.2.38 milestone on Oct 20, 2026
  2. added
    type/test
    priority/p0-critical
    scope/ci
    source/agent
    on Oct 20, 2026
  3. dan-petty commented on Oct 21, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1763, merged into release/v0.2.38 as 84bfc17.

    Cuts pytest's start-up and collection on the GitHub runner, and the start-up of every narrowed local run.

    9 file(s) changed.

    How it was verified

    Check runs at de6aefd:

    • Fail-to-Pass Self-Check: pass
    • Fail-to-Pass Check: pass
    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • devops-cli: pass
    • zizmor: pass
    • bandit: pass
    • CodeQL: pass
    • Changed-Test Independence: pass
    • Rule Pack Tests: pass
    • Tests & Coverage: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • Static Analysis: pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1735-runner-startup-and-collection.md:

    No Acceptance Criteria section.

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

    priority/p0-criticalscope/cisource/agenttype/test

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions