Repository navigation
perf(build): add identical runtime-only server builds - #169039
Conversation
Use one final runtime pass for all JavaScript so declaration helpers cannot change package chunk topology. Expose build:runtime and select it in the Team deploy controller while retaining full declaration gates.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR adds a runtime-only build command and makes full and runtime-only builds share their final JavaScript compilation pass. Example: Build a Linux server checkout with Node 24.21.0.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open. It provides useful build savings beyond current main, and both previous findings are fixed. No actionable introduced defect remains; required CI has not cleared. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe build orchestrator turns source, plugin assets, and build identity into package JavaScript, Gateway artifacts, Control UI assets, metadata, and optional declarations; deployment preparation consumes those outputs. flowchart TD
A[Source and plugin assets] --> B[Build profile selection]
B --> C[Optional declaration compilation]
B --> D[Shared runtime compiler]
C --> D
D --> E[Plugin assets and runtime postbuild]
E --> F[Control UI and metadata]
F --> G[Server deployment artifacts]
Technical reviewBest possible solution: Land the shared runtime pass and compatible historical build selector after required CI clears or inherited failures receive supported attribution. Do we have a high-confidence way to reproduce the issue? Source confirms that normal builds compile declarations and current main lacks the new profile; the PR supplies isolated build measurements, while this review executed no target code. Is this the best way to solve the issue? The change fits the existing build owner, preserves declaration validation and memory limits, and fixes runtime-output differences at the compiler boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d1618ccd0b27. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +45, Docs +5, Config +1, Other -15. Total +36 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 11, 2026, 7:40 AM ET / 11:40 UTC (Revision 2). |
Select runtime-only output through the existing environment contract when the controller builds historical source. Exercise the replacement runtime compiler in the unified declaration fixture and cover historical package-script dispatch.
|
Addressed the two source findings in 4fee817:
The package-declaration retention concern is not a defect: I also qualified the first head’s unrelated CI failures against unchanged main
The worker-wire cases were rechecked under a trusted |
|
Final-head CI The newly observed memory fallback assertion and both Telegram failures reproduce on the exact CI main parent All five failing source/test paths are unchanged by this PR. The native inherited-CI verifier passed for exact head |
* perf(build): add identical runtime-only server builds Use one final runtime pass for all JavaScript so declaration helpers cannot change package chunk topology. Expose build:runtime and select it in the Team deploy controller while retaining full declaration gates. * fix(build): preserve historical deploy targets and declaration fixtures Select runtime-only output through the existing environment contract when the controller builds historical source. Exercise the replacement runtime compiler in the unified declaration fixture and cover historical package-script dispatch.
First-parent upstream 5ed6a30..cb1b6cd (21 commits, including openclaw#168999 state query reduction and worker moves, openclaw#169075, af03aa0 ACP owner settlement, openclaw#168837 plugin metadata/reload ownership, openclaw#168776, openclaw#168951, openclaw#169039 runtime-only server builds, openclaw#169092 test batch d050, openclaw#168860 memory index publication writes into workers, openclaw#168991 session read lifetimes and reconciliation scheduling, openclaw#169091 tool/replay prompt prefixes, openclaw#168762 Solid chat leaf elements, openclaw#168941). Conflicts: - test/vitest/vitest.unit-fast-paths.mjs: upstream stopped forcing the two ACP translator files into the fast lane; kept that and our reply-turn-admission module-identity entry. - worker-access inventory: regenerated (634 files, 2429 calls). openclaw-state-worker-contract.ts auto-merged: upstream's GitHub publication-source operations next to our continuation custody operations. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Server deployments compile TypeScript declarations that the Gateway never consumes. On the isolated comparison host, the normal build took 338.74 seconds, including 147.1 seconds in the unified declaration writer.
User Impact
pnpm build:runtimebuilds the runtime JavaScript, plugins, Control UI, and metadata without declarations. The Team deployment controller selects the same mode withOPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 pnpm build, preserving migration/preparation of historical checkouts that predate the new package script. The measured build falls to 110.07 seconds: 3.08× faster, saving 228.67 seconds (67.5%).Development/package builds retain declarations and their validation. CI still owns typechecking. Source updates already select the runtime-only graph through their existing update marker; their lifecycle, explicit declaration override, and rollback behavior are unchanged. No production server was contacted or changed.
Why This Change Was Made
Both build modes now finish with the same runtime-only compiler pass. Full builds first produce/cache declarations, then that final pass replaces package JavaScript while retaining declarations. This matters because combining declarations with runtime modules causes the bundler to share helper chunks differently: merely skipping declarations changed AI and gateway-protocol JavaScript. One final runtime pass removes that discrepancy and replaces the separate unified-only step, preserving its concurrency limit.
The runtime profile reuses the existing complete runtime graph. Production/tooling LOC is −14 overall; no dependency or configuration option is added.
Evidence
Measured on the pre-rebase candidate at base
390f0f0acb98; the final branch retains main’s later behavior-preserving build-plan refactor. Same Hetzner Crabbox lease,cbx_c3b0345b93ee(ccx33, Linux, Node 24.21.0), pinned source and build identity, clean output roots,OPENCLAW_BUILD_CACHE=0:pnpm buildpnpm build:runtimeAll 19,019 JavaScript files are byte-identical. All 22,091 runtime artifacts are byte-identical after excluding declaration files and the two input-tracking stamps. Full compilation and the SDK declaration gate passed.
Unknown build profile: runtime) and passes with the change.pnpm test test/scripts/build-all.test.ts --maxWorkers=1: 55 passed, 29.93 s wall time. No meaningful new per-test cost; the added cases exercise profile selection and the final compiler boundary.build:runtimedispatch and accepts the existingbuildscript plus declaration-skip selector.--no-clean, and the full build retained all 577 declaration files. The rebase preserves main’s declaration-step helper. The follow-up also migrates the unified declaration fixture to the shared runtime step while keeping its runtime-artifact assertions./readyzand/healthzon loopback; it was stopped after the probe.node scripts/check-changed.mjs -- <the five changed paths>passed its format, boundary, declaration, dead-export, script-typecheck, and test-root-typecheck checks. Its single lint finding was a shadowed callback parameter; the parameter was renamed andnode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.scripts.json scriptspassed with zero warnings/errors in runrun_2e0a4ad2a2454e30647927826408403d.Selected remote proof runs (all task-owned and isolated):
run_32f966179d85a7ce365dc5ba1380c52ccbx_c3b0345b93eerun_bf821f97a65e6b1d1a53b45f7731989ccbx_c3b0345b93eerun_2e0a4ad2a2454e30647927826408403dcbx_c3b0345b93eeCI on the first PR head passed the build, lint, types, and build/declaration checks. Seven unrelated shards failed. The same eight affected files failed on unchanged main
ac8a432aafa73674f8e41ab2132860d8901c6dcb, using the CI runner on AWS leasecbx_bacd0cee6a65(run_13aa434700a9a8996eb29f88fd6fb141). The worker-wire cases were rechecked with a trusted temporary directory inrun_2d20f0a09dd1fac50e3a2f682f049cf6, reproducing their CI failures; that run also reproduced the unrelated unused exports reported by the local changed-file scan. The failing files are unchanged between the CI baseline and the qualified main snapshot.The controller and fixture follow-up passed its focused tests, formatting, boundaries, and typecheck in
run_29d7981f28c587dba1f8aec27f59adf3; only the independently reproduced unused-export scan remained red. No CI reruns or update-branch requests were used to chase green.Final head
4fee81740d78fb8639e2a4b27db7d49cf42fe9f7passed the CI build, lint, types, and affected build/declaration tests. Its five red test shards are independently baseline-qualified. The remaining memory-fallback and both Telegram cases reproduce on the exact CI main parent68ee251419d706a1950b2ef7077d69b68daa12f5in Hetzner runrun_14b7970a2f3276174bc09a8ae396995b(leasecbx_6bba415b0e10). The other failures reproduce in the earlier unchanged-main qualification above. No failing source/test path is modified by this PR. Landing uses the explicitly authorized inherited-CI exception.Merged as
3a0db8a3a05283c21600bc39e2772bf1432f7d0eunder the authorized inherited-CI exception. Native verification accepted the exact final head, tested merge, five independently qualified failing jobs, security review, and writer authority before the pinned squash merge. All task-owned compute leases are stopped.