Skip to content

test(config): parallelize the complete state startup corpus - #153532

Merged
steipete merged 5 commits into
mainfrom
ci-burden/perf-startup-corpus
Sep 20, 2026
Merged

steipete merged 5 commits into
mainfrom
ci-burden/perf-startup-corpus

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The prior-release state corpus keeps a CI worker busy for roughly six minutes because all 34 release/config pairs live in one file. Related: #153435.

User Impact

This reduces CI runtime without changing product behavior or removing historical upgrade coverage. The complete two-release × 17-config matrix still executes both Doctor/Gateway startup passes, including real session, credential, cron, preference, model-catalog, schema-version, and SQLite-integrity checks.

Why This Change Was Made

Eight small test files now register disjoint rows from one shared matrix. The executor can schedule them independently. One file inventory also drives build prerequisites and complete-corpus receipts, so partial plans cannot suppress the fallback proof. The fallback uses four workers; frozen revisions predating the split keep their existing execution path.

Each cell still starts with an untouched copy of its released databases. A cell owns one existing SQLite read-only worker scope across its operations: it reuses processes/imports while each inspection reacquires source admission and reads fresh bytes. Static model preparation consumes the metadata already returned by Gateway startup, following the production handoff. No timers, budgets, assertions, migration steps, or fixture rows were removed or relaxed.

Profiling found fixture preparation costs only 1.6 ms. Doctor plus startup admission takes 92.7% of a representative 17.652-second cold case; the first pass performs a real agent database upgrade from schema 19 to 21. Pre-migrating the fixture would weaken that proof. The profile's composite migration spans do not separately identify SQL-write, worker-startup, and plugin-contract costs.

Evidence

Landing validation: Refreshed from main through REST at 2026-09-20 11:08 UTC. Head 9a15bce42bbda51feb2c892fd0e9af7a58f65776 passed CI run 35506996781, including the aggregate gate and security review. The refreshed patch is unchanged. A source audit reconfirmed all 34 distinct cells, 68 startup passes, all 11 original assertion statements, and complete-file coverage guards. Earlier run failures below are historical.

Measured earlier CI run 35498795746 passed all 35 corpus tests on two CPUs / two workers. The complete corpus group fell from 372.92 → 258.79 s, an observed 114.13 s (30.6%) reduction. Its companion tests are identical; the single state file becomes all eight partitions. The largest state file is now 74.489 s, compared with 359.774 s before. The final corpus owner is checks-node-compact-small-1, job 106046812779. Earlier candidate CI measured the group at 291.62 s. Job packing changed, so whole-job durations are not controlled comparisons.

Historical CI failure, cleared by the refreshed run above: four src/agents/harness/selection.test.ts heartbeat/cron/detached/aborted rows fail with Agent worker lease differs from its captured native owner; the aggregate gate reflects that failure. Advancing-main #147463, commit b7d37fd7885, moves heartbeat outcomes into the native agent worker. It is included in CI's base bedaf6c517f010e31b1bbd11b22c04e81c087fbd and absent from this PR head. Those paths are unchanged here, and the failed job does not execute the corpus. The exact lease mismatch remains for that owner to investigate; no out-of-lane repair or unchanged CI retry was requested. All planner/wrapper corrections in this PR passed final CI.

That first CI cycle also caught two integration omissions: missing declarations for the shared JavaScript inventory and its absence from the extracted maintainer-wrapper manifest. The follow-up adds both. The production type graph and both originally failing wrapper-closure tests now pass locally. Corpus code, cells, and assertions are unchanged.

The next CI cycle exposed an older comparison that depended on whole-plan packing: precise plans intentionally preserve their original template, but the test compared against the full plan after runtime relocation. a171c4d88ce derives only the expected template before relocation, restores real timing reads before invoking the actual selector, and retains every assertion. All seven precise-owner/runtime-placement cases pass, along with types, lint, and fresh independent reviews.

The full corpus passed on Blacksmith Testbox (Node 24.19.0, four available CPUs, 15.4 GiB RAM): 35 tests, zero skipped, all 68 startup passes, at both worker counts. Testbox workflow; lease tbx_01m2ypp7tyw3t4nh8bmdxw5a7a was stopped after downloading results.

Metric 2 workers 8 workers on 4 CPUs
Command wall 208.13 s 171.47 s
Vitest wall 205.80 s 169.14 s
First-to-last test interval 194.815 s 154.749 s
CPU user / system 447.16 / 37.63 s 589.95 / 46.90 s
Maximum RSS reported by time 2578.3 MiB 2604.3 MiB

Eight workers reduced command wall by 36.66 s (17.6%) on this four-CPU host while consuming more CPU. This is an oversubscribed-host measurement, not a claim of eight-CPU scaling. RSS is the reported process maximum, not the sum of concurrently live workers.

The original single file cost 293.123 summed test seconds on main run 35468218069 and 359.774 s in the supplied PR run. The following comparison uses that PR's original case times allocated to each new partition; the candidate columns are observed Testbox and native-CI summed case times. Different hosts and cold-case distribution limit direct per-case comparisons.

State corpus file Original PR rows allocated Testbox, 2 workers Testbox, 8 workers Native CI, 2 workers
original / partition 1 63.016 s 50.604 s 152.842 s 64.238 s
part-2 48.992 s 58.028 s 154.731 s 74.489 s
part-3 39.953 s 46.034 s 142.226 s 58.873 s
part-4 41.913 s 41.620 s 136.853 s 50.384 s
part-5 40.955 s 42.567 s 141.734 s 48.856 s
part-6 41.813 s 43.035 s 145.567 s 50.658 s
part-7 42.210 s 43.032 s 144.403 s 53.203 s
part-8 40.922 s 43.648 s 145.754 s 56.792 s

A representative cold cell took 17.652 → 17.469 s. That is effectively flat; baseline phase tracing also adds a comparison caveat, so no isolated per-startup speedup is claimed. Its whole command was 68.23 → 60.43 s and Vitest 32.90 → 28.14 s, partly preparation/transform differences. The reliable improvement is removing file-level serialization while reusing existing lifecycle-owned resources.

Local Mac attempts used the required 240-second cap and import-duration diagnostics. The original full-file baseline exhausted the cap in cold runtime preparation before any case ran. Subsequent profiling attempts were also dominated by compiler/import work. The first post-split attempt exposed the wrapper's rebuild-on-dirty-support-input behavior and was interrupted; its descendants were explicitly stopped. All eight clean committed-revision per-file attempts also reached the 240-second cap after entering startup, without completed partition proof; no incomplete run is counted as a pass or measured speedup.

Validation: 203 focused planner, complete-coverage, runtime-prerequisite, documentation-targeting and workflow cases passed; workflow validation passed. check-changed passed global guards, formatting, all core-test/script/root type graphs, and all three dead-export scans. Its broad core lint was stopped after 650 s; the requested targeted type-aware oxlint substitute passed all changed code and an intentionally failing floating-promise canary proved type-aware diagnostics were active. oxfmt --check and git diff --check passed. Independent pre-commit and committed-branch reviews through P2 are both scoped-clean. The committed revision passed pnpm build qaRuntime. The correction in e7103a8a750 passed scoped check-changed (reusing the unchanged dead-export scan), the production core type graph, and both previously failing wrapper-closure tests. Its fresh local and committed-branch reviews are also scoped-clean through P2. The final test-oracle correction also passed scoped check-changed and fresh local/branch reviews through P2. That earlier CI run passed the corpus and all corrected planner/wrapper checks; the advancing-main heartbeat failure was subsequently cleared by the landing refresh above. No unchanged CI rerun was requested.

Coverage removed: none. No src/cli/** changes, production migration changes, timeout changes, baseline exceptions, new public contracts, or storage-policy changes.

Keep all 34 release/config pairs and both startup passes. Share the matrix and file inventory, retain fresh historical state per cell, and reuse lifecycle-owned SQLite inspection workers and Gateway plugin metadata. Route every partition through CI coverage receipts and runtime prerequisites.
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: L maintainer Maintainer-authored PR labels Sep 20, 2026
@steipete
steipete marked this pull request as ready for review September 20, 2026 06:58
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 7:52 AM ET / 11:52 UTC (Revision 7).

ClawSweeper review

What this changes

Splits historical startup checks across eight test files and updates CI coverage accounting, runtime preparation, fallback execution, and documentation.

Merge readiness

✅ Ready for maintainer review

Keep open as useful, protected maintainer work. Current main still serializes the state corpus in one file; the reviewed patch preserves coverage, and no blocking correctness or security finding remains.

Priority: P3
Reviewed head: 9a15bce42bbda51feb2c892fd0e9af7a58f65776

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-supported CI improvement with preserved coverage and no actionable blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored CI optimization; the supplied runner measurements exercise the changed corpus scheduling, and GitHub confirms successful CI for the reviewed head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored CI optimization; the supplied runner measurements exercise the changed corpus scheduling, and GitHub confirms successful CI for the reviewed head.
Evidence reviewed 7 items Complete historical matrix retained: The shared helper partitions the same release/config Cartesian product by file index, copies historical state separately for every cell, retains both startup passes and all original assertions, and preserves the existing timeout and Windows exclusion.
Coverage receipts reject incomplete execution: The planner requires every inventory file under the runtime-config owner and rejects target-filtered, native-sharded, name-filtered, unknown, and dist-only plans. Tests now remove each individual inventory file to verify rejection.
Fallback and historical targets preserved: The fallback prepares the runtime before launching the complete split corpus with four workers. Frozen targets without the inventory retain the legacy process layout; workflow tests exercise both layouts.
Findings None None.
Security None None.

How this fits together

The startup corpus checks historical configuration and databases through Doctor and Gateway startup. CI schedules these checks and uses complete-coverage receipts to avoid running the same corpus twice.

flowchart TD
  A[Historical state and config fixtures] --> B[Shared case inventory]
  B --> C[Eight state test partitions]
  C --> D[Doctor and Gateway startup]
  D --> E[State preservation assertions]
  F[CI coverage receipt] --> G{All corpus files covered?}
  G -->|Yes| C
  G -->|No| H[Prepared four-worker fallback]
  H --> C
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +81, Docs +6, Config +9, Other -2. Total +94 across 21 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 15 396 315 +81
Docs 2 10 4 +6
Config 1 12 3 +9
Generated 0 0 0 0
Other 3 11 13 -2
Total 21 429 335 +94

Review metrics

Metric Value Why it matters
Historical coverage 34 state cells; 68 startup passes retained Parallel execution preserves the existing two-release by seventeen-config upgrade matrix.
Growth by responsibility Product runtime 0; CI/tooling +7; tests/support +81; docs +6 net lines Growth supports scheduling and coverage accounting without adding product runtime behavior.

Technical review

Best possible solution:

Use one shared corpus inventory to distribute unchanged historical upgrade checks through existing workers while preserving conservative fallback coverage.

Do we have a high-confidence way to reproduce the issue?

Not applicable to a product defect: this is a CI performance improvement, supported by the serial current-main source and reported before/after runner measurements.

Is this the best way to solve the issue?

Yes. File-level partitioning fits the existing executor, preserves historical assertions, and shares the inventory across coverage accounting and runtime preparation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7a1090af25b4.

Labels

Label justifications:

  • P3: This improves internal CI throughput without changing user-facing product behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored CI optimization; the supplied runner measurements exercise the changed corpus scheduling, and GitHub confirms successful CI for the reviewed head.

Evidence

What I checked:

  • Complete historical matrix retained: The shared helper partitions the same release/config Cartesian product by file index, copies historical state separately for every cell, retains both startup passes and all original assertions, and preserves the existing timeout and Windows exclusion. (src/config/state-startup-corpus.test-support.ts:146, 9a15bce42bbd)
  • Coverage receipts reject incomplete execution: The planner requires every inventory file under the runtime-config owner and rejects target-filtered, native-sharded, name-filtered, unknown, and dist-only plans. Tests now remove each individual inventory file to verify rejection. (scripts/lib/ci-node-test-plan.mts:107, 9a15bce42bbd)
  • Fallback and historical targets preserved: The fallback prepares the runtime before launching the complete split corpus with four workers. Frozen targets without the inventory retain the legacy process layout; workflow tests exercise both layouts. (.github/workflows/ci.yml:3318, 9a15bce42bbd)
  • Current main still needs the optimization: Fetched main retains the single-file corpus and environment-based sharding. The related merged work does not implement this file-level scheduling change. (src/config/state-startup-corpus.test.ts:77, 7a1090af25b4)
  • Latest release inventory: The supplied latest-release commit contains the original state corpus file but no shared split-corpus inventory. (src/config/state-startup-corpus.test.ts, ec9c1a13db89)
  • Pinned-head validation and performance evidence: GitHub confirms CI run 35506996781 completed successfully for the reviewed head. The captured PR body reports all 34 state cells and 68 startup passes, plus a corpus-group reduction from 372.92 to 258.79 seconds. Detailed job-log retrieval was blocked by the review environment, so those timing measurements remain contributor-reported; no tests were executed during this read-only review. (9a15bce42bbd)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-20T07:05:59.411Z sha 20b07e5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T07:33:45.160Z sha e7103a8 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T08:16:58.384Z sha a171c4d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T08:46:00.794Z sha a171c4d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T08:55:26.681Z sha 6b79d13 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T11:14:32.519Z sha 9a15bce :: needs maintainer review before merge. :: none

Declare the JavaScript inventory for production type checking and include it in the maintained wrapper closure. The complete matrix and benchmarked runtime remain unchanged.
Precise selection intentionally retains pre-relocation capacity. Build the comparison template without placement observations, restore real timing reads, and retain all routing, preparation, timing, and coverage assertions.
@steipete
steipete merged commit d98c427 into main Sep 20, 2026
192 checks passed
@steipete
steipete deleted the ci-burden/perf-startup-corpus branch September 20, 2026 11:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
…#153532)

* test(config): parallelize the complete state startup corpus

Keep all 34 release/config pairs and both startup passes. Share the matrix and file inventory, retain fresh historical state per cell, and reuse lifecycle-owned SQLite inspection workers and Gateway plugin metadata. Route every partition through CI coverage receipts and runtime prerequisites.

* fix(ci): register startup corpus inventory for extracted tools

Declare the JavaScript inventory for production type checking and include it in the maintained wrapper closure. The complete matrix and benchmarked runtime remain unchanged.

* test(ci): compare precise owners before runtime relocation

Precise selection intentionally retains pre-relocation capacity. Build the comparison template without placement observations, restore real timing reads, and retain all routing, preparation, timing, and coverage assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant