Skip to content

perf(deploy): batch sealing and overlap build finalization - #170363

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

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

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #170283

What Problem This Solves

Release preparation still spends most of its time building and making the candidate durable before it can be activated.

User Impact

Faster preparation keeps the incumbent serving while the next release becomes ready. This does not deploy the controller, restart a Gateway, change a schema, or change runtime behavior.

Why This Change Was Made

Seal the permission-normalized candidate with one GNU sync -f filesystem barrier instead of one fsync per file and directory. Failed synchronization still fails closed, and publication still fsyncs its parent directory. Reusing an already validated sealed release no longer reseals it.

Build the staged Control UI concurrently with independent runtime finalization after the last compiler pass. Join both writers, including failures, before writing final metadata. Keep every build check and the single build owner; no new cache, configuration, or CI-provenance bypass.

The existing integrity contract is documented explicitly: exact source/build/schema/UI-entrypoint identity, complete ownership/mode/symlink validation, and durable publication. It is not a whole-tree cryptographic manifest or protection against root modifying a published tree. Filesystem sync also flushes unrelated dirty writes on that filesystem; it does not evict page-cache contents.

Evidence

Synthetic measurements on the shared Linux benchmark host, constrained to 64 CPUs / 64 GiB, Node 26.8.2 and pnpm 12.9.0, source baseline 395ea60dea89. No production state or services were used.

Phase Before After
Matched fresh-output build (warm filesystem, build caches disabled) 72.73 s 63.86 s
Durable seal 82.025 s 2.127 s
All measured post-build preparation 92.160 s 12.126 s

The seal made 204,345 file/directory fsync calls, consuming 80.525 s. The replacement filesystem barrier took 1.250 s. Copying remained 3.50 / 3.61 s and ownership 0.50 / 0.50 s; manifest validation hashes only the UI entrypoint, not every file. Post-build totals include source/candidate/published validation, capacity inventory, copy, ownership, manifest, sealing, durable rename, and compile-cache prewarm.

The matched build pair keeps compiler/plugin bundlers serial and reduces the post-builder window from 29.86 to 16.19 s. Peak cgroup memory was 6.31 / 6.00 GiB. All 20,435 regular payload files are byte-identical, including UI and compressed assets; only the two build-stamp records differ. This is not a symlink-topology comparison.

Source fetch + checkout took 10.52 s and cold-store install 19.63 s. Adding those common setup components to each matched build/preparation gives a component-summed fetch-to-activate-ready estimate of 195.0 → 106.1 s. This is not a timed live controller transaction: lock/ancestry checks and work-tree cleanup are excluded. The first cold serial build took 93.54 s; no equivalent cold candidate build was measured. The under-two-minute target is met by the matched warm-filesystem estimate, not claimed for every cold or contended deployment.

  • Local focused controller test: 11 passed, 0 skipped, 9.39 s wall. The new failed-barrier regression fails on the original implementation.
  • pnpm test test/scripts/build-all.test.ts --maxWorkers=1: 61 passed, 9.793 s test time / 117.06 s wrapper wall time including 69.929 s initial worker preparation on the saturated Mac.
  • Changed-file format check passed. Build files pass focused repository lint. The imported controller closure retains baseline lint debt: 646 diagnostics before, 644 after, no additions.
  • Independent Codex review through P2: scoped-clean.
  • No Testbox/Crabbox allocated. Full typecheck, suites, and build gates are delegated to PR CI; the controller's opt-in Node suite was run directly because it is outside Vitest routing.

Production code grows by 50 lines: concurrent writer joining, failure propagation, and wall-clock timing preserve the existing build lifecycle contract. The per-file durability loop and redundant resealing are removed rather than retained as alternate paths.

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.
@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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR batches release durability synchronization and overlaps the staged Control UI build with independent runtime finalization.

Example: The reported matched Linux benchmark prepares a freshly built release.

  • Before: Durable sealing takes 82.025 seconds using individual file and directory synchronization.
  • After: Durable sealing takes 2.127 seconds using one filesystem barrier after permission normalization.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused performance change with preserved lifecycle contracts and no actionable finding; benchmark results are reported evidence rather than a reviewer-executed deployment.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is outside the ordinary contributor-proof gate; its body reports matched Linux build and sealing measurements, supported by focused writer-settlement and failed-barrier tests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Operators wait for avoidable serial build finalization and repeated durability operations before a candidate release becomes ready.
Reason: The maintainer-authored direction has measured value and stays within the existing build and deployment owners without adding configuration or changing activation policy.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored optimization addresses measured release-preparation costs, and review found no actionable correctness or security defect.

Priority: P2
Reviewed head: 50c27c9499efac88942a023902b04cde5ea6637e

Before merge

None.

Findings

None.

Provenance

  • Phase timing totals: original intent not found (unknown: Path history identifies earlier timing instrumentation and the TypeScript move, but git log -S across scripts/build-all.mjs and scripts/build-all.mts failed on unavailable old blobs, leaving exact introduction unverified.)
Agent review details

How this fits together

The build orchestrator turns frozen source into runtime and UI artifacts; the deployment controller copies, validates, seals, and publishes those artifacts before the separate activation flow.

flowchart TD
Source[Frozen source] --> Compiler[Serial compiler and plugin builds]
Compiler --> Runtime[Runtime finalization]
Compiler --> UI[Staged UI build]
Runtime --> Join[Join writers and finalize metadata]
UI --> Join
Join --> Seal[Validate and seal candidate]
Seal --> Publish[Durable release publication]
Loading

Technical review

Best possible solution:

Land the focused optimization through the existing gates, leaving installed-controller adoption with its documented deployment owner.

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

This is a performance improvement rather than a current-main bug report; source inspection confirms the serial finalization and individual synchronization costs described by the supplied measurements.

Is this the best way to solve the issue?

The approach removes redundant work within the existing owners while preserving compiler serialization, failure settlement, permission normalization, and durable publication.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 81ad3bf71935.

Provenance checked

  • Release sealing and published-release reuse changes intended behavior with a stated reason (072215c: The controller import preserves the managed-release owner, validated immutable candidates, and durable publication; its body does not separately explain redundant resealing.)
  • Serial build orchestration and memory admission keeps the original intent (0e8faac: Canonical builds serialize compiler work under an admitted cgroup-aware memory budget; later native-allocation measurements reinforce serial compiler admission.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced changes and current main: The pinned introduction diff contains the optimization. Current main still runs finalization serially and synchronizes individual release entries; the verified test merge changes only the six introduced paths. (scripts/build-all.mts:651, 50c27c9499ef)
  • Writer settlement: Compiler and declaration work finishes before concurrency begins. Promise.allSettled joins both finalization branches, propagates failures, and admits the final metadata steps only after both succeed. The UI owner builds and validates a separate staging subtree. (scripts/build-all.mts:656, 50c27c9499ef)
  • Durability and publication: The permission walk preserves executable files and skips symlinks; a nonzero GNU sync result throws before publication. The publisher retains sealed validation, same-device admission, rename, and parent-directory fsync. (.agents/skills/update-team-server/controller/release-lib.mjs:581, 50c27c9499ef)
  • Original memory policy preserved: The merged memory repair explains why compiler bundles must remain serial to constrain native allocations. This PR retains that boundary and starts the UI only after the last compiler or declaration writer. (scripts/build-all.mts:106, 8e6f08486b51)
  • Measured value and accepted tradeoff: The complete PR body reports matched real Linux builds, equivalent regular payload bytes, lower measured preparation costs, and the explicit tradeoff that syncfs also flushes unrelated dirty writes. It distinguishes component estimates from a timed live deployment. (50c27c9499ef)
  • Related work has a distinct scope: perf(deploy): reuse the package store and fetch only frozen source #170283 merged package-store reuse and shallow frozen-source preparation; its measurements identify building and sealing as remaining costs addressed here. (232083d2c835)

Likely related people:

  • Peter Steinberger: Raw commit 072215c adds .agents/skills/update-team-server/controller/release-lib.mjs:563 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 072215c388c0; files: .agents/skills/update-team-server/controller/release-lib.mjs)

PR surface

Tests +138, Docs +23, Other +50. Total +211 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 139 1 +138
Docs 1 24 1 +23
Config 0 0 0 0
Generated 0 0 0 0
Other 3 112 62 +50
Total 6 275 64 +211

Review metrics

Metric Value Why it matters
Production versus test growth Production +50 net lines; tests +138 net lines Production growth implements branch joining, failure propagation, and elapsed-time accounting while removing individual synchronization and redundant resealing; tests cover settlement, serialization, and failed durability barriers.

Labels

Label changes:

  • add P2: A measured build and deployment-preparation improvement with no established urgent user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A measured build and deployment-preparation improvement with no established urgent user-facing regression.
  • 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.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 12, 2026, 6:59 PM ET / 22:59 UTC.

@steipete
steipete merged commit 7446a6a into main Oct 12, 2026
108 of 109 checks passed
@steipete
steipete deleted the steipete/perf-micro-deploy-seal-and-build-20260919 branch October 12, 2026 23:06
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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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