Repository navigation
ci: replace hand-fitted shard timings with committed measurements - #131379
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 12:29 AM ET / 04:29 UTC. ClawSweeper reviewWhat this changesThe PR replaces hand-maintained CI shard-duration hints with committed measurements, a refit command, and a scheduled pull-request workflow. Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain Keep this maintainer-owned PR open: it replaces a distinct current-main CI timing path, but its new refit logic lets one workflow run supply enough UI-overhead samples to update the committed weight. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherOpenClaw CI uses a Node test planner and a Control UI E2E sequencer to partition test work across runners. This PR feeds both from a committed measurement file regenerated from successful main-branch CI runs. flowchart LR
A[Successful main CI runs] --> B[Timing refit command]
B --> C[Committed timing weights]
C --> D{Timing file valid?}
D -->|Yes| E[Node planner and UI shard sequencer]
D -->|No| F[Cold-start timing hints]
F --> E
E --> G[CI test jobs]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +11, Tests +784, Docs +66, Config +108, Other +971. Total +1940 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Reduce UI overhead to at most one representative value per workflow run and retain the previous value until measurements from at least two distinct runs are available. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: give one run two or more parseable UI E2E logs and the global array reaches the threshold, updating overhead despite there being only one distinct run. Is this the best way to solve the issue? No. Per-run normalization is needed so the overhead weight follows the same independent-run sampling invariant as every other committed measurement. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 629a47e3cc20. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
d2b1466 to
cbc4026
Compare
Regenerate UI file and runner-specific compact weights from successful CI log medians, with outlier filtering and a 15% write threshold. Keep existing hints as cold-start fallbacks and account for per-file UI overhead without deriving membership from timing keys. Add a daily standing-PR refit workflow, strict cached loading, fixture coverage, and operator docs. Verify all 302 UI files form identical complete partitions across 22 fresh processes.
Remove unobserved timing keys only after three sampled runs and report removals in the refit table. Bucket compact measurements using jobs API labels and include all main run attempts without counting retries as independent samples. Document contended compact walls and the hosted cold-start fallback. Preserve committed timing data and existing sharding behavior; verify 70 focused tests, all 11 UI shards, five corruption fallbacks, live refit, changed checks, workflow checks, and Codex autoreview.
Pruning used one global run count, so a profile with no observations in the sampled window had its whole committed map deleted. Hosted weights could never accumulate, and a partial log-fetch failure could drop every UI E2E entry in a single refit.
PR preflight builds its manifest with bare Node before dependency installation. Replace the timing schema dependency with strict all-or-nothing validation and preserve the CiTestTimings type. Walk workflow-derived planner imports in a bounded, cycle-safe regression guard. Keep the refit CLI outside that dependency-free boundary, and document the coercion-helper exception for preflight.
20f0476 to
d11cd52
Compare
|
Merged via squash.
|
…enclaw#131379) * ci: use committed measurements for test sharding Regenerate UI file and runner-specific compact weights from successful CI log medians, with outlier filtering and a 15% write threshold. Keep existing hints as cold-start fallbacks and account for per-file UI overhead without deriving membership from timing keys. Add a daily standing-PR refit workflow, strict cached loading, fixture coverage, and operator docs. Verify all 302 UI files form identical complete partitions across 22 fresh processes. * fix(ci): prune stale test timings and trust runner labels Remove unobserved timing keys only after three sampled runs and report removals in the refit table. Bucket compact measurements using jobs API labels and include all main run attempts without counting retries as independent samples. Document contended compact walls and the hosted cold-start fallback. Preserve committed timing data and existing sharding behavior; verify 70 focused tests, all 11 UI shards, five corruption fallbacks, live refit, changed checks, workflow checks, and Codex autoreview. * fix(ci): prune timings per profile with observed evidence Pruning used one global run count, so a profile with no observations in the sampled window had its whole committed map deleted. Hosted weights could never accumulate, and a partial log-fetch failure could drop every UI E2E entry in a single refit. * fix(ci): keep preflight timing validation dependency-free PR preflight builds its manifest with bare Node before dependency installation. Replace the timing schema dependency with strict all-or-nothing validation and preserve the CiTestTimings type. Walk workflow-derived planner imports in a bounded, cycle-safe regression guard. Keep the refit CLI outside that dependency-free boundary, and document the coercion-helper exception for preflight. * test(ui): settle typography picker popup animations * fix(ci): guard timing refit sampling and publication
What Problem This Solves
CI shard packing was driven by ~380 hand-fitted duration literals across five tables —
UI_E2E_FILE_SECONDS_HINTSin the Control UI E2E sequencer, and the fourCOMPACT_*_SECONDS_HINTSmaps in the compact Node planner. They rot within days, and re-fitting them by hand is recurring 30-minute toil.The rot is measurable. The UI E2E table was fitted on 2026-08-23 at 247 files; four days later the suite is 304 and every surviving hint read 1.5–1.9x low. On the compact side, comparing the 109 groups that have both a hint and a fresh measurement: median ratio 1.22, p90 2.33, 14 groups over 2x (
agentic-agents-core-models41s→121s,agentic-commands-doctor-config-state67s→196s), and 10 groups over-hinted. In total 3,504 hinted seconds against 4,456 measured.Stale-low hints are worse than no hints: the packer treats those items as cheap and stacks them onto already-tall bins.
Why This Change Was Made
Durations are now a recorded fact from measured CI runs instead of a hand-fitted literal.
config/ci-test-timings.jsonis committed, deterministically ordered, and regenerated bypnpm ci:timings:refitfrom the last five successfulmainCI runs. Both packers consult it as a layer above the existing tables:Three design points drove the shape:
A committed file is the only safe source. The compact plan is computed once in
preflight, so any source would work there. But the UI E2E sequencer runs in 13 independent shard jobs that must derive an identical partition or files get dropped or double-run — andrestore-test-cacheson that lane is enabled only for the github/hybrid profiles, so a restored cache is not uniformly present. A file in the checkout is the only thing guaranteed byte-identical across every shard on every profile, with no added network failure surface.Timings supply weights, never membership. Vitest discovery alone determines the inventory. A corrupt or stale file can produce a badly balanced partition, never an incomplete one.
A per-file overhead term was missing. The reporter's per-file ms is test body time; with
fileParallelism: false, isolate: trueeach file also pays fork + import + setup. Measured at 0.7s/file. Without a constant term, shards holding many small files were systematically under-predicted..artifacts/vitest-shard-timings.jsonis deliberately not reused: it keys on whole config, stores a machine-local EWMA, and lives under gitignored.artifacts/. Wrong grain, wrong storage. It is untouched.User Impact
No behavior change for anyone running tests locally. CI shard balance improves; the number and composition of compact jobs can shift with measurements without any runner-policy change.
Failure is fully degraded-safe: a missing, unreadable, invalid, or version-mismatched file — or
OPENCLAW_CI_TEST_TIMINGS=0— falls back to exactly today's estimates.compactGroupSeconds.githubships empty by design:maincompact jobs run on Blacksmith, so the hosted profile keeps its in-source fallback until hosted runs are observed. Documented indocs/ci.md.The daily
CI Test Timings Refitworkflow opens or updates one standing PR; it never pushes tomain. A human merges. That gate is deliberate — a sick Blacksmith VM reads as a 3x slowdown, and an unattended writer would degrade every PR until someone noticed.Evidence
Independently verified (not just the implementing agent's report):
node scripts/check-changed.mjs— green.node scripts/run-vitest.mjs test/vitest-ui-e2e-config.test.ts test/scripts/ci-test-timings.test.ts test/scripts/ci-node-test-plan.test.ts— 73 passed.Two bugs were found and fixed during review rather than shipped:
Also corrected: runner-profile bucketing now uses the authoritative jobs-API
labels(blacksmith-*vsubuntu-24.04) instead of sniffing log text forBLACKSMITH_env lines, which could silently misfile Blacksmith timings into the hosted bucket.One semantic worth recording: compact
[shard:x] begin→endwalls include contention from the co-running group underPLAN_CONCURRENCY = 2. That is the correct quantity — the packer predicts the same two-up jobs and the admission caps were fitted against it — sodocs/ci.mdsays so explicitly to stop a future reader "fixing" it into isolated timings.Production LOC
Roughly +560 production/tooling for a new capability (loader, schema, aggregation, refit CLI, workflow), +441 measurement data, and a net −2 inside the two packers themselves. The in-source tables are retained deliberately as the cold-start fallback; a follow-up can shrink them once the committed file has a few refit cycles of history.
Added after the PR opened
Preflight must be dependency-free. The first CI run failed with
Cannot find package 'zod'..github/workflows/ci.ymlgates itsInstall manifest dependenciesstep onworkflow_dispatch, so on apull_requesttheBuild CI manifeststep runs the planner with bare Node and nonode_modules. Validation is now hand-rolled with Node builtins, with a reasoned carve-out in the coercion-helper guard. A new guard intest/scripts/ci-workflow-guards.test.tsstatically walks the planner's import graph and fails if any specifier is not anode:builtin or a repo-relative path — verified to fire on a reintroducedzodimport, and verified by running the planner in a tree with nonode_modulesanywhere up the parent chain.Fixed a test that was already broken on
main.theme-typography.e2e.test.tsfails onmain(commits9cb1d2db,86df00d8) and failed here on both Blacksmith and hosted runners. It arrived with #131275 and had no fix in flight, so per the repo's standing CI rule it is fixed in this PR. The picker helpers treated Web Awesome'swa-after-show/wa-after-hideas proof the popup was stable, but the CSS transition can outlive those events and stalls under headless Chromium — so closing the picker and immediately reopening it clicked into a settling popup whose option oscillated between visible and not-visible until Playwright's stability check timed out. Fixed by finishing finite animations on the popup inside its nested shadow root, extracted toui/src/test-helpers/animations.tsand shared with the lightbox suite. The regression is embedded permanently: the test now injects a 60-second stalled transition, which reproduces the exact CI symptom (element is not stable) when the settle is removed.No timeout increase, sleep, retry, weakened assertion, or forced click was used.
ClawSweeper findings addressed. Both P2 items were valid:
branch=mainbut notevent=push, and CI'sworkflow_dispatchaccepts atarget_refit checks out ahead ofgithub.sha— so a manual dispatch frommaincould have written measurements from another revision while documenting them as main-only. The query now requestsevent=pushand the returned run metadata is validated (event, branch, head SHA) rather than trusting the query parameter. Retry attempts of a genuine main push remain eligible.create-generated-pr-tokensandpublish-generated-practions, matchingcontrol-ui-locale-refresh.yml, which brings stale-input rejection and owned-path overlap checks and drops the job tocontents: read. The App-token path also removes the manual workflow-approval limitation the docs previously described, anddocs/ci.mdis updated accordingly.The real-gateway lane failed once on
control-ui-auth-transports.e2e.test.ts(aRawbutton that never appeared) and passed on rerun. That lane runs without--shard, so the sequencer never executes there; it is unrelated to this change.