Skip to content

perf(control-ui): defer closed sidebar renderers during reload - #170648

Merged
steipete merged 3 commits into
mainfrom
steipete/coldload-boot-js-composition
Oct 13, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/coldload-boot-js-composition

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A signed-in reload of a dashboard deep link downloads and evaluates closed sidebar surfaces before the operator uses them. The cold-load campaign's original evidence recorded 14 visual states over roughly 15 seconds; L34 still measured 53 boot JS requests after the earlier improvements.

User Impact

The Inbox badge and sidebar remain available at boot, while the Inbox panel and sidebar popup renderers load through their existing interaction boundaries. Session-menu registration now belongs to the popup renderer that consumes it. No settings, authentication, Gateway records, or schema changes.

Why This Change Was Made

Remove the connection-time Inbox preload, idle sidebar-popup preload, and eager sidebar session-menu registration. Regenerate the measured boot manifest with the existing generator, excluding both optional dynamic entries from route hints and the offline boot inventory. Pointer/focus Inbox prefetch and menu-opening loads remain available; optional chunks need a network connection until first loaded, like other lazy surfaces.

Evidence

Production-bundle Team-scale fixture, one reload per candidate on the same loaded Mac, at UI source base 74c7b3d72589 (after the New Session Solid migration). The baseline temporarily substitutes the five changed production UI files from main in this lane's worktree, then restores the reviewed bytes exactly. The UI files at the sampled main revision 633acc213dae are identical to that UI base. Byte counts sum emitted JS and shipped gzip sidecars, rather than compressed wire traffic; build identities differ and can introduce small gzip variance. All timing samples are noisy.

Measurement Before After
Chat route boot JS, raw 5,259,199 B 5,159,516 B
Chat route boot JS, gzip 1,625,349 B 1,600,203 B
Chat route boot JS hints 31 30
Dashboard reload fetched app JS, raw 5,405,524 B 5,307,731 B
Dashboard reload fetched app JS, gzip 1,675,643 B 1,651,597 B
Dashboard reload distinct app JS assets 47 47
Dashboard reload all JS requests, including six synthetic plugins 53 53
Main-thread script/module evaluation, interval union 19.3 ms 24.1 ms
Renderer busy time 1,457 ms 1,605 ms

No reliable evaluate-time or overall reload-speed improvement is claimed: another pair measured evaluation 26.8→20.1 ms, while the starting-base pair measured 21.7→24.0 ms. The demonstrated improvement is fewer boot-hint requests and fewer downloaded JS bytes. New Session also falls from 28 to 27 boot JS hints and from 1,344,712 to 1,300,899 gzip bytes.

Evaluation accounts for EvaluateScript and v8.evaluateModule on the selected renderer main thread; overlapping intervals are counted once. Iframe evaluation is excluded.

Source-map attribution found a single production copy of Solid, lit-html, and every other package in the fetched graph. Major vendor contributions before the change: TypeBox ~148 KB, Web Awesome ~126 KB, Zod ~100 KB, highlight.js ~72 KB, Solid signals ~65 KB, markdown-it ~51 KB; startup English ~150 KB. Foreign locale catalogs, Mermaid, terminal/noVNC, and settings page renderers remain lazy. No dependency overrides or runtime-resolution changes are needed. Retired boot code includes the sidebar popup renderer (~11 KB), update card (~10 KB), sidebar session menu renderers (~8.5 KB), and Inbox rendering/helpers.

Focused proof, one file at a time:

  • pnpm ui:boot-manifest:gen and production UI builds through the merged cold-load bench.
  • pnpm ui:check-performance --dist <candidate-bundle>: all enforced budgets pass, chat/New Session 30/27 JS hints (limit 35).
  • pnpm test ui/src/e2e/sidebar-boot-imports.e2e.test.ts --maxWorkers=1: 1 pass, 33.98 s command wall time; source-server request boundary plus visible opened Inbox. Reinstating the original preload in the served module fails the zero-request assertion (1 request before interaction).
  • pnpm test ui/src/components/sidebar-attention.test.ts --maxWorkers=1: 21 pass, 12.37 s command wall time. Move the existing import-settlement wait to the first opening instead of assuming mount preloads it.
  • pnpm test ui/src/components/app-sidebar.sessions.test.ts --maxWorkers=1: 154 pass, 65.93 s.
  • pnpm test ui/src/e2e/sidebar-attention-scope.e2e.test.ts --maxWorkers=1: 1 pass, 49.51 s; bundled Inbox opening, automation scopes, and dismissal.
  • pnpm test ui/src/e2e/mobile-sidebar-session-menu.e2e.test.ts --maxWorkers=1: 6 pass, 76.83 s; actual session menus and shortcuts.
  • pnpm test ui/src/app/control-ui-chunking.test.ts --maxWorkers=1: 5 pass, 12.69 s; grouped route styles and optional-code exclusion. Its fixture now uses remaining shared boot styles, and no longer requires a fully tree-shaken debug contract in the source-map inventory.
  • Rebase proof: regenerated the manifest after the New Session migration, reran the production bench and strict performance gate (chat/New Session 30/27), reran the request-boundary e2e (39.23 s) and chunking unit file (5 pass, 10.25 s). Later integrated main commits do not change the UI source. The resolved generated manifest also received scoped-clean Codex review through P2.
  • Scoped formatting and git diff --check pass. Independent Codex review completed scoped-clean through P2 before commit.
  • CI correction: the initial run 38347873255 exposed three test synchronization assumptions. The sidebar visibility test now waits for native intersection records for all 11 current running rows (including paired-avatar traces); 2 pass in 9.76 s. The loaded-Inbox latency test explicitly opens/closes the lazy surface before its next-frame checks; 2 pass in 28.64 s. The native-update authority test waits for the opened panel before its helper can toggle it again; all 6 mock-bridge authority cases pass in 36.95 s. Existing visibility, next-frame, and authority expectations are preserved. Only the failed files were rerun locally, and the combined correction passed scoped-clean review through P2.

Current head: ad58e516349c169b5c85afe128161f71865c9c45, rebased onto main 3b01cee14cfe. pnpm install --frozen-lockfile passed, the boot manifest was regenerated, and independent review completed scoped-clean through P2. Main's stronger native-intersection test synchronization supersedes this PR's earlier visibility-test fix.

Post-rebase production build: chat boot JS 5,172,047 B raw / 1,604,116 B gzip, 30 requests; New Session 4,197,243 B raw / 1,303,502 B gzip, 27 requests. pnpm ui:check-performance passes with no violations. The before/after table above records the earlier controlled pair; these current-head totals include subsequent main changes.

The earlier inherited sidebar cold-load regression is fixed on main by #170708. On this head, sidebar-cold-load.e2e.test.ts passes both tests in 30.15 seconds of Vitest time. Full-suite AWS proof and exact-head CI results follow below.

CI run 38361059897, on exact head ad58e516349c169b5c85afe128161f71865c9c45, completed with 40 successful jobs, three failed UI e2e shards, and their dependent gate failure. Every failing CI case reproduces on pinned base 3b01cee14cfe on the same AWS box. No CI rerun or update-branch was used to chase these inherited failures.

Full UI e2e proof on AWS Crabbox cbx_f0f792acb0e7, run run_b77f34a20b80a2795a59a7ddeab08685:

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --reporter=default --reporter=json --outputFile=<head-report>: 754 files passed, 6 failed, 1 skipped; 3,373 tests passed, 7 failed, 1 skipped. Vitest duration 6,716.60 s. The skipped file is native desktop resize on Linux.
  • Replayed all six failed files from an exact source archive of base 3b01cee14cfe on the same lease, with its own frozen dependency install and build: 8 tests passed, 6 failed in 318.68 s. Six head failures reproduce with the same assertions; the activity chunk's generated filename differs between builds.
Failed file Head failures Base failures Classification
chat-collapsed-reply-reveal.e2e.test.ts 1 1 Inherited screenshot timeout after earlier-message reveal
chat-header-subagents.e2e.test.ts 1 1 Inherited Details-dialog timeout
chat-position-rail.e2e.test.ts 2 2 Inherited dark/light reader-position timeouts
chat-reply-preview-recovery.e2e.test.ts 1 1 Inherited source-navigation click timeout
control-ui-stale-build-reload.e2e.test.ts 1 1 Inherited assertion that the activity chunk has not loaded
model-api-keys.real-gateway.e2e.test.ts 1 0 Full-run CLI refresh warning; not reproduced in focused base or head replay

The API-key result is not claimed inherited or fixed. After base passed, the only additional test run was that failed file on the unchanged head, using the same AWS lease: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts ui/src/e2e/model-api-keys.real-gateway.e2e.test.ts --maxWorkers=1. It passed in 60.236 s command wall time (run run_2451c52f90324ebe4ddcbdf0c10902f3). Its full-run CLI refresh warning remains a follow-up; no timeout or expectation was weakened. The remote checkout was verified clean at the exact head after replay.

All touched-area e2e cases pass in the full run, including sidebar cold load (2), Inbox latency (2), native-update authority (6), mobile sidebar menus (6), attention scope (1), and the new boot-import regression (1). The boot-import case took 5.32 s in the full run. Final-head chunking units also pass 5/5, 7.26 s command wall time. Initial-connect splash, optional boot requests, and real-Gateway chat-loading performance pass.

Both owned AWS leases were stopped. The earlier lease cbx_e91aee69ee8e failed workspace adoption before dispatching tests; it supplied no test proof. The PR remains ready, open, and unmerged. The remaining lead handoff is the inherited UI failures and the non-reproduced API-key CLI refresh warning.

Production LOC delta (git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*'): 41 insertions, 76 deletions, net −35 lines across six files, including the generated manifest and test routing config. Implementation itself is 1 insertion, 6 deletions. The standalone-test classification avoids an unused production build for the source-server regression.

Release-note context: reduce Control UI chat reload JavaScript by keeping closed Inbox and sidebar popup renderers out of boot.

Before: synthetic settled dashboard

After: synthetic settled dashboard

@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-13T07:16:51.992403Z ad58e51 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 force-pushed the steipete/coldload-boot-js-composition branch from e53d000 to ad58e51 Compare October 13, 2026 07:10
@steipete
steipete merged commit 9c4b1a9 into main Oct 13, 2026
110 of 115 checks passed
@steipete
steipete deleted the steipete/coldload-boot-js-composition branch October 13, 2026 09:37
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
Chat boot JS fell ~100 KB raw / ~25 KB gzip (preload hints 31 -> 30); production -35 LOC. Performance budgets pass; sidebar cold-load e2e passes.

Admin-merged over inherited UI e2e failures: every failing CI shard reproduced on the PR base (full AWS suite: 3,373 passed; 6 of 7 failures reproduce on base 9100051, the 7th was a non-reproducing CLI refresh warning). Evidence in the PR body.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant