Repository navigation
improve: reduce Control UI startup below 295 KB - #181556
Conversation
Keep small startup icon and update classification contracts in leaf modules. Move page-only English behind existing lazy consumers, preserve shared namespace identities, and install each catalog once. Add startup module attribution and shell-interactive timing evidence; ratchet measured startup to 294964 B gzip.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32e8318483
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs changes before merge. What this changesThis PR reduces Control UI startup downloads by extracting small shared helpers and loading optional English catalogs with their consumers. Example: Cold-load the production Control UI.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 4 items remain Keep this PR open: the startup reduction is useful and maintainer-directed, but the patch breaks PR-wrapper provisioning, misses one English consumer, and leaves two catalog test contracts failing. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe browser loads the Control UI shell, then route and interaction modules register English fallback copy; shared update classification also serves CLI, Gateway, and maintainer tooling consumers. flowchart TD
A[Browser request] --> B[Startup shell]
B --> C[Small shared helpers]
B --> D[Lazy route modules]
D --> E[English catalog registration]
E --> F[Shared translation owner]
F --> G[Rendered labels]
Technical reviewBest possible solution: Retain the measured extraction approach, complete browser-card registration and wrapper packaging, and adapt the affected tests to cold catalog lifetimes. Do we have a high-confidence way to reproduce the issue? Source establishes the unregistered historical post-card path, and exact-head CI records the wrapper and catalog-test failures; no local runtime reproduction was run. Is this the best way to solve the issue? Small leaf extractions and the existing catalog owner are appropriate, but the cutover must include extraction inventories, every independent consumer, and tests that reset catalog state. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fc33b62c61cf. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. 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 Reviewed October 23, 2026, 6:24 AM ET / 10:24 UTC. |
|
All four findings on
Fresh full CI run 39940155714 has passed all four previously failing jobs. Other shards are still running. The final build is 294,961 B startup JS gzip with seven JS requests and one CSS request. The PR also records the local APFS provisioning timeout and the invalidated source-integrity check; that local invocation is not claimed clean. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* perf(ui): defer optional startup catalogs and error helpers Keep small startup icon and update classification contracts in leaf modules. Move page-only English behind existing lazy consumers, preserve shared namespace identities, and install each catalog once. Add startup module attribution and shell-interactive timing evidence; ratchet measured startup to 294964 B gzip. * fix(ui): preserve shared tweet copy and startup proof closure
What Problem This Solves
The Control UI downloads optional English copy and full icon catalogs before its shell can become interactive.
User Impact
Startup JavaScript falls from 310,773 to 294,961 B gzip (−5.09%), reaching the 295 KB target with 7 JS + 1 CSS requests. Routes, copy, labels, and error/loading presentation stay the same.
Why This Change Was Made
Keep the three startup error glyphs and update outcome classification in small leaf modules. Load page, tool, media, session-menu, and connection-dialog English through their existing lazy consumers. Preserve the shared English object and nested namespaces. The existing catalog owner now installs each distinct catalog once: Chat wrapper installations fall from 88 to 15; New Session from 19 to 8.
Add startup to the source-mapped module attribution report and a shell-interactive milestone to the existing cold-load benchmark. Ratchet the startup baseline to the measured head.
Evidence
Performance acceptance (recorded before timing): compare production baseline b5b24cf with the candidate on the same Mac using scripts/bench-control-ui-cold-load.ts; 10 alternating cold-HTTP-cache pairs per profile, localhost and 100 ms simulated RTT. The shell milestone is the first animation frame with a visible, enabled sidebar navigation link. Accept median regression ≤5% with p95 no worse; extend to 20 pairs only for a timing cell outside that band. Startup target ≤295 KB gzip and ≤7 JS requests; keep one startup CSS request. Also report enabled-composer time and complete route bytes. Synthetic Gateway fixture; this isolates renderer/HTTP cost and does not measure real Gateway processing.
Both shell profiles satisfy the ≤5% median / no-worse-p95 band. Timings bind the committed implementation before the final CI repair: that repair restores one shared English label, changes no production function or import, and moves startup by −3 B (within 64 B build variance). The timing pairs were not rerun for that label-only correction. The remote profile sets both HTTP network latency and synthetic Gateway response delay to 100 ms. Host: 32 logical CPUs; one-minute load 23.7–29.5 for localhost and 17.3–22.8 for remote. Production bundles, untraced reloads, cold HTTP cache; no build or review ran alongside these final measurements.
Reproduce with
node --import ./scripts/tsx.mjs scripts/bench-control-ui-cold-load.ts --bundle-dir <base-dist> --compare-bundle-dir dist/control-ui --runs 20 --cold-http-cache --untraced --boot-route chat --face chat --latency-ms 0(remote:--network-latency-ms 100 --latency-ms 100). Size/attribution:pnpm ui:buildandpnpm ui:check-performance --json --module-attributionon base and head.Earlier diagnosis, before the install-once fix: two localhost batches pooled to shell 532.4 / 979.4 ms on base versus 604.6 / 1,006.3 ms on candidate; a counterbalanced batch was 645.0 / 970.5 versus 573.5 / 1,643.7 ms. Those failed latency acceptance. The first overlapped a source-review scan; all were retained, and the final revision was measured separately after removing repeated catalog work.
Validation: UI and tooling-test typechecks; focused icon, lazy-English and startup-attribution tests; all 10 current registration/consumer tests; touched-file lint and formatting; strict production asset budgets; production Knip. The once-only registration assertions fail on the old owner (2 calls) and pass on the fix (1 call). Full i18n verification and exact copy/order audits pass. Full exports Knip has the same 8 export and 5 type findings on base and head, outside this change; the package production files/dependencies command passes. Full
ci:fullrun 39940155714 completed successfully ona6dc2beb85d: 73 jobs passed, 23 skipped, including all UI E2E and real-Gateway shards. The first full run (39936816253) found four PR-caused failures: wrapper/provisioning import closure missed the extracted classification leaf; Settings cold-load tests cleared a once-installed catalog; Browser loading assertions assumed a now-lazy label; and all five tweet-card cases lacked the shared “Open post” button label. The repair adds the wrapper leaf, fixes catalog-lifetime test setup, and keeps that conditional tweet-card label eager. None is claimed as inherited. Local repair proof: 7 Browser/Settings cases, 19 eager-closure assertions and 16 provisioning assertions, i18n verification, and strict production asset checks; The local wrapper command was not clean: its last APFS multi-checkout case timed out (120 s limit; 310.6 s observed), and source-integrity verification caught the label edit during that command. No timeout/expectation was weakened, no repeat suite was run, and the exact-head hosted run is the final repair proof.Independent P0–P2 review is clean after repairing an SVG relative-path join caught by review. Startup/loading screenshots below are synthetic-only; the final loading-dialog images are pixel-identical to the base. No Testbox proof was used: the queued allocation was stopped and reconciled as completed/cancelled (run 39935711913).
Touched production UI: 33,717 → 34,314 lines in 114 files. Growth is mainly explicit lazy-catalog imports/registration plus retained namespace assignments; copy and icon path data move rather than duplicate. Solid guard counts are unchanged: effects 4, untrack 5, listeners 0, DOM queries 11, view cleanup 4, manual imports 4; flush/owner APIs 0.
Startup module inventory (every baseline module ≥2 KB standalone gzip)
Module-level startup attribution at b5b24cf. Sizes are standalone gzip of emitted source-map ranges and are non-additive. Shipped startup: 310,773 B gzip, 7 JS + 1 CSS requests.
ui/src/i18n/locales/en.tsnode_modules/@solidjs/web/dist/web.jsnode_modules/@solidjs/signals/dist/prod/store/store.jsui/src/app/app-root.tsxui/src/components/icon-data.tsnode_modules/@openclaw/uirouter/dist/index.jsui/src/components/icon-data-tools.tssrc/logging/redact-patterns.tsui/src/api/gateway.tsui/src/lib/sessions/index.tsui/src/app/bootstrap.tsui/src/app/gateway-store.tsnode_modules/@solidjs/signals/dist/prod/core/core.jsui/src/plugins/control-ui-runtime.tsui/src/app/settings.tsui/src/app-route-paths.tsui/src/lib/sessions/session-roster-refresh.tspackages/gateway-client/src/protocol-client.tsui/src/main.tsui/src/lib/sessions/session-mutations.tsui/src/lib/config/config-write-coordinator.tsui/src/components/tooltip-owner.tsnode_modules/@solidjs/signals/dist/prod/store/utils.jsui/src/app/overlays-updates.tsui/src/lib/sessions/session-reconciliation.tsnode_modules/@solidjs/signals/dist/prod/core/scheduler.jsui/src/lib/sessions/session-row-reconcile.tsui/src/lib/sessions/session-list-query.tsui/src/lib/config/config-gateway-operations.tsnode_modules/@solidjs/signals/dist/prod/store/optimistic.jsui/src/lib/config/config-draft-model.tssrc/shared/update-outcome.tsnode_modules/@solidjs/signals/dist/prod/map.jsui/src/lib/channels/index.tsui/src/components/overlay-registry.tsnode_modules/@solidjs/signals/dist/prod/core/lanes.jsui/src/app-navigation.tsui/src/app/server-prefs.tsui/src/app/stale-chunk-reload.tsui/src/app/exec-approval.tspackages/gateway-protocol/src/connect-error-details.ts