Skip to content

free-ci-health: a split shard's overrun compares wall time with its prediction over jobs (GST-1653) - #4085

Merged
capy-ai[bot] merged 1 commit into
mainfrom
capy/gst-1653-shard-overrun-jobs
Nov 6, 2026
Merged

capy-ai[bot] merged 1 commit into
mainfrom
capy/gst-1653-shard-overrun-jobs

Conversation

@garrytan

@garrytan garrytan commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 4085,
  "head": "5e2964d322ba572980201c920978ec547fbdb244",
  "version": "1.96.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1613,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 42249997890,
      "attempt": 1,
      "tree": "b51619a4dd6f4ca87990b6b0a67bbc7fb6729939"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "b51619a4dd6f4ca87990b6b0a67bbc7fb6729939",
  "product_patch_id": "ba8a059c8884c2d2975fd5ce94bb12a58d88b601",
  "gstack_version": "1.96.0.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 20,
    "rules": "70895942bb8a8ee2",
    "base": "8d7091ac1a879d9e3e724391bde2446c29de842d",
    "registry": "8d7091ac1a879d9e3e724391bde2446c29de842d",
    "gate_scan": {
      "tagged": 0,
      "head": "5e2964d322ba572980201c920978ec547fbdb244"
    },
    "reasons": [
      "runtime=20"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "pass @b51619a4dd6f (7 checks, current for 5e2964d322ba)",
  "issues": {
    "fixes": [
      3851
    ],
    "refs": [
      4051
    ],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md against base 8d7091ac"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "est_input_tokens": 2735,
    "ledgers_read": 2,
    "dispatches": {
      "specialist-batched": 1
    }
  }
}

What changed

A 4-job shard that ran 1.6x its share now warns; before, it needed about 6x

A 4-job shard that ran 1.6x its share now warns; before, it needed about 6x.

Before/after as text: A 4-job shard that ran 1.6x its share now warns; before, it needed about 6x
--- Before · before.txt · captured output
+++ After · after.txt · captured output
 ci-verify job summary, shards planned at --shard-jobs 4, seed 400s each, wall 160s / 140s:
+WARNING: 1 shard(s) exceeded 1.5x their predicted duration (shard 1 took 160s vs 100s predicted across 4 parallel jobs). A file in them is slower than its seed entry or unseeded. Fix: run `bun run test:ubicloud --record-durations` and commit scripts/free-test-durations.json; split any file over 60s. See docs/TESTING_INTERNALS.md#free-suite-duration-seed.
-(no warning)
 

--ci-verify's shard-overrun warning now measures a shard's wall time against its seed prediction divided by the shard's parallel job count. shardOverruns and overrunWarning in scripts/lib/free-ci-health.ts use predictedMs / jobs, ciHealthSummary passes the plan shard's jobs through, and the warning says across N parallel jobs when k > 1. With no jobs (k = 1) the behavior and the message are unchanged. docs/TESTING_INTERNALS.md states the rule beside the 1.5x / 30 s thresholds.

Why

Issue #3851 reports that the overrun warning stayed silent on slow shards. free-tests.yml plans every shard at --shard-jobs 4, so the check compared a shard's wall time with its serial seed sum and only fired after about a 6x slowdown. The warning is the signal that the duration seed has gone stale, and it now fires at the 1.5x it promises.

Blast radius

Only the --ci-verify job-summary line changes, and it never fails a run. ciHealthSummary has one caller (scripts/test-free-shards.ts:2032), and the plan's jobs is validated by plannedShardJobsProblem before this code reads it (file read). No network, secrets, permissions, workflows, install scripts or dependencies are touched.

Credit

Rewritten on main from @indraoverflow's #4051 (read as text only, not checked out), credited with a Co-authored-by trailer on 5e2964d.

Tests

Two new cases in test/free-seed-ratchet.test.ts: shardOverruns at jobs = 1 and jobs = 4 (written first; the jobs = 4 case failed on main), and ciHealthSummary carrying a plan's jobs = 4. The full free suite is carried from CI run 42249997890/1 (1613 files). Locally the three focused files were green, bun run typecheck was clean, and bun run typecheck:test showed no new diagnostics against the baseline.

Approvals

No approvals recorded for branch capy/gst-1653-shard-overrun-jobs.

Summary

A split CI shard is now judged against the share of the seed it actually runs, so a stale duration seed shows up in the job summary again. One commit (5e2964d) changes the comparison, its message, two tests and one docs sentence, plus a changelog.d fragment.

Test Coverage

All new code paths have test coverage (deterministic map: the one changed runtime file has a changed test naming it). Two new cases in test/free-seed-ratchet.test.ts: shardOverruns at jobs = 1 and jobs = 4 (the jobs = 4 case failed on main), and ciHealthSummary carrying a plan's jobs = 4.

Tests ran: free 1613 (files, carried from CI run 42249997890/1)

Pre-Landing Review

Pre-Landing Review: 1 issues — 0 auto-fixed, 1 asked (0 fixed, 1 skipped), 0 deferred, 0 noted

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen ledgers_read=2 dispatches=1 est_input_tokens=2735

Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Outside review: completed (openai/gpt-6.1-sol as host subagent): approve with a follow-up, nothing blocking. Native adversarial (claude-opus-5-5): ship as-is.

Review notes

None of these would fail a test, break production or lose data or secrets, so under the crew's blocking floor they ship as notes and were not fixed in this PR.

  • Expected wall time assumes balanced, fully parallel sub-shards (scripts/lib/free-ci-health.ts:36; red-team, adversarial and outside voice agree). assignSubShards packs whole files into k groups and runs SLOW_UNDER_LOAD files in a trailing serial sub-shard, so the true floor is the largest packed group plus the serial tail, not sum/k. Today SLOW_UNDER_LOAD is empty and TREE_MUTATING files sit in the exclusive k = 1 shard; on the real seed at 10 shards x 4 jobs each shard's largest group matches sum/4, so a seed-accurate run raises no false warning. A very imbalanced shard (for example one 60 s file plus three 1 s files) or a future SLOW_UNDER_LOAD entry would warn falsely. Follow-up: carry a per-shard expected wall time in the plan at --ci-plan time from the same packer plus the serial sum.
  • k comes from the plan, not the result (ciHealthSummary). It runs before verifyFreeCiResults rejects a result whose jobs disagrees with the plan, so only the diagnostic of an already-failing run can be misleading. Follow-up: use the result's jobs.
  • Runner contention may make the 4-job threshold noisy (investigate). If four sandboxed children run more than about 50% slower per file than the seed recording, every shard would warn. Unmeasured here; compare one recent free-suite run's shard elapsedMs with sum/4.

Exploratory QA

Functional smoke on shardOverruns/overrunWarning (2 probes, both pass, verdict pass): a 4-job shard at 160 s vs 100 s warns with across 4 parallel jobs while 140 s does not; jobs: 0 and a missing jobs fall back to serial with no divide-by-zero, the 30 s floor still applies, and a 40 s shard split 4 ways that takes 40 s warns. Limits: ciHealthSummary end to end is covered by the committed unit test, not probed; the serial tail was not probed (SLOW_UNDER_LOAD is empty).

Issues

Fixes #3851
Refs #4051

Verification Results

No plan is bound to this branch, so there are no Step 8.1 obligations to verify.

TODOS

No TODO items completed in this PR.

Documentation

Scope: the committed diff against 8d7091a (the free-CI shard-overrun prediction now accounts for split shards). Nothing was staged, unstaged or untracked.

Result: current. docs/TESTING_INTERNALS.md already says that a shard split by --shard-jobs k is predicted as its serial seed sum divided by k, which matches scripts/lib/free-ci-health.ts. No other doc covers this behavior.

Debt: none.

Test plan

  • bun run test (free lane): carried from CI run 42249997890/1 at tree b51619a4dd6f, 1613 files
  • gstack-pregate --allow-repo-commands: pass (secrets, strays, literals, timing, guards typecheck/module-size/conflict-markers, 24 of 24 selected files reused from the CI run)
  • bun test test/free-seed-ratchet.test.ts test/shard-jobs.test.ts test/test-free-shards.test.ts: green before /ship (focused files, all cases); bun run typecheck clean

Open in Capy

…rediction over jobs (GST-1653)

shardOverruns compared a shard's wall-clock elapsedMs with predictedMs, the
shard's serial seed sum. free-tests.yml plans every shard at --shard-jobs 4,
so the 1.5x warning only fired after about a 6x slowdown. The prediction is
now divided by the plan shard's jobs, ciHealthSummary carries jobs through,
and the warning names the parallel job count. k=1 output is unchanged.

Rewritten on main from #4051, which fixes #3851.

Co-authored-by: Indra Prasetya <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@capy-ai
capy-ai Bot merged commit 115e245 into main Nov 6, 2026
43 checks passed
@prascli

prascli commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up with the exact detail, because the trailer is already there but does not resolve to an account.

Commit 115e245 on main carries:

Co-authored-by: Indra Prasetya <[email protected]>

That address has no numeric id prefix, so GitHub never mapped it to an account, and after I renamed the account from indraoverflow to prascli (same account, user id 11029197) it cannot resolve at all. The commits in #4051 have the same problem and now render as unlinked authors.

The line that does resolve is:

Co-authored-by: Indra Prasetya <[email protected]>

If amending 115e245 is not acceptable, a correction line in the release notes for the version that carries it would be enough. No code change requested, only the attribution.

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.

Deferred review finding: scripts/lib/free-ci-health.ts:1 — shardOverruns compares elapsed with the serial predictedMs x1

2 participants