Skip to content

improve(build): reduce runtime source retained by module loaders - #196386

Merged
RomneyDa merged 1 commit into
mainfrom
perf/runtime-source-minification-192552
Nov 10, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
perf/runtime-source-minification-192552

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Node runtime bundles retain unnecessarily verbose source in memory. This extracts the independent build optimization from #192552, related to #192547.

User Impact

Smaller emitted runtime source, with function/class names and lazy loading preserved. This does not claim that constrained ARM64 memory acceptance has passed and does not close #192547.

Why This Change Was Made

Shorten local bindings in shared Node bundles while retaining top-level bindings and module ownership labels used by update compatibility. Apply name-preserving full minification to standalone runtime processes, which retain their compiler-owned source-module metadata. Declaration-only output remains unchanged.

Extracted without production changes from Vincent Koc’s #192552; original authorship is retained. Three files, +98/-0, including exactly 90 regression-test lines and their separate allocation; no shared baseline increase. The regression protects relocated runtime execution, names, module origins, lazy imports, and emitted size.

Evidence

  • Baseline at d7aaafe92edfe272b7d17f9793a6feb70248956d: new emitted-source regression fails as expected, 751 bytes against <600 (51.09s including native-worker preparation).
  • Extracted change: seven selected build/runtime tests pass (23.83s command, 6.082s tests), covering emitted size, relocated runtime, three plugin inventory/SDK boundaries, standalone/worker service relays, and declaration separation. Other cases were not selected.
  • Tooling test typecheck, targeted lint/format, and diff checks pass.
  • Test-line ratchet passes: 6,612,717 / 6,612,749; 32 lines slack.
  • Fresh independent source review found no actionable findings. Local ClawSweeper completed the full committed range d7aaafe92edfe272b7d17f9793a6feb70248956d..4eb00d913540d5c7d04d9b21077ebcb4645eb03f with no actionable correctness/security findings (medium confidence; read-only source review, not runtime proof). pnpm build:ci-artifacts passes (4m 34.9s), including runtime/package artifacts, SDK declarations/export checks, runtime postbuild and Control UI build. Full release declaration emission is not claimed.
  • Hosted artifact build and all other completed CI checks passed except the inherited import-graph failure below. Constrained ARM64 real-provider/soak qualification remains unverified.

Inherited CI failure

CI run 42741657632, attempt 1, fails only checks-node-compact-small-3 and its aggregate: runtime-process-build-graph.test.ts → keeps config/sessions/session-transcript.worker out of the Gateway server graph sees 615 forbidden source inputs. The other 32 cases pass. This direct-esbuild case does not consume the changed tsdown configuration.

The actual tested merge cd20b24b55c3acea888fc8f286c0c79ba699477d differs from its main baseline af7fd744c051987b0199dc7427b80c39b877d8bd only in this PR’s three files. Complete source, package, plugin, script, dependency, TypeScript-config and test-harness inputs to the failing case are object-identical to baseline. A local reproduction also fails (1 failed, 32 filtered). CI’s informational “new” classification compares a passing same-name scheduled-main job but explicitly does not compare selected scope; that main-job log does not run this test. This is an independently attributed inherited defect, not passing CI. Security and the hosted artifact build pass. Landing uses the native inherited-failure policy if its protected writer admits the evidence.

Extract the independent minification change from #192552. Preserve shared-runtime ownership markers and top-level bindings, retain function and class names, and verify relocated execution and lazy loading.
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
RomneyDa added a commit that referenced this pull request Nov 10, 2026
Move runtime-source minification and disabled-cron scheduler lease work to independent PRs #196386 and #196387. Keep the original catalog, tool, and database cold-import cutover together and preserve all contributor ancestry.

Transfer exactly 90 and 153 regression-test lines to their owning changes; reduce this change allocation from 1092 to 849 without changing the shared baseline.
@RomneyDa
RomneyDa merged commit eaa8aeb into main Nov 10, 2026
95 of 98 checks passed
@RomneyDa
RomneyDa deleted the perf/runtime-source-minification-192552 branch November 10, 2026 02:31
@RomneyDa

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

RomneyDa added a commit that referenced this pull request Nov 10, 2026
* fix(models): reduce cold catalog memory

* fix(models): reuse captured catalog suppression metadata

* fix(openai): defer catalog auth runtime loading

* test(openai): explain catalog auth mock isolation

* fix(models): defer discovery OAuth runtime loading

* fix(process): isolate broker OOM spawn operations

* fix(pr): retain broker OOM spawn leaf in wrapper

* fix(state): load shared read query owners on demand

* fix(gateway): skip empty shared publication recovery

* fix(state): defer subagent completion imports during queue recovery

* fix(state): isolate placement startup worker imports

* fix(state): defer ACP imports for session maintenance

* fix(startup): defer unused transcript and hook imports

* fix(ci): fund the empty publication recovery regression

* fix(startup): defer plugin session event execution

* fix(startup): defer catalog migration and process helpers

* test(plugins): exercise command revocation without a process mock

* fix(startup): separate npm record metadata from command execution

* refactor(plugins): keep npm metadata types with registry helpers

* fix(gateway): keep optional runtimes out of cold discovery

* test(agents): consolidate cold catalog import checks

* fix(openai): isolate catalog discovery from runtime hooks

* test(openai): consolidate cold import boundary cases

* perf(agents): skip globally denied tool construction

* test: consolidate cold runtime regression coverage

* perf(agents): defer cold tool factory imports

Keep asynchronous tool construction independent of the legacy synchronous SDK facade. Load factories only when the shared assembly requests them and revalidate authority after each import.

Preserve policy, collector and host-tool behavior. Cover cold chat import boundaries and move consumer mocks to the asynchronous owner.

* fix(plugins): expose opaque session event target type

* fix(agents): skip auxiliary runtimes when tools are denied

* fix(gateway): keep auth policy reads on runtime snapshots

* fix(gateway): defer headless model catalog discovery

* test(gateway): account for headless catalog regressions

* test(gateway): complete cold-start regression allocation

* fix(plugins): preserve loaded provider catalogs during discovery

* fix(gateway): preserve provider scope during catalog reads

* fix(agents): retain source identity for late catalog providers

* fix(agents): preserve lazy catalogs across remote updates

* fix(gateway): defer unused workspace prewarm imports

* fix(gateway): keep headless session display work cold

* fix(agents): defer optional execution runtimes

* fix(agents): complete deferred runtime cutover

* fix(ui): calibrate budget for removed preload

* fix(state): isolate session patch publication imports

* perf(agents): defer local command and session barrel imports

* test: reuse existing cold-import line allocation

* test(agents): hook the concrete queued maintenance owner

* perf(build): reduce runtime source retained by module loaders

Shorten local bindings while preserving module markers and top-level names used by update compatibility and standalone codegen. Apply the existing name-preserving worker minification policy to standalone runtime processes.

Add an emitted-byte and relocated-runtime regression with an exact 90-line test allocation. Focused build contracts, tooling typecheck, lint, format, and the test-line ratchet pass. ARM memory acceptance remains pending.

* fix(cron): release disabled scheduler worker leases

* refactor(startup): simplify regression proof and allocation

* test(startup): account for merged publication coverage

* test(models): join native catalog refresh before logout

* refactor(startup): split independent build and cron fixes

Move runtime-source minification and disabled-cron scheduler lease work to independent PRs #196386 and #196387. Keep the original catalog, tool, and database cold-import cutover together and preserve all contributor ancestry.

Transfer exactly 90 and 153 regression-test lines to their owning changes; reduce this change allocation from 1092 to 849 without changing the shared baseline.

* test(gateway): isolate native catalog RPC demand from startup warmup

---------

Co-authored-by: Dallin Romney <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…aw#196386)

Extract the independent minification change from openclaw#192552. Preserve shared-runtime ownership markers and top-level bindings, retain function and class names, and verify relocated execution and lazy loading.

Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…92552)

* fix(models): reduce cold catalog memory

* fix(models): reuse captured catalog suppression metadata

* fix(openai): defer catalog auth runtime loading

* test(openai): explain catalog auth mock isolation

* fix(models): defer discovery OAuth runtime loading

* fix(process): isolate broker OOM spawn operations

* fix(pr): retain broker OOM spawn leaf in wrapper

* fix(state): load shared read query owners on demand

* fix(gateway): skip empty shared publication recovery

* fix(state): defer subagent completion imports during queue recovery

* fix(state): isolate placement startup worker imports

* fix(state): defer ACP imports for session maintenance

* fix(startup): defer unused transcript and hook imports

* fix(ci): fund the empty publication recovery regression

* fix(startup): defer plugin session event execution

* fix(startup): defer catalog migration and process helpers

* test(plugins): exercise command revocation without a process mock

* fix(startup): separate npm record metadata from command execution

* refactor(plugins): keep npm metadata types with registry helpers

* fix(gateway): keep optional runtimes out of cold discovery

* test(agents): consolidate cold catalog import checks

* fix(openai): isolate catalog discovery from runtime hooks

* test(openai): consolidate cold import boundary cases

* perf(agents): skip globally denied tool construction

* test: consolidate cold runtime regression coverage

* perf(agents): defer cold tool factory imports

Keep asynchronous tool construction independent of the legacy synchronous SDK facade. Load factories only when the shared assembly requests them and revalidate authority after each import.

Preserve policy, collector and host-tool behavior. Cover cold chat import boundaries and move consumer mocks to the asynchronous owner.

* fix(plugins): expose opaque session event target type

* fix(agents): skip auxiliary runtimes when tools are denied

* fix(gateway): keep auth policy reads on runtime snapshots

* fix(gateway): defer headless model catalog discovery

* test(gateway): account for headless catalog regressions

* test(gateway): complete cold-start regression allocation

* fix(plugins): preserve loaded provider catalogs during discovery

* fix(gateway): preserve provider scope during catalog reads

* fix(agents): retain source identity for late catalog providers

* fix(agents): preserve lazy catalogs across remote updates

* fix(gateway): defer unused workspace prewarm imports

* fix(gateway): keep headless session display work cold

* fix(agents): defer optional execution runtimes

* fix(agents): complete deferred runtime cutover

* fix(ui): calibrate budget for removed preload

* fix(state): isolate session patch publication imports

* perf(agents): defer local command and session barrel imports

* test: reuse existing cold-import line allocation

* test(agents): hook the concrete queued maintenance owner

* perf(build): reduce runtime source retained by module loaders

Shorten local bindings while preserving module markers and top-level names used by update compatibility and standalone codegen. Apply the existing name-preserving worker minification policy to standalone runtime processes.

Add an emitted-byte and relocated-runtime regression with an exact 90-line test allocation. Focused build contracts, tooling typecheck, lint, format, and the test-line ratchet pass. ARM memory acceptance remains pending.

* fix(cron): release disabled scheduler worker leases

* refactor(startup): simplify regression proof and allocation

* test(startup): account for merged publication coverage

* test(models): join native catalog refresh before logout

* refactor(startup): split independent build and cron fixes

Move runtime-source minification and disabled-cron scheduler lease work to independent PRs openclaw#196386 and openclaw#196387. Keep the original catalog, tool, and database cold-import cutover together and preserve all contributor ancestry.

Transfer exactly 90 and 153 regression-test lines to their owning changes; reduce this change allocation from 1092 to 849 without changing the shared baseline.

* test(gateway): isolate native catalog RPC demand from startup warmup

---------

Co-authored-by: Dallin Romney <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 12, 2026
Extract the independent minification change from #192552. Preserve shared-runtime ownership markers and top-level bindings, retain function and class names, and verify relocated execution and lazy loading.

Adapt the owner-label assertion to this stable line's existing region contract rather than importing the later bundled-module-regions helper. Retain 89 net regression lines with a matching allocation.

(cherry picked from commit eaa8aeb)

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 19566d1365f2ac74d198ba5984d9cefd81726537)
RomneyDa added a commit that referenced this pull request Nov 12, 2026
Adapt upstream source 625945b to the beta3 runtime owners. Keep synchronous SDK compatibility while deferring tool, model, plugin, process and state-handler initialization.

Integrate on 67cc5d9, preserving #195398, #196301, #196386, #196387, #189991 and #196448. Three automatically merged overlaps retain canonical assertion/mock baseline removals and worker-turn input gating; no new behavioral adaptation.

Original source reviews and focused build/test evidence are retained. Fresh integration-only independent review found no actionable issues.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce Gateway startup memory on constrained ARM64 hosts

2 participants