Skip to content

ci: run the provider plan's classifier, lookup and choice in one job - #2394

Merged
davidtai merged 5 commits into
devfrom
ci/one-plan-job
Nov 20, 2026
Merged

davidtai merged 5 commits into
devfrom
ci/one-plan-job

Conversation

@davidtai

@davidtai davidtai commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

CI's plan (.github/workflows/provider-plan.yml, called by CI (dev) and CI (master)) ran five GitHub-hosted jobs one after another, and no macOS job starts before the last one ends:

  1. commit ("Resolve the commit to test", from ci: PR workflows run on request only; dispatch CI against one commit #2399): resolves a dispatch's ref. It does nothing on other events.
  2. changes ("Detect Component Changes", the reusable component-changes.yml): the classifier.
  3. tested ("Find an earlier test of this tree"): the tree lookup.
  4. components ("Choose the components to test"): the choice.
  5. route ("Select Runners").

This PR folds jobs 2 to 4 into one job, components ("Plan the components to test"). It runs the same steps in the same order. commit and route stay separate jobs. route changes only its needs (now components). darkbloom-route.yml is not touched. The plan goes from 5 jobs in a chain to 3.

Why

Each job in the chain adds a runner start and a gap between dependent jobs, about 2 to 5 s each. Every macOS job (the build jobs, then all test shards) waits for the plan. So the time the plan saves moves the start of every macOS job, and with it the end of every CI run.

What changed, per file

  • .github/workflows/provider-plan.yml: one job components: needs: commit, if: ${{ !cancelled() }}, ubuntu-24.04, timeout-minutes: 10, permissions contents: read and actions: read (the union of the old jobs; both callers grant exactly these). Steps:
    1. Checkout with fetch-depth: 0, filter: blob:none, persist-credentials: false (the classifier's checkout; the lookup script is in it). It runs only when inputs.run_tests is true and commit succeeded, as the changes job did.
    2. paths: python3 scripts/ci-component-paths.py, with continue-on-error: true, under the same condition. Its outcome is the changes_result output, as needs.changes.result was: success, failure, or skipped (without run_tests, or when a dispatch's ref was refused). The Provider Tests gate still requires success.
    3. tree and lookup: the same commands and env as dev, dispatch handling included (EVENT read once, SHA from commit, SELECTED from the classifier's outputs). They run only when steps.paths.outcome == 'success', as tested ran only when changes succeeded.
    4. choose: the same script, with if: ${{ !cancelled() }}. It runs after a failed lookup or classifier, as the separate components job (if: !cancelled()) did. A failed or skipped lookup leaves skip empty, which tests.
      All 14 outputs of the workflow keep their names and meanings. The 12 that the old jobs produced now read jobs.components.outputs.*; routes and sha are unchanged.
  • .github/workflows/component-changes.yml: deleted. The plan was its only caller.
  • scripts/ci-component-paths.py, scripts/docs-impact-rules.json: drop the deleted file from the path lists.
  • scripts/test-ci-component-paths.py, test_expensive_jobs_depend_on_successful_classifier, checks the new job:
    • the plan's three jobs and the job's step order;
    • the classifier's if, id, continue-on-error (the job's only one) and command, and changes_result from its outcome;
    • the tree/lookup condition and SELECTED;
    • needs: commit with !cancelled(), the choose condition and SKIP, route needing components, and the component outputs;
    • no github.event_name in the classifier step and exactly one in the lookup step;
    • the same cluster_gpu cases, run against the choose step.
  • scripts/test-ci-component-paths.py, test_detector_has_full_history...: checks the plan job's checkout (fetch-depth: 0, blobless, no persisted credentials, not sparse), that the classifier step uses no API, that the classifier outputs reach SELECTED and choose, and that component-changes.yml is gone. The forbidden-content file lists check provider-plan.yml in place of the deleted file.
  • scripts/test-darkbloom-route.py: updates the classified workflow set, the GitHub-hosted job list and the write-permission scan. test_classifier_gate_and_route_need_no_routed_runner checks that route needs components and that the classifier runs in the GitHub-hosted plan job. plan_count reads every input, skip included, from the plan job.
  • scripts/test-provider-ci-workflow.py: the checkout test checks the gate's sparse checkout and the plan job's full blobless checkout (no .git cache) separately. Dev's commit checks are kept.
  • docs/developer/build.md (CI Workflows, CI runner routing): describes the plan's three jobs.

Before

flowchart LR
  classDef gh fill:#e1ecfd,stroke:#1f5fbf,color:#000
  classDef wait fill:#fde2e1,stroke:#c0392b,color:#000
  classDef mac fill:#e3f2e1,stroke:#2e7d32,color:#000
  K["commit: Resolve the commit"]:::gh --> W0["job start"]:::wait --> A["changes: Detect Component Changes"]:::gh --> W1["job start"]:::wait --> B["tested: Find an earlier test"]:::gh --> W2["job start"]:::wait --> C["components: Choose the components"]:::gh --> W3["job start"]:::wait --> R["route: Select Runners"]:::gh --> M["macOS build and test jobs"]:::mac
Loading

After

flowchart LR
  classDef gh fill:#e1ecfd,stroke:#1f5fbf,color:#000
  classDef wait fill:#fde2e1,stroke:#c0392b,color:#000
  classDef mac fill:#e3f2e1,stroke:#2e7d32,color:#000
  K["commit: Resolve the commit"]:::gh --> W0["job start"]:::wait --> P
  subgraph P["components: Plan the components to test"]
    S1["checkout full history"]:::gh --> S2["classify, continue-on-error"]:::gh --> S3["lookup, if classify succeeded"]:::gh --> S4["choose, unless cancelled"]:::gh
  end
  P --> W["job start"]:::wait --> R["route: Select Runners"]:::gh --> M["macOS build and test jobs"]:::mac
Loading

Measured

Plan wall time is the time from the first plan job's start to the route job's end. No macOS job starts before then. "Checkout" is the classifier's full-history checkout step; its time varies a lot from run to run. "Rest" is the wall time minus the checkout: the job starts, the gaps between jobs, the lookup, the choice and the route. This PR changes only the rest.

Run Plan jobs Start Route end Plan wall time Checkout Rest
Before: 44685991632 (dev push) 5 06:11:01 06:11:45 44 s 18 s 26 s
Before: 44682336430 (dev push) 5 05:38:12 05:38:53 41 s 16 s 25 s
Before: 44682739706 5 05:41:57 05:42:49 52 s 20 s 32 s
Before: 44678094153 5 05:00:17 05:01:01 44 s 16 s 28 s
Before: 44678601420 5 05:04:49 05:05:34 45 s 19 s 26 s
After: 44678407177 3 05:03:01 05:03:32 31 s 16 s 15 s
After: 44686362091 3 06:14:11 06:15:01 50 s 30 s 20 s

Before, median of 5 runs: 44 s wall time (41 to 52 s); the rest took 26 s (25 to 32 s). After, 2 runs: 31 s and 50 s wall time; the rest took 15 s and 20 s.

  • Saving: about 9 s per run (the rest: 26 s median before, 15 to 20 s after). Every macOS job of the run starts that much sooner. At about 75.9 provider runs a day: 75.9 × 9 s ≈ 683 s ≈ 11 minutes of CI wall time a day, summed over runs. The macOS jobs run no shorter, so this saves no macOS lane-minutes.
  • GitHub-hosted plan jobs per run go from 5 to 3: 2 fewer job starts per run, about 152 a day.
  • The wall time varies mostly with the checkout (16 to 30 s here). In the 50 s run, fetching the history took 9 s. Checking out the 7,269 files took 21 s, because a blobless clone fetches each file's contents on demand. The old classifier job did the same.
  • Before this PR's first merge of dev (before ci: PR workflows run on request only; dispatch CI against one commit #2399 added commit), the old shape had 4 plan jobs. There, 6 runs had a median of 40 s with a rest of 24 s; this PR's run 44671742766 took 40 s with a rest of 17 s.

Follow-up (not in this PR)

The classifier reads only the event JSON and runs git on commits and trees (git rev-parse, merge-base, diff --name-only). The lookup reads only scripts/ci-tested-tree.py. A sparse checkout of the two scripts (history unchanged) would skip about 20 s of file downloads, which is most of the plan's remaining time. It changes the checkout this PR keeps as it was, so it is left to a separate change.

Validation

  • Run 44686362091 on head 39e0aa1 (this branch merged with dev at 2346f3b): every job passed. That covers the plan's three jobs, Check the CI plans (the structural tests, including the three changed test files), both build jobs, Cluster Focused Checks (2 shards), Cluster Release Build Checks, Cluster Runtime Tests (5 shards), Provider Unit Tests (2 shards) and the Provider Tests gate. The gate received CHANGES_RESULT: success and SKIP: false from the new job.
  • Earlier runs on this PR failed only in macOS jobs, for causes outside this change:
    • 44671742766 and its failed-jobs rerun (attempt 2): a self-hosted runner lost communication; a timing assertion in ClusterOrphanReaperTests; HardwareLoadMonitorTests and FanStartupDiscoveryTests timeouts on test-provider-1; GLM5NextResidentRuntimeTests "requires a GPU device and its recommended working set" on test-cluster-1.
    • 44678407177: the same GLM failure, and a provider build that stalled until it was cancelled after 65 min.
    • ci: test-cluster-1 asks 4x24 and test-provider-1 8x16, which their tests need #2404 (test-cluster-1 4x24, test-provider-1 8x16) fixed the lane sizes; the green run includes it. Check the CI plans passed in all three runs.
  • Not validated by CI: the dispatch path (ref/pr) and the run_tests: false path of CI (master). A PR run on dev is neither. Both were checked by reading the code: the step conditions give the same results as the old job conditions.

Limitations

  • When the classifier fails, the plan job now stays green (continue-on-error, as ordered). The failure shows in the classifier step and in the Provider Tests gate, which still fails on changes_result != success. Before, the changes job itself turned red.
  • When the checkout fails, changes_result is skipped (the classifier step did not run), not failure. The gate fails either way, and the plan job is red.
  • Five before-runs and two after-runs. The checkout time varies widely, so the 9 s is an estimate.

Refactor pass

A refactor reviewer subagent traced every updated assertion through the test helpers (step_blocks, field, run_command, checkout_options, continues_on_error, jobs) against the new YAML. It also checked the invariants: the outputs, run_tests: false, the lookup env, the permissions, and that unlabel and darkbloom-route.yml are untouched. It made no change and noted the two limitations above; the first is the ordered design. It reviewed the change before the merges of dev. The merge adaptation (needs: commit, the two step conditions, the no-API check narrowed to the classifier step because dev's tree step uses the API) was not reviewed again by a subagent.

Documentation impact

docs/developer/build.md describes the plan's jobs. docs/developer/test.md does not describe them, so it is unchanged. No changelog fragment (CI-only change).

Done on David's direct order (2026-11-20, 'high prioritize the test optimization') from the CI-routing session; the d-inference session (layr-labs-2d) owns this repo's other dev work.

🤖 Generated with Claude Code

The plan ran three GitHub-hosted jobs in a chain (Detect Component
Changes, Find an earlier test of this tree, Choose the components to
test) before the route job, and no macOS job starts before the route
ends. One job now runs the same steps in order: the classifier
(continue-on-error; its outcome is changes_result), the tree lookup only
when the classifier succeeded, and the choice unless cancelled. Every
output keeps its name and meaning. component-changes.yml had no other
caller and is deleted. The structural tests check the new job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidtai davidtai added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 20, 2026
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 20, 2026 7:21am UTC
darkbloom-status Ready Ready Preview Nov 20, 2026 7:21am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 20, 2026 7:21am UTC

Request Review

Dev added the `commit` job (a dispatch's ref, resolved once) that the
classifier waited for. The one plan job now needs `commit` and runs the
checkout and the classifier only when it succeeded, as the classifier job
did; the tree and lookup steps keep dev's dispatch-aware env. The tests
check the new `needs`, the step conditions, and scope the no-API check to
the classifier step (dev's tree step reads a dispatch's tree through the API).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidtai davidtai added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 20, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 20, 2026
@davidtai
davidtai merged commit 023510e into dev Nov 20, 2026
23 checks passed
@davidtai
davidtai deleted the ci/one-plan-job branch November 20, 2026 07:48

This branch was successfully deployed

3 active deployments
Preview – d-inference-landing — db6d7a1c Deployed Nov 20, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — db6d7a1c Deployed Nov 20, 2026 by vercel[bot]
Preview – darkbloom-status — db6d7a1c Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant