Skip to content

fix: restore installed package entry headroom - #182279

Merged
steipete merged 2 commits into
mainfrom
steipete/pkg-trim-control-ui-precompress
Oct 24, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/pkg-trim-control-ui-precompress

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes fresh npm installs exceeding the 47,500-entry packaging guard and leaving too little headroom below shipped updaters' 50,000-entry walk limit.

User Impact

Installed packages contain 2,662 fewer Control UI entries while preserving every original asset and the startup transfer budgets. Small deferred assets without sidecars are served as identity by the Gateway's existing fallback; CSS and initial startup assets retain useful compression.

Why This Change Was Made

The Vite output owner emitted gzip and Brotli siblings even for tiny assets and representations larger than the original. Require 4 KiB for ordinary assets, exempt all CSS and the initial startup set, and retain each encoding only when strictly smaller. The startup exemption uses the same extracted final-HTML asset list as the performance gate, with route-only preload templates excluded.

The performance checker now measures identity bytes when a sibling is absent, matching the existing static server. The startup parser is shared with the build and its existing E2E consumer. All package/performance limits, dependencies, encoders and chunking remain unchanged. No runtime server changes are needed.

Evidence

Fresh Linux arm64 global installs from canonical packed tarballs, using Node 24.22.1 / npm 11.19.1 and the unmodified installed-tree checker:

Metric Before After
Entries, root included 49,097 46,433
Bytes 593,504,010 590,506,175
Installed budget checker fails passes
Control UI entries 7,809 5,147
Control UI sidecars 5,006 2,344

The change itself removes 2,662 entries. The observed total reduction is 2,664: this pack also omits scripts/README.md and generated node_modules/@openclaw/ai/dist/mistral.LICENSE, whose owners are untouched. Those two files are excluded from the savings claim and warrant separate artifact follow-up; restoring both still yields 46,435 entries. The candidate tarball is validation evidence, not a publication artifact.

Both previously failing performance gates pass on the built and installed trees:

Gate Before After Unchanged limit
Startup JS gzip-request transfer 281,189 B 281,169 B 281,809 B
Total CSS gzip-request transfer 302,525 B 302,525 B growth <=64 B
Startup CSS gzip 40,130 B 40,130 B 51,200 B ceiling
  • All 2,528 original assets have identical names and bytes; every remaining sidecar is strictly smaller.
  • Real installed Gateway starts, serves the UI, passes health, loads memory-core at runtime, and shuts down cleanly. Installed openclaw --version succeeds.
  • Nine curl checks cover small exempt CSS, small non-exempt JS and large JS under gzip, Brotli and identity. All return 200 and decode to the exact installed original; missing sidecars use identity.
  • Five interleaved first-load pairs through fresh installed Gateways using the existing untraced browser benchmark: median shell interactive 716.7 → 661.3 ms; composer enabled 717.0 → 661.5 ms; first transcript 1,134.0 → 1,077.5 ms. Shell ranges overlap (674.8–843.1 vs 641.2–829.0 ms); no consistent regression observed, not a speedup claim. The harness uses real Gateway HTTP with synthetic bootstrap/RPC/media.
  • 137 focused tests pass: 42 Vite owner, 54 static HTTP, 41 performance checker. Includes threshold, strict-smaller, startup/CSS exemption, route-template exclusion, and identity fallback regressions. Default pinned Bun runtime.
  • tsrs passes: UI, scripts, tooling-test, UI-app-test and Gateway-root-test lanes. Targeted oxlint, formatting and whitespace checks pass. Canonical build and tarball integrity pass.
  • pr-simplify complete: one compression owner, one shared parser; production +58/-36, tests +95/-2, docs +7/-1. Independent autoreview is clean at P0–P2. PR CI supplies broad proof.
Reproduction and artifact identity

Build each revision with node scripts/package-openclaw-for-docker.mjs --output-dir <artifact-dir>, waiting for final tarball integrity and normalization. Install into an empty global prefix inside node:24.22.1-bookworm-slim:

npm install -g --allow-scripts=<tarball> --prefix <prefix> <tarball> \
  --no-fund --no-audit --loglevel=error --min-release-age=0
node scripts/check-openclaw-installed-package-budget.mts <prefix>/lib/node_modules/openclaw
node --import ./scripts/tsx.mjs scripts/check-control-ui-performance.mts --json \
  --dist <candidate>/dist/control-ui --base-dist <baseline>/dist/control-ui

Base source: 990a389cf6e2f6769ad9240a69e7f91ca21e37f8.
Baseline tarball SHA256: 29ca461eef933b182ff846fbbd1aa9566954b3d6fa5030cf6a462f4093bd8aa9.
Candidate tarball SHA256: 988cfb758e5fb16616233fdfb0dc9f46016e002c12a7cf770557f5d9adcf2f8f.
Unchanged budget checker SHA256: 026c59558c9517de215f1b670186218378fdbe970f6cdd6f73ae3e860db0b22d.

CI contract cutover

The finalization and plugin distribution tests now assert optional per-encoding sidecars. The fixture's 18-byte CSS becomes 20 bytes with Brotli and 38 with gzip, so both are correctly absent. The small startup runtime keeps only Brotli. Plugin assets use the same Vite compression owner: deferred JavaScript below 4 KiB and unprofitable CSS remain identity-only; added fixture assets verify useful large JavaScript and sub-threshold CSS still round-trip through both encodings.

The progress test now counts assets with either encoding. Its plugin inventory is rooted in the temporary fixture instead of local built plugins, and its synthetic progress assets exceed the threshold. No production behavior, dependency, or budget changes accompany this follow-up.

Exact focused reproduction, using the default pinned Bun runtime:

node scripts/run-vitest.mjs ui/src/app/vite-build.node.test.ts ui/src/app/plugin-distributions.node.test.ts --maxWorkers=1

Before: 6 failed / 15 passed (119.06 seconds Vitest duration). After: 21 passed (27.23 seconds Vitest duration; 29.43 seconds wrapper wall time). These files exercise actual Vite builds, output overrides, final emitted bytes, plugin publication, and the development server. PR CI supplies broader coverage and CI timing.

Follow-up validation: targeted UI-app test typecheck through tsrs, oxlint, formatting, and whitespace checks pass. pr-simplify is complete and independent autoreview is clean at P0–P2. The cutover commit changes only two test files (+77/-31); production behavior is unchanged.

@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T06:07:47.024167Z f9d63ff New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: S labels Oct 24, 2026
@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. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR omits small or non-beneficial Control UI compression sidecars while preserving startup compression and accounting for identity fallback.

Example: Install the canonical package globally on Linux arm64 with Node 24.22.1 and npm 11.19.1.

  • Before: The reported installed tree contains 49,097 entries and exceeds the 47,500-entry packaging guard.
  • After: The reported tree contains 46,433 entries; this change accounts for 2,662 fewer entries, with original asset bytes preserved.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The supplied installed-runtime evidence supports the change, but the consumer migration is incomplete and causes reproducible exact-head CI failures.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its supplied evidence nevertheless exercises canonical package installation, installed Gateway asset delivery, and browser loading on Linux arm64.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Package growth exceeds the packaging guard and consumes headroom required by shipped updaters.
Reason: The maintainer-authored direction removes measured packaging waste at the existing owner without adding configuration or changing original asset bytes.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR: it provides useful package headroom through a focused compression change, but existing build tests must be migrated to the new optional-sidecar contract before merge.

Priority: P2
Reviewed head: 61ebc72c1e77d403e4e860a97b65143c806cc537

Before merge

  • Migrate build-test consumers to optional compression sidecars (P2) - Returning zero or one sidecar invalidates existing consumers that still require two for every asset. Exact-head CI fails in ui/src/app/vite-build.node.test.ts:406 when tiny lazy CSS has no .br file, and in ui/src/app/plugin-distributions.node.test.ts:108 when the small deferred plugin chunk has none. The progress test also counts only paired variants and assumes two writes per asset, producing the recorded mismatch at line 351. Update both suites to cover intentional omissions, decode every retained representation, preserve output-directory and plugin-inventory assertions, and measure progress from actual completed writes. These are diff-caused failures in checks-ui (2/3) and (3/3), which also fail the aggregate gate.

Findings

  • [P2] Migrate build-test consumers to optional compression sidecars — ui/vite.config.ts:122
Agent review details

How this fits together

Vite produces the packaged Control UI assets and compression sidecars; the performance checker measures their transfer costs, and the Gateway negotiates available representations for browser requests.

flowchart LR
  A[UI source and emitted HTML] --> B[Vite output owner]
  B --> C[Original assets and useful sidecars]
  C --> D[Installed package budget]
  C --> E[Performance checker]
  C --> F[Gateway representation selection]
  F --> G[Browser]
Loading

Technical review

Best possible solution:

Retain the selective compression policy and migrate the existing build tests without weakening asset integrity, output-directory, or progress-reporting coverage.

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

Source confirms unconditional sidecar generation and the installed-entry guard, while the supplied paired installs establish the reported budget failure; this read-only review ran no target code.

Is this the best way to solve the issue?

The approach removes unnecessary package entries at their existing producer, shares the startup parser across consumers, and preserves the encoders and budgets; the incomplete test-consumer migration is the concrete defect.

Full review comments:

  • [P2] Migrate build-test consumers to optional compression sidecars — ui/vite.config.ts:122
    Returning zero or one sidecar invalidates existing consumers that still require two for every asset. Exact-head CI fails in ui/src/app/vite-build.node.test.ts:406 when tiny lazy CSS has no .br file, and in ui/src/app/plugin-distributions.node.test.ts:108 when the small deferred plugin chunk has none. The progress test also counts only paired variants and assumes two writes per asset, producing the recorded mismatch at line 351. Update both suites to cover intentional omissions, decode every retained representation, preserve output-directory and plugin-inventory assertions, and measure progress from actual completed writes. These are diff-caused failures in checks-ui (2/3) and (3/3), which also fail the aggregate gate.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Control UI compression producer changes intended behavior with a stated reason (16fa19c: Precompress final bundled assets to reduce transfer costs without request-time compression.)
  • Performance sidecar accounting changes intended behavior with a stated reason (644bc79: Measure shipped transfer representations and reject startup or largest-asset regressions; identity accounting now follows the intentional absence of sidecars.)
  • Portable gzip and bounded compression keeps the original intent (3e42513: Use a pinned portable encoder while preserving final-byte reads and bounded compression work.)
  • Startup parser relocation keeps the original intent (644bc79: Extract startup assets from generated HTML; relocation preserves the parser and migrates its existing consumers.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/app/vite-build.node.test.ts src/app/plugin-distributions.node.test.ts src/app/vite-config.node.test.ts
  • pnpm test test/scripts/control-ui-performance.test.ts --maxWorkers=1
  • git diff --check
  • Verify checks-ui (2/3), checks-ui (3/3), and openclaw/ci-gate on the repaired head.

What I checked:

PR surface

Source +49, Tests +93, Docs +6, Other -27. Total +121 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 51 2 +49
Tests 4 95 2 +93
Docs 1 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 7 34 -27
Total 8 160 39 +121

Labels

Label changes:

  • add P2: The change restores packaging headroom beneath an existing guard; its remaining blocker is a focused migration of build-test expectations.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The change restores packaging headroom beneath an existing guard; its remaining blocker is a focused migration of build-test expectations.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 24, 2026, 1:56 AM ET / 05:56 UTC.

Assert only useful per-encoding sidecars for startup, deferred, CSS, and plugin assets. Count single-encoding compression progress and keep build fixtures independent of local plugin artifacts.
@steipete
steipete merged commit 723d9c2 into main Oct 24, 2026
131 of 133 checks passed
@steipete
steipete deleted the steipete/pkg-trim-control-ui-precompress branch October 24, 2026 06:36
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
… assets (openclaw#182279)

* fix: trim small Control UI compression sidecars

* test(ui): finish precompression threshold contract cutover

Assert only useful per-encoding sidecars for startup, deferred, CSS, and plugin assets. Count single-encoding compression progress and keep build fixtures independent of local plugin artifacts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant