Skip to content

perf(deploy): reuse the package store and fetch only frozen source - #170283

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-deploy-build-time-20260919
Oct 12, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-deploy-build-time-20260919

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Every controller deployment cloned and indexed the complete Git history, then discarded its freshly populated package store. This added minutes of repeat preparation work.

User Impact

Measured full preparation fell from 356.0s to 229.6s with a cold store, and 217.1s with the retained store (1.64× faster, 39% less wall time). This improves off-path preparation; it does not deploy this controller, restart a Gateway, or change cutover/recovery behavior.

Why This Change Was Made

Fetch only the frozen commit from the already verified official mirror. Full-history ancestry admission stays in the mirror; each sealed release retains a standalone shallow Git database with no alternates. Keep pnpm's content-addressed store, explicitly require clone-or-copy imports and integrity verification, and remove the per-candidate cache lifecycle. Staging requests reflinks where supported. Build and validation steps, sealing, and manifest provenance stay intact; no built artifacts or check results are reused across commits.

Production code is 8 lines smaller. pnpm owns store integrity, format, and pruning; the controller README documents that lifecycle and idle-owner pruning.

Measurements

The actual publisher functions from the parent and this PR built identical source 46f4d308d2a1f292542a13980e6a344823a3877e, using real Git, pnpm, build, manifest validation, sealing, and publication. The three runs used synthetic paths, an unprivileged build account, separate release roots, and one retained package store for the two after runs. No production state, Gateway, or cutover was used. The timing includes upstream fetch through sealed publication, cleanup, and compile-cache prewarm. Initial mirror provisioning is excluded, as the controller already maintains its mirror.

The builds used Node 26.8.2 and the pinned pnpm 12.9.0. All commands ran inside the authorized Linux sandbox under systemd-run --scope --quiet -p AllowedCPUs=64-127 -p MemoryMax=64G nice -n 10 ionice -c3. All three publishers exited 0; the sandbox was removed after collecting the measurements.

Phase Before After, cold store After, retained store
Upstream fetch 1.1s 1.9s 1.0s
Candidate Git transfer/index 141.3s 10.2s 12.0s
Checkout 3.2s 2.5s 2.9s
Dependency installation 19.2s 19.6s 3.0s
Runtime and Control UI build 88.7s 89.0s 97.2s
Staging copy, ownership, manifest 6.8s 7.0s 7.1s
Durable sealing 86.2s 89.3s 85.4s
Other validation, capacity, cleanup, prewarm 9.5s 10.0s 8.5s
Total preparation 356.0s 229.6s 217.1s

The retained-store install reused all 1,606 packages and downloaded none. Release .git size fell from 8,053,123,329 to 186,151,492 bytes. The baseline build itself spent 39.2s in tsdown, 15.2s in UI build, 9.47s in the CLI bootstrap check, and 5.90s in external plugin builds.

The two-minute target was missed. In the retained-store run, fresh builds and durable sealing alone took 182.5s. Their behavior is preserved; copy/seal time did not materially improve. These are single before/cold/warm measurements under the same resource limits, not latency percentiles or a live activation measurement.

Evidence

  • The real publisher regression uses real Git, pnpm, and release manifest/sealing/validation with a synthetic single-package project. It publishes two revisions, checks independent Git objects and package inodes, then verifies that deleting the original repository and modifying the package store cannot change either release.
  • pnpm exec node --test .agents/skills/update-team-server/controller/prepare-release.test.mjs .agents/skills/update-team-server/controller/mirror-budget.test.mjs: 12 passed, 0 skipped, 9.43s total; the publisher case took 8.75s. These controller tests use the repository's standalone Node test runner and are intentionally outside default Vitest projects.
  • The same regression fails against the original controller because the release retains unrelated historical Git blobs.
  • Focused test-file lint, formatting, shell syntax, and whitespace checks passed. Direct lint of the existing release library exposes inherited lint debt; its only change is a comment.
  • Independent review: no actionable P0–P2 findings. Exact-head PR CI run 38313781874 passed. No Testbox/Crabbox leases or local builds, typecheck lanes, or broad suites were used.

@clawsweeper

clawsweeper Bot commented Oct 12, 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.

@steipete
steipete marked this pull request as ready for review October 12, 2026 21:56
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Oct 12, 2026
@steipete
steipete merged commit 232083d into main Oct 12, 2026
143 of 144 checks passed
@steipete
steipete deleted the steipete/perf-micro-deploy-build-time-20260919 branch October 12, 2026 22:21
steipete added a commit that referenced this pull request Oct 12, 2026
Keep compiler and plugin bundlers serial, join independent UI and runtime finalization, and preserve every build check. Replace per-file fsync with a failed-closed filesystem barrier before durable publication, and avoid resealing validated releases. Related: #170283.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…170363)

Keep compiler and plugin bundlers serial, join independent UI and runtime finalization, and preserve every build check. Replace per-file fsync with a failed-closed filesystem barrier before durable publication, and avoid resealing validated releases. Related: openclaw#170283.
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 size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant