Skip to content

ci: admission counts no more matrix legs than max-parallel runs at once - #12100

Merged
josephfarina merged 4 commits into
mainfrom
ci/held-legs-count
Nov 16, 2026
Merged

josephfarina merged 4 commits into
mainfrom
ci/held-legs-count

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

Pull-request runs wait their full twelve minutes and then stop with "CI is full" while CI runs far fewer than ninety jobs. Over a recent three-hour window, the jobs that held a runner peaked at about seventy and sat near thirty most of the time, yet the admission count read between ninety and one hundred thirty at each turn-away. A large part of the gap is matrix legs that max-parallel holds back: GitHub lists them as queued jobs, but they hold no runner, and the count read every one as live. A run at tight width (two Node legs running, six held back) counted eight jobs for its Node legs instead of two. test-ui (two of four at once) and swizzle-proof at tight width did the same.

Intended invariant

spec:AST-030 DEC-16: "Each CI or Main run counts its live jobs". A leg that max-parallel holds back holds no runner, so it is not a live job of the run. The admission action's own contract (.github/actions/ci-admission/action.yml) counts each widening matrix at its tight width in peak, which matches. A matrix counts every live leg until one of its running legs names its limit.

Change

  • Each leg of a matrix with max-parallel (test-ui, test-node, swizzle-proof) runs a first step named Run at most ${{ strategy.max-parallel }} legs at once. The limit comes from the strategy itself, so the step always matches the width admission picked or the fixed limit.
  • count.mjs liveJobs counts at most that many live legs of each such matrix. A matrix whose running legs name no limit (no max-parallel, or no leg past its first step yet) counts every live leg, as before.
  • spec:AST-030 DEC-16 says so in one sentence, after "Each CI or Main run counts its live jobs:".
  • No ceiling, peak, wait or required-context rule changes. The measurements back DEC-16's limits as they stand: a waiting main check really holds its full count at once (37 to 38 jobs), and small workflows' jumps within a look interval reach 15 to 18 jobs, which the 18-job reserve covers.

Evidence

  • Failure before the change: a live run at tight width listed 2 running test-node legs and 6 queued legs with no runner, and the count reported it as holding all of them. Held legs added 12 jobs to the count at the median and up to 34 at the most.
  • Success after the change: ci-admission.test.mjs covers the count (tight and full widths, several matrices, a matrix with no limit, legs before their first step) and an admission that now fits beside a tight-width run. A contract test requires the step first in every leg of each matrix with max-parallel.
  • Product/runtime behavior verified unchanged: CI only.
  • CI impact: the three matrix jobs gain one echo step (under a second each, same runners). Runner-minutes per run do not change. Admission frees up to the held legs' count per run at tight width, so waiting runs start sooner and fewer stop with "CI is full".

Scope

Components: CI admission

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm exec vitest run --project node .github/scripts/ci-admission.test.mjs .github/scripts/ci-admission-count.test.mjs .github/scripts/ci-free-runners.test.mjs .github/scripts/ci-test-routing.test.mjs .github/scripts/ci-swizzle-proof.test.mjs .github/scripts/ci-run-scripts-parse.test.mjs .github/scripts/ci-actionlint.test.mjs .github/scripts/ci-heavy-deferral.test.mjs .github/scripts/ci-test-join.test.mjs .github/scripts/ci-node-leg-bounds.test.mjs .github/scripts/ci-duration-guard.test.mjs .github/scripts/ci-checkout-timeout.test.mjs .github/scripts/ci-pr-gate.test.mjs .github/scripts/lib/ci-impact.test.mjs .github/scripts/workflow-paths.test.mjs: all pass.

Writing rubric results

R1 narration: none; the added sentence states how the count treats a held-back leg, in the present tense.
R2 research: none in the record; the load measurements stay in this description.
R3 evidence: none changed.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none.
R7 project status: none.

GitHub lists the matrix legs that max-parallel holds back as queued jobs,
but they hold no runner. The admission count read them as live jobs, so a
pull-request run at tight width (two Node legs running, six held back)
counted eight jobs instead of two, and CI turned runs away while far fewer
than ninety jobs ran.

Each leg of a matrix with max-parallel now runs a first step that names its
limit, and the count takes at most that many live legs of the matrix.
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 16, 2026 5:14pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@astracat-bot

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 16, 2026, 5:22 PM UTC

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8876338

Storybook · Sandbox · built from this PR's head

Package size: measured; main has no measurement of the merge base to compare yet.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

CI impact: −3.5 job-min per update · pool −1.9% · standard runners · 3 CI action or script files changed (not measured)
Before After Change
Job-minutes per PR update 180 176.6 −3.5
Runner pool, runner-minutes a day 67,168 65,878 −1,290 (−1.9%)
Average concurrent jobs 46.6 45.7 −0.9
Time to green (median → this run) 50.5 min — —
Runs a day 373 373 0

Changed jobs: swizzle-proof changed: standard · test-node changed: standard · test-ui changed: standard

Not measured (the jobs that use these keep their recent minutes above): .github/actions/ci-admission/action.yml, .github/actions/ci-admission/count.mjs, .github/scripts/ci-admission.test.mjs.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.

Current run: CI concluded failure; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one correction to the description; the code, workflow and tests need no change.

  • The "Intended invariant" says spec:AST-030 FR16 and DEC-16 state that a pull-request peak counts each widening matrix at its tight width, but neither does (that rule is the admission action's own contract in .github/actions/ci-admission/action.yml), so cite DEC-16's "Each CI or Main run counts its live jobs" and "holds no runner and counts nothing" for this change and attribute or drop the tight-width sentence.

The Testing command also names .github/scripts/ci-impact.test.mjs, which does not exist; the suite is .github/scripts/lib/ci-impact.test.mjs, and it passes there. The four new tests fail on the base and pass on this head.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claims:
    • Held-back legs were counted as live, so a tight-width run counted eight Node legs while two ran: verified (the base count took every queued job; ci.yml max-parallel).
    • test-ui and swizzle-proof were overcounted the same way: verified (ci.yml:1060, :1589).
    • The governing record says each run counts the jobs it holds: verified against DEC-16 ("counts its live jobs", "holds no runner and counts nothing").
    • The governing record says a pull-request peak counts widening matrices at tight width: false (the finding above).
    • Each max-parallel matrix runs a first step that names its limit, taken from the strategy: verified (ci.yml:1072, :1262, :1601).
    • The count caps each such matrix and counts every live leg when no limit is named: verified (count.mjs:85-110; ci-admission.test.mjs:746).
    • No ceiling, peak, wait or required-context rule changes: verified.
    • The tests cover tight and full widths, several matrices, no limit, legs before their first step, an admission that now fits, and the step contract: verified (ci-admission.test.mjs:688, :727, :746, :1088).
    • The CI cost is one short echo step per leg: verified.
    • The load measurements (peaks, median and largest held-leg counts): not checkable from the repository.
    • The listed test files all pass: verified on this head, apart from the one path that does not exist.
    • No public API, product behavior or internal context: verified.
  • Files:
    • .github/actions/ci-admission/action.yml: clear
    • .github/actions/ci-admission/count.mjs: clear
    • .github/scripts/ci-admission.test.mjs: clear
    • .github/workflows/ci.yml: clear

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not finished on this head yet.

The description now cites spec:AST-030 DEC-16 for this change and attributes the tight-width peak to the admission action's own contract, and its test list names the right files; the code, workflow and tests needed no change. One optional wording point: in DEC-16, "holds no runner and counts nothing" is said of a run not updated in two hours, so "Each CI or Main run counts its live jobs" is the sentence that carries this change.

Claims and files checked

Review mode: incremental; reason: none

Changed rules (0): none

  • Claims:
    • Legs that max-parallel holds back were counted as live, so a tight-width run counted eight Node legs while two ran: verified (the base count took every queued job; this pull request's own CI run lists two running and six queued Node legs).
    • The UI shards and the swizzle proof were overcounted the same way: verified (their max-parallel settings in the CI workflow).
    • The load measurements (peaks, median and largest held-leg counts): consistent with the code; they are run data the repository does not hold.
    • The governing decision says each CI or Main run counts its live jobs: verified, an exact quote.
    • It says that what holds no runner counts nothing: the words are exact but describe a stale run (the optional wording point above).
    • The admission action's own contract counts each widening matrix at its tight width in its peak: verified (the action's header and its peak input).
    • Each max-parallel matrix runs a first step named from its own limit: verified in all three matrices.
    • The count caps each such matrix, and a matrix whose legs name no limit counts every live leg: verified in the count and its tests.
    • No ceiling, peak, wait or required-context rule changes: verified.
    • The tests cover tight and full widths, several matrices, no limit, legs before their first step, an admission that now fits, and the step contract: verified; the four new tests fail on the base and pass on this head.
    • The CI cost is one short echo step per leg: verified.
    • The listed test files all pass: verified on this head.
    • No public API, product behavior or internal context: verified.
  • Files:
    • .github/actions/ci-admission/action.yml: clear
    • .github/actions/ci-admission/count.mjs: clear
    • .github/scripts/ci-admission.test.mjs: clear
    • .github/workflows/ci.yml: clear

Automated review (maintainer link)

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 16, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8681169

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one fix so the workflow and an existing CI test agree; the count change itself conforms to the CI spec, and the DEC-16 sentence is owner-approved at this head.

  • Found by CI: the new first step of test-node (.github/workflows/ci.yml:1262) breaks scripts/vitest-node-legs.test.mjs:145, which requires the budget stop step to come first, so the required test-node legs and the test check fail on this head; assert the stop step right after the new step there (or look it up by name) and update the comment at ci.yml:1247-1248.

Optional: the new DEC-16 sentence and the action header say a max-parallel matrix counts at most that many live legs, but the count caps it only once a running leg reports its limit, so naming that fallback would match count.mjs. The description's second DEC-16 quote ("holds no runner ... counts nothing") is said of a stale run, not of a held-back leg.

Claims and files checked

Review mode: full; reason: spec-record

  • Claims:
    • Legs that max-parallel holds back were counted as live, so a tight-width run counted eight Node legs while two ran: verified (the old count took every queued job; the new admission test fits a run that the old count turned away).
    • The UI shards and the swizzle proof were overcounted the same way: verified (their max-parallel settings in the CI workflow).
    • The load measurements (peaks, held-leg counts, small-workflow jumps, the waiting main check's count): run data the repository does not hold; consistent with the code.
    • The governing decision says each CI or Main run counts its live jobs: verified, an exact quote.
    • It says that what holds no runner counts nothing: the words are exact but describe a stale run.
    • The admission action's own contract counts each widening matrix at its tight width in its peak: verified (the action's header and its peak input).
    • Each max-parallel matrix runs a first step named from its own limit, so it matches the width admission picked: verified in all three matrices and in this head's CI run (two for the UI shards, eight for the Node legs at full width).
    • The count caps each such matrix, and a matrix whose legs name no limit counts every live leg: verified in the count and its tests.
    • The CI spec's decision now says so in one sentence: verified.
    • No ceiling, peak, wait or required-context rule changes: verified; the required test check fails for the reason above.
    • The tests cover tight and full widths, several matrices, no limit, legs before their first step, an admission that now fits, and the step contract: verified; the four new tests fail on the base and pass on this head.
    • The CI cost is one short echo step per leg: verified.
    • The listed test files all pass: verified on this head; the list leaves out the Node leg plan test, which fails.
    • No public API, product behavior or internal context; the writing rubric finds no narration or status in the record edit: verified.
  • Files:
    • .github/actions/ci-admission/action.yml: optional wording (the fallback)
    • .github/actions/ci-admission/count.mjs: clear
    • .github/scripts/ci-admission.test.mjs: clear
    • .github/workflows/ci.yml: blocking (the new first step of test-node breaks the Node leg plan test; stale comment at 1247-1248)
    • docs/specs/AST-030/spec.md: optional wording (the fallback)

Automated review (maintainer link)

Comment thread .github/workflows/ci.yml Resolved
Comment on lines +1114 to +1116
matrix that limits its legs with `max-parallel` counts at most that many of
its live legs, since GitHub lists the legs it holds back as queued but they
hold no runner; a pull-request run still waiting counts the jobs it runs, the job that waits, a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: liveJobs caps a matrix only once one of its live legs reports its limit (count.mjs:88-95); before that it counts every live leg (ci-admission.test.mjs:746-751). Wording that matches: "a matrix whose running legs report their max-parallel counts at most that many of its live legs". The same applies to the header at .github/actions/ci-admission/action.yml:40-42.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8876338

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not finished on this head yet.

The admission count change conforms to the CI spec's DEC-16, the DEC-16 sentence is owner-approved at this head, and the Node leg plan test now agrees with the new first step of test-node.

Optional: the new DEC-16 sentence says a max-parallel matrix counts at most that many live legs, but the count caps it only once a running leg reports its limit; naming that fallback, as the action header now does, would match count.mjs.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claims:
    • Pull-request runs wait their full time and stop with "CI is full" while far fewer than ninety jobs run: the twelve-minute wait and the message are verified in the admission action; the load figures are run data the repository does not hold.
    • Legs that max-parallel holds back were counted as live, so a tight-width run counted eight Node legs while two ran: verified (the old count took every queued job; the new tests count two).
    • The UI shards and the swizzle proof were overcounted the same way: verified (their max-parallel settings in the CI workflow).
    • The governing decision says each CI or Main run counts its live jobs: verified, an exact quote.
    • The admission action's own contract counts each widening matrix at its tight width in its peak: verified (the action header and its peak input).
    • A matrix counts every live leg until one of its running legs names its limit: verified in the count and its tests.
    • Each max-parallel matrix runs a first step named from its own limit, so it matches the width admission picked: verified in all three matrices and in the previous head's CI run (two for the UI shards, eight for the Node legs at full width).
    • The count caps each such matrix, and a matrix whose legs name no limit counts every live leg, as before: verified.
    • The CI spec's decision says so in one sentence: verified.
    • No ceiling, peak, wait or required-context rule changes: verified.
    • The load measurements (a waiting main check's 37 to 38 jobs, small-workflow jumps of 15 to 18, held legs adding 12 jobs at the median and 34 at most): run data the repository does not hold; the 18-job reserve is verified in the count.
    • The tests cover tight and full widths, several matrices, no limit, legs before their first step, an admission that now fits, and the step contract: verified.
    • The CI cost is one short echo step per leg: verified.
    • The listed test files all pass: verified on this head; the Node leg plan test, not listed, passes too.
    • No public API, product behavior or internal context, and the writing rubric finds no narration or status in the record edit: verified.
  • Files:
    • .github/actions/ci-admission/action.yml: clear
    • .github/actions/ci-admission/count.mjs: clear
    • .github/scripts/ci-admission.test.mjs: clear
    • .github/workflows/ci.yml: clear
    • docs/specs/AST-030/spec.md: optional wording (the fallback)
    • scripts/vitest-node-legs.test.mjs: clear

Automated review (maintainer link)

@josephfarina
josephfarina merged commit f10e226 into main Nov 16, 2026
149 of 151 checks passed
@github-actions
github-actions Bot deleted the ci/held-legs-count branch November 17, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 8876338a Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant