Skip to content

perf(ui): compact the self-contained startup document - #194604

Merged
steipete merged 3 commits into
mainfrom
solid2/w-perf-document-bytes-1107
Nov 7, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-perf-document-bytes-1107

Conversation

@steipete

@steipete steipete commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Every Control UI navigation downloads a larger self-contained startup document after the fallback shell landed.

User Impact

The served document is 1,921 B smaller with the same fallback appearance and recovery behavior. Existing document and CSS budget debt remains visible in build summaries.

Why This Change Was Made

Compact inline scripts at build time, preserving the fallback shell, inline artwork, early composer, bounded recovery, legacy browser explanation, and existing Gateway CSP hashing. No fallback asset moves behind a request. Remove six retired CSS rules and keep fixed-cap overages visible as nonblocking Actions warnings and build-summary entries, including report-only builds and inherited-overage comparisons.

This preserves Vyctor Brzezowski's fallback presentation from #193898 and Vincent Koc's draft-preserving downtime/recovery behavior from #191935. The separate Gateway/public-reader wordmarks in #193874/#193876 do not contribute to this document.

Byte evidence and remaining debt

Complete builds on the same Mac; pinned Node 26.12.1 checker. Base 020ec24568b12416bf4315732532bae8762101aa; measured candidate 3cb8e2b8785 (later commits strengthen the build-boundary test, load the same minifier only during builds, and fix a test animation race; the production transformation is unchanged). The target is at least 5% smaller document transfer, with cold-boot timing inside the existing band and unchanged fallback behavior.

Surface Base Candidate Delta Existing cap
Built document raw 77,962 B 68,233 B -9,729 B —
Built document gzip 17,928 B 16,000 B -1,928 B (-10.75%) 13,893 B
Served Chat document gzip 17,809 B 15,888 B -1,921 B (-10.79%) —
Served Chat document Brotli 17,576 B 15,583 B -1,993 B —
Total CSS normalized gzip 325,737 B 325,584 B -153 B 325,109 B
Total CSS raw 1,677,170 B 1,676,630 B -540 B 1,675,754 B
Total CSS served gzip 325,851 B 325,698 B -153 B —
Startup JS normalized gzip 90,890 B 90,890 B 0 B unchanged
Startup CSS requests 1 1 0 1

No cap is raised. The document still exceeds its cap by 2,107 B, and total CSS by 475 B gzip / 876 B raw. The verified dead rules are exhausted; other apparent dead selectors are emitted through dynamic class prefixes. This is a focused reduction, not a claim that all budget debt is retired. Startup JS raw bytes are identical; generated asset-name compression changes served startup gzip by +42 B and Brotli by +109 B, while the document saving is larger.

The actual gzip HTTP/1.1 Chat response is 15,888 B body + 2,697 B headers = 18,585 B, down from 20,506 B. It still does not fit IW10 at MSS 1,460 (14,600 B), before TLS overhead. The delayed-response benchmark does not emulate congestion or a throughput cap.

What grew

The retained complete #194070 artifact was verified against its exact source: all four inline source scripts, the generated locale script, and the CSS transformed through the historical build pipeline match. Its differing release metadata is isolated below. Whole-document gzip contributions use pinned mise Node and sequential replacements, not sums of independently compressed fragments. They total +4,099 B; raw growth totals +23,263 B.

Contributor/feature Raw growth since #194070 Gzip contribution Treatment
#193898 fallback shell / inline branding, Vyctor Brzezowski SVG +14,096 B; inline CSS +7,488 B; markup +1,414 B SVG +2,561 B; CSS +1,452 B; markup -8 B Preserve appearance and asset-free recovery
#191935 recovery updates, Vincent Koc inline recovery script +263 B +72 B Compact scripts without changing recovery
Locale table and hints 0 B -5 B (asset-reference hashes) Preserve all hints
Build metadata and remaining cross-section compression +2 B raw +27 B Report, not runtime policy

That exact historical artifact is 13,820 B gzip with Homebrew Node's zlib, versus 17,879 B for the current base. The pinned mise Node build reproduces #194070's 13,829 B and measures the current base at 17,928 B. Do not mix these compression toolchains.

The cap did catch #193898: its performance job failed on 13,779 → 17,894 B gzip (+4,115 B). It merged with that failed check; its body mentions CSS/JS budget exceptions, which alone does not establish a document-budget waiver. ui/index.html already selects the check. The visibility gap fixed here is inherited excess disappearing from annotations, and report-only builds suppressing those warnings; strict growth enforcement remains unchanged.

Evidence

Proof Result
Complete base/head pnpm ui:build Pass; same machine, complete sidecars
Strict head/base performance checker Pass; no differential violations, absolute debt shown above
pnpm tsgo:ui Pass
vite-build.node.test.ts 20 passed; final Bun run plus the two affected preview/accessibility tests: 22 passed in 6.60 s
control-ui-performance.test.ts 50 passed, including report-only and inherited-overage Actions warnings
Production Knip Pass on final head
Independent Codex autoreview, P0–P2, base 020ec24568b No actionable findings; unchanged CSS emitters checked separately in source
Built fallback with every external request blocked Pass; byte-identical desktop dark/mobile light PNGs; all 116 elements' computed styles and geometry match; early draft and bounded recovery preserved
Gateway CSP / actual identity, gzip, Brotli HTTP responses Pass; all six inline hashes admitted
Chromium/WebKit/Firefox cold boot, 100 ms, 20 rotated triplets with A/A 180/180 passed; table below
Live Lobsterdex CSS reinjection 108 nodes × 850 computed properties unchanged; all six removed selectors matched zero elements
Targeted lint/format Pass after equivalent regex spelling repair

No Solid state/lifecycle changes: refactor-checklist owner/effect/listener/flush counts unchanged. Source reduction removes six CSS rules. Total change: +110/-38 lines across 10 files. Touched production files: 8,524 → 8,531 LOC; tests (including the repaired toast test): 2,460 → 2,520 LOC. The exact +60 test-line allocation preserves the shared scalar: 24 lines protect real-build fallback execution/legacy syntax, 35 protect CLI warning visibility, and one waits for resized toast geometry to settle. The small production increase is the existing build owner’s compaction and warning reporting, offset by six deleted CSS rules. No remote lease was needed.

Cold boot at 100 ms

Engine Base ready median / p95 Candidate median / p95 A/A median / p95
Chromium 804.6 / 884.6 ms 807.2 / 872.1 ms 810.1 / 871.3 ms
WebKit 967.0 / 1,005 ms 968.0 / 1,003 ms 965.5 / 1,010 ms
Firefox 858.0 / 900 ms 858.0 / 879 ms 859.0 / 879 ms

Each cell has 20 observations; all 180 passed. Chromium thread CPU median/p95 was 482.88/507.95 → 481.29/509.65 ms, with A/A 481.93/511.74 ms. The 0.33% CPU-tail movement is below the unchanged A/A tail and the campaign’s 1% noise threshold. No cold-boot speedup is claimed: readiness stays within 0.4% of base while document transfer shrinks 10.79%. Host one-minute load median was 9.45 (p95 12.26). WebKit/Firefox do not expose comparable thread CPU in this harness.

node --import ./scripts/tsx.mjs scripts/bench-control-ui-engines.ts \
  --bundle-dir <base-build> --compare-bundle-dir <candidate-build> \
  --control-bundle-dir <base-build> --engines chromium,webkit,firefox \
  --steps cold-boot --viewport desktop --network-profiles rtt-100ms --pairs 20

The picker’s retired title and Talk’s retired status-text classes are absent from current emitters. Their dedicated live fixture attempts were inconclusive; the live reinjection comparison covers Lobsterdex rather than claiming those states were captured. A source-equivalent SVG <use> experiment saved only 35 B gzip, and broad whitespace removal saved 305 B; neither closes the 2,107 B debt, so this PR retains the exact DOM/artwork and does not add that coupling.

Final exact-head CI 42372593143, build artifacts 42372593105, and Workflow Sanity 42372593066 passed. Native recovery merged 009a2dfa6df95a7f161569d6176d52897b111d6b as aa75d20870ac22affa7c94975210c8ad8b5e4efa.

The initial PR-context check required exact template headings; the body is corrected. CI run 42371012297 then exposed two preview/accessibility tests failing on esbuild's mixed-realm invariant and a WebKit toast assertion comparing 72 px with a moving 58.44 px snapshot. The build config now loads esbuild through its existing native require only when transforming a production document, so dev/preview no longer initialize that build-only dependency. Both affected tests and all 20 build tests pass on the pinned Bun fork. The toast test now waits for its resize animation before capturing expected bounds; the full base toast file passed (14 tests, 13.20 s), so this is not classified as inherited. The repaired WebKit case passes (4.24 s runner wall). No assertions were removed. The test-line ratchet's +59 failure is addressed by the exact +60 allocation above, including the one-line animation repair. No broad local test reruns or remote leases were used.

Screenshots

Synthetic asset-free fallback, every external request blocked. Before and after PNGs are byte-identical for each viewport. Attached below.

Before: asset-free desktop fallback

After: identical desktop fallback

Before: asset-free mobile fallback

After: identical mobile fallback

Preserve the startup fallback shell, inline artwork, draft recovery and CSP admission while minifying inline scripts at build time. Keep inherited document and CSS budget debt visible in build summaries, and remove six retired CSS rules.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Nov 7, 2026
@clawsweeper

clawsweeper Bot commented Nov 7, 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 app: web-ui App: web-ui scripts Repository scripts labels Nov 7, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T12:30:00.471282Z 009a2df 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.

@steipete
steipete enabled auto-merge (squash) November 7, 2026 12:09
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 7, 2026
@clawsweeper

clawsweeper Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR minifies inline startup scripts, removes unused CSS rules, and exposes inherited performance-budget overages.

Example: Opening Chat with gzip compression

  • Before: The supplied Gateway measurement shows a 17,809 B document body.
  • After: The document body is 15,888 B, with the same self-contained fallback.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused, and supported by shipped-document evidence; the test-budget record needs repair and remaining hosted failures require attribution.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied paired Gateway response measurements exercise the built document, while inspected asset-free desktop/mobile screenshots preserve fallback appearance; reported CSP admission, recovery checks, and three-engine runs cover script execution after compaction.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Every Control UI navigation transfers avoidable startup-document bytes.
Reason: The measured 10.79% served-document reduction preserves the approved presentation and recovery behavior; remaining absolute budget debt is explicitly disclosed.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR provides a useful startup-document reduction and should stay open; one mechanical test-budget blocker needs repair.

Priority: P2
Reviewed head: 8f64109109d1278f7fad19d4e308ac3501214028

Before merge

  • Allocate the added regression-test lines (P3) - The two added test groups increase the tracked test tree by 59 lines without an allocation record. At this head, the tree contains 6,563,045 lines against a 6,562,986 effective ceiling, so this change introduces the exact 59-line overage reported by the failing test-lines gate. Add a justified 59-line record under config/test-lines-allocations/ while retaining the shared scalar.

Findings

  • [P3] Allocate the added regression-test lines — test/scripts/control-ui-performance.test.ts:598-602

Tests

  • Missing end-to-end proof: Head test passes are reported, but a base-fail/head-pass replay of the added cases is not supplied.
Agent review details

How this fits together

The Vite build transforms the Control UI document and styles into shipped assets; the Gateway serves the resulting document with hashes for its inline scripts.

flowchart LR
  A[UI source document] --> B[Vite build owner]
  B --> C[Inline script compaction]
  C --> D[Built document]
  D --> E[Gateway response and CSP]
  E --> F[Browser startup and recovery]
  D --> G[Performance budget checker]
Loading

Technical review

Best possible solution:

Keep compaction in the existing build owner and add a justified allocation for the 59 new regression-test lines without raising the shared baseline.

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

The base build leaves inline scripts unminified, and the supplied paired Gateway measurements establish the transfer reduction; read-only counting independently establishes the test-budget failure.

Is this the best way to solve the issue?

The implementation uses the existing HTML producer and pinned esbuild dependency, preserving fallback assets and recovery instead of introducing another loading path.

Full review comments:

  • [P3] Allocate the added regression-test lines — test/scripts/control-ui-performance.test.ts:598-602
    The two added test groups increase the tracked test tree by 59 lines without an allocation record. At this head, the tree contains 6,563,045 lines against a 6,562,986 effective ceiling, so this change introduces the exact 59-line overage reported by the failing test-lines gate. Add a justified 59-line record under config/test-lines-allocations/ while retaining the shared scalar.
    Confidence: 1

Overall correctness: patch is correct
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Document build transformation keeps the original intent (a302730: The existing final HTML producer preserves synthesized script attributes and nonblocking stylesheet admission.)
  • Performance warning reporting keeps the original intent (9ed5a04: Size limits receive Actions annotations; later budget work preserves strict growth enforcement.)
  • Picker stylesheet keeps the original intent (fcf922b: Long phone pickers use the existing picker surface as a bottom sheet; the removed title class has no current emitter.)
  • Lobsterdex stylesheet keeps the original intent (10b5084: Miniature gallery sprites originally needed sizing and animation rules; current gallery markup no longer emits that exact class.)
  • Composer stylesheet keeps the original intent (feff169: Shared passive composer styling protected pending-start content; the deleted status-text class is no longer emitted.)
  • Plugin workspace stylesheet keeps the original intent (b988ce9: The Plugins and Skills workspace used banner action layout; the removed class has no current emitter.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:test-lines-ratchet --base 020ec24 --no-merge-base
  • pnpm check:baseline-ratchets --base 020ec24 --no-merge-base
  • git diff --check

What I checked:

PR surface

Source -13, Tests +59, Other +19. Total +65 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 24 37 -13
Tests 2 59 0 +59
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 20 1 +19
Total 8 103 38 +65

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test growth Production +6 net LOC; tests +59 LOC The small production increase retains one build owner; the added cases protect compaction and two distinct warning-reporting paths.

Labels

Label changes:

  • add P2: This is a measured startup-transfer improvement with limited scope and a mechanical CI blocker.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a measured startup-transfer improvement with limited scope and a mechanical CI blocker.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 November 7, 2026, 7:23 AM ET / 12:23 UTC.

@steipete
steipete disabled auto-merge November 7, 2026 12:26
Keep preview and dev config loading out of esbuild's VM realm check. Settle resized toast animation before recording its expected position. Allocate exactly 60 regression-test lines for build fallback behavior, visible budget warnings and the animation wait; retain the shared test-line scalar.
@steipete
steipete merged commit aa75d20 into main Nov 7, 2026
109 of 111 checks passed
@steipete
steipete deleted the solid2/w-perf-document-bytes-1107 branch November 7, 2026 12:41
@steipete

steipete commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
* perf(ui): compact the self-contained startup document

Preserve the startup fallback shell, inline artwork, draft recovery and CSP admission while minifying inline scripts at build time. Keep inherited document and CSS budget debt visible in build summaries, and remove six retired CSS rules.

* test(ui): verify compaction through the production build

* fix(ui): load the document minifier only for builds

Keep preview and dev config loading out of esbuild's VM realm check. Settle resized toast animation before recording its expected position. Allocate exactly 60 regression-test lines for build fallback behavior, visible budget warnings and the animation wait; retain the shared test-line scalar.
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 ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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