Skip to content

perf(ci): the gate's test workers finish together and bandit stops competing with the test row #1734

Closed

Description

@dan-petty

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

Friction

The gate's test row is its critical path, and two things lengthen it:

  • Worker imbalance: the slowest xdist worker finishes 47s after the median, and CI shows a 51s tail.
  • bandit competing with pytest: bandit over src and tests takes 21s alone but 61s beside pytest.

Remedy

  • Balance the workers with xdist's own scheduling, --dist worksteal.
  • Run bandit where it doesn't compete with the test row.
  • No check is dropped and no threshold lowered.
  • Measure the gate before and after on a quiet host.

Acceptance criteria

Revised after measuring. The host never went quiet, so the CI runner confirms the saving.

  • A replay of xdist's schedulers over a full run's test times shows the worksteal saving per worker count, and paired full runs show the slowest worker's tail shrinking.
  • Bandit runs at a lower CPU priority than the test row, with the same targets and threshold, and a test pins the argv.
  • uv run devops ci passes.

Activity

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

    @dan-petty
    OwnerAuthor

    What changed

    #1745, merged into release/v0.2.38 as 3e3bc8c.

    The test suite runs with xdist's worksteal scheduling, and the gate starts Bandit under nice. Split from #1725's CI time budget.

    10 file(s) changed.

    How it was verified

    Check runs at aaff739:

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

    Acceptance Criteria of docs/agent/tasks/task-1734-worksteal-and-niced-bandit.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/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions