Skip to content

gate: class 1a's critical path halved: static's checks at once on cpus-16, unit in four shards (unit k/4) - #108

Merged
SSFSKIM merged 5 commits into
masterfrom
critical-path
Oct 21, 2026
Merged

SSFSKIM merged 5 commits into
masterfrom
critical-path

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Cuts class 1a's wall on the pool roughly in half: from the plan's end to the last job, 586 s becomes 310 s (median of three green runs each, same base, same 22,457 tests).

For the architect's records: the unit job is now unit k/4 on the pool. The whole suite runs as four jobs, unit 1/4 to unit 4/4. Each is pnpm test --shard=k/4 on its own cpus-8 box, and each uploads its JUnit report as test-results-unit-<k>of4-<attempt>. ci-kit's test-history collector reads the four reports as one unit line per run attempt (ci-kit #69, merged as f57799687 and live from the 00:40Z collection). The job stays the one unit in two cases: a --affected run in vitest's related mode, and any run off the pool (hosted Linux or the Mac). --gates unit, the plan's unit switch and every script keep the gate name; only the job's display name changes. No Mac job changes.

What changes

  1. static runs its checks at once on cpus-16 (.github/scripts/gate-bg.sh).
    • Before, pnpm typecheck's five tsc projects, eslint, pnpm build and the gate scripts' tests ran one after another, each single-threaded, on a cpus-4 box.
    • Now they start together. Each check still has its own step, which streams its log, adds its gate-run summary block and fails on its own status.
    • The commands are unchanged; typecheck's projects are read from the script.
    • At once they peak at about 15 GB. That is cpus-16's 32 GB; on cpus-8 they reached 14.3 of 16 GB.
  2. eslint ignores electron.vite.config.<ms>.mjs. electron-vite writes that bundle beside its config while loading it, then deletes it. Linting beside the build once listed the file, then failed ENOENT (run 39599150487).
  3. unit runs in four shards on the pool, as above. gate-plan.mjs emits the matrix as unit_shards, with UNIT_SHARDS = 4 and UNIT_CPUS = 8.
  4. ci-gate handles shard names. Two fixes from review:
    • A GCE-preempted unit k/4 is rerun alone. ci-gate-preemptions.sh used to split job names on spaces.
    • A relaunch line names the gate unit once, however many shards were red (ci-gate-refusals.sh).
  5. static runs its checks at once only on a machine with 24 GiB or more. Below that it runs them one at a time, with the same steps, logs and summaries. This covers Class1a: linux (the hosted runner's 7 GB) and Class1a: macos (the 16 GB mini, which e2e shares).

Review: doperpowers:reviewer-medium on the branch found three P2s, items 4 and 5 above. A fix wave added a test for each that fails before its fix. A delta reviewer-medium on the fix commits found nothing material.

Measurements

Base: master 21fc073 for every arm and its baseline. A 2 s memory and CPU sampler ran in every arm's jobs, the baseline's included. Each run was scripts/ci-gate.sh <sha> --gates static,unit,probes --class1a pool, on scratch ci/cp-* refs that have since been deleted. Arms ran in waves paired with baseline runs.

The adoption rule: 3 green runs, equal test counts, and a median gain larger than the baseline's spread and at least 15 s. Times are in seconds. "unit" is the longest shard, and "plan→last" runs from the plan job's end to the last job's end.

Arm Green runs static unit plan→last (spread) Verdict
baseline (static cpus-4, unit cpus-8) 39593394541, 39594748354, 39596194909, 39604076669, 39607145783, 39608858692 447 492 586 (73) the reference
S1-8 + U1 (unit cpus-16, one job) 39593400490, 39594753469, 39596201720 200 315 419 (47) S1-8 too tight on memory; U1 beaten by shards
S1-16 + 2 shards x cpus-8 39593407097, 39594759622, 39596208071 160 319 413 (38) superseded
baseline static + 3 shards x cpus-8 39593413338, 39594765051, 39596217011 (baseline) 242 — shards scale; see z1
S1-16 + 3x8 39604084914, 39607153728 (red: 39608865906) 198 244 348 (60) superseded by 4x8
S1-16 + 4x8 (this PR) 39604089705, 39608873174, 39608879866 (red: 39607160893) 147 213 310 (5) adopted: −276 s
S1-16 + 5x8 none of 2 (39604097046, 39607168767) red
6x8, 3x16, 4x16 none of 2 each red
6x4 39597651782, 39599164073 299, 485 slower than 3x8
S1b (also the build's halves and eslint --concurrency) 4 runs 152 vs 167 −15 s, inside the spread; dropped

Not built: incremental tsc from a master-built .tsbuildinfo. After S1, static's longest check is electron-vite's own build (111-131 s, the renderer's React Compiler pass). tsc's longest project is 77-102 s, and static (147 s) is no longer the run's longest job.

The final class 1a run on this head (54fbf84, rebased on master 7c52489) was green: 39613754154. plan→last was 341 s and the wall 366 s. static took 168 s (gate-bg read 31.3 GiB and ran the checks at once). The shards took 275/183/230/241 s, after VM waits of 66-73 s. 22,459 tests passed in total across the shards (master gained two since the base). The artifacts are test-results-unit-1of4-1 to -4of4-1. The same tree before the review fixes (c6a7660) was green too: 39610724951, plan→last 324 s.

Flakes the shards surfaced (for the tracker)

  • Shapes beyond 4x8 fail on cold transforms. Five or more shards, or cpus-16 shards, were red in every run. In those shapes each shard transforms the renderer graph cold, with fewer files to spread the cost over; transform is 35-46% of a shard's vitest time, against 15% unsharded. Suites that wait on those transforms then time out:
    • renderer-compiled src/renderer/src/transcript/view/TranscriptSlot.test.tsx: "Hook timed out in 10000ms", in every cpus-16 shard set (39597646480, 39597659332, 39599157286, 39599171772); test failures at 5x8 (39607168767);
    • renderer-compiled src/renderer/src/tools/scm/ScmShell.test.tsx: "draws the selected file's hunks…" (39597659332, 39599157286);
    • EnvironmentTeardownError (transcript view modules imported after teardown) at 6x8 (39597640258, 39599150487).
  • apps/desk-hub/test/reply-chain.test.ts fails at 3 and 4 shards: "a hello whose have the stream does not take (D1) > stops its opening bundle: 503 with frames 0…" (39607160893 at 4x8, 39608865906 at 3x8). This is the one red this shape has shown, 1 run in 4.
  • Seen once each: desk-hub reconnect.test.ts and org-directory.test.ts (5x8, 39604097046); src/main/connectors/oauth-provider.test.ts's rotation race (6x8); src/engine-host/fs/service.test.ts's 200 ms bound (4x16). provisioning-sweep and session-plane also failed, but desk-hub: fix two test flakes (the offline sweep's 401, the lease test's margin) #107 fixed those on master.

Cost and capacity

A class 1a run now asks for 50 vCPU (16 + 4x8 + 2), against 14 before. The pool admits 192 at once (max_vcpus, the C3D quota), so three concurrent class 1a runs fit and a fourth waits for VMs. Raises for C4D us-west4 and for all regions are filed with CI-opt. Busy vCPU-seconds per run rise about 1.5x, from a median of 5,850 to 8,780 (job time × box size; VM boot not counted). The owner has ruled cost no constraint.

What is left of the 310 s

  • About 100 s is the VM start (the slowest of six). CI-opt has decomposed it for ci-kit (launcher tick, insert, boot); no ci-kit change is in this PR.
  • About 45 s of each shard is checkout, setup and build:main-preload.
  • The next unit lever is a delivered vitest transform cache (test-history M5's CD), re-measured on the sharded form.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)

static ran its checks one after another (pnpm typecheck's five tsc
projects, eslint, pnpm build, the gate scripts' tests), each a single
thread, so its 4-core box sat mostly idle for 437-524 s. They now start
together. gate-bg.sh starts each one in the background, and each keeps a
step of its own that streams its log and adds its gate-run summary.
Each project of `pnpm typecheck` is its own process, read from the
script.

The box moves to cpus-16. At once, the checks peak at about 15 GB, and
on cpus-8 they peaked at 14.3 GB of 16. Over three runs each, static
took 147-161 s (median 147) against 437-511 s (median 447).

Two fixes the overlap needed:
- the background subshell holds none of the step's output, so the
  runner no longer waits about 5 s for it to close;
- eslint ignores electron-vite's transient bundled config
  (electron.vite.config.<ms>.mjs). eslint listed it while the build
  was loading its config, then failed ENOENT (run 39599150487).

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
One vitest process keeps its box's cores only 55-70% busy, because its
main process transforms modules for every worker. On cpus-16 the unit
job took 311-349 s, against 486-494 s on cpus-8. Separate processes on
separate boxes scale further. On the pool, gate-plan.mjs now plans the
full suite as UNIT_SHARDS=4 jobs on cpus-8, named `unit 1/4` to
`unit 4/4`. Each runs `pnpm test --shard=<k>/4`, and each uploads its
JUnit report as test-results-unit-<k>of4-<attempt>. ci-kit's collector
(#69, merged) reads those reports together as one `unit` report.

A selected run that tests only the related suites stays the one job
`unit`, and so does a run off the pool. A selected run that falls back
to the whole suite is sharded like any other.

The shapes measured:
- 2x8 and 3x8: every run green.
- 4x8: 3 of 4 runs green. The red one was desk-hub reply-chain.test.ts,
  which also failed once at 3x8.
- 5x8, 6x8, 3x16 and 4x16: red in every run. Suites that wait on cold
  transforms failed, chiefly renderer-compiled TranscriptSlot.test.tsx's
  hooks (10 s).
- 6x4: green, but slower than 3x8.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
…luded

settle_run kept the preempted jobs it had pending, retried, preempted
twice and refused in space-separated lists, and its summary split them
on spaces. A preempted `unit 2/4` (unit's shards on the pool) became
`unit` and `2/4`, neither of them a job: nothing was rerun, the run
stayed red, and the summary read `preempted by GCE (0):`. The lists now
hold one whole name a line, and reach the summary's awk through the
environment, since awk's -v takes no newline. The jobs are sorted on
their tab-separated name field, where `sort -k2` split on blanks and
held only because its key ran to the end of the line.

ci-gate-preemptions.test.mjs plays a preempted `unit 2/4` rerun alone
to green, and three shards at once: one green on its rerun, one
preempted again, one whose rerun GitHub refuses.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
The relaunch line copied each refused or red job's name into --gates,
so a run with a red `unit 2/4` printed `--gates e2e:library,unit 2/4`,
which the CLI cannot parse and the plan would refuse. A job named
`unit <k>/<n>` now relaunches as the gate `unit`, named once however
many shards were red or refused; the plan shards it again. The refused
list is kept one whole name a line, as settle_run's now are, where it
was split on spaces.

ci-gate-refusals.test.mjs pins both: a refused e2e group beside two
red shards relaunches as `--gates e2e:library,unit`, and a refused
shard is matched by its whole name.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
static's job also runs on `Class1a: linux`, the hosted runner (7 GB on
a private repository), and on `Class1a: macos`, the 16 GB mini that e2e
shares. Together its checks peak at about 15 GB, measured on the pool,
so gate-bg.sh now decides from the machine: at once with 24 GiB or more
of memory (the pool's 16-core box has 32), otherwise one at a time,
each `start` running its command to its end before it returns and
writing the same log, summary and status, so the wait steps read them
unchanged. The job's first start reads the memory (/proc/meminfo's
MemTotal on Linux, `sysctl -n hw.memsize` on macOS), says which mode in
its output, and the later starts keep its decision. GATE_BG_MEMORY, in
bytes, stands in for the reading in a test. A start step whose check is
red still goes on; that check's wait step is red.

.github/scripts/gate-bg.test.mjs, which static's gate-scripts check
collects, plays both modes on a fake package.json and fake checks: at
32 GiB every start returns while its check runs, at 16 GiB they run in
order, and the wait steps read the same in both. A third case checks
that the decision without the stand-in follows the machine's own
memory, as node's os.totalmem() reads it.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T14:16:15.401525Z 54fbf84 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit f24a18c into master Oct 21, 2026
SSFSKIM added a commit that referenced this pull request Oct 21, 2026
…s checks at once on the 16-core box, unit in four shards 'unit k/4'; plan to last job 586 s -> 310 s; 4x8 the measured edge, TranscriptSlot's hooks red past it), a §3.5 line on the shard names; tracker +2 (desk-hub reply-chain flake, TranscriptSlot's cold-transform hooks)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@SSFSKIM
SSFSKIM deleted the critical-path branch October 21, 2026 14:17
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