Repository navigation
perf(ui): defer custom theme import to settings - #130710
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Final verification for fe66623 is complete. Exact-head CI passed, including build-artifacts. Hosted startup JavaScript measured 341,297 bytes gzip in 8 requests, leaving 2,145 bytes below the unchanged 343,442-byte ceiling. Root and two independent scoped reviews found no actionable source issue. The existing lazy ConfigPage owns external import work; saved palette validation and immediate CSS restoration remain eager. The preserved runtime bodies, emitted chunk placement, and controlled local measurements establish actual code movement, not a metadata/hash reroll. Production is +324/-314 (net +10 for the static module boundary), tests +46/-8. Total all-chunk gzip increases 1,128 bytes from compression placement, as disclosed in the PR. Local verification passed 97 owner/settings/bootstrap tests, three candidate Chromium scenarios, the same import/retry/reload scenario on immutable base, all 19 changed-file checks, and one separate real unauthenticated public theme import. Browser Gateway/theme responses are mocked; the independent public importer request is real. Baseline/candidate saved-theme screenshots are attached in the body and are byte-identical. Structured Codex autoreview reported no P0 findings; its threshold is not an all-priority review claim. The focused test commands used the saved, single-worker UI configurations through env -u OPENCLAW_TESTBOX OPENCLAW_VITEST_MAX_WORKERS=1 RAYON_NUM_THREADS=2 node scripts/check-changed.mjs --timed --base HEAD --head HEAD -- ui/src/app/custom-theme.test.ts ui/src/app/custom-theme.ts ui/src/e2e/appearance-settings-defaults.e2e.test.ts ui/src/pages/config/config-page.custom-theme.test.ts ui/src/pages/config/config-page.ts ui/src/pages/config/custom-theme-import.tsThe latest ClawSweeper comment remains a review-started placeholder; it contains no findings or Rank-up moves to address. No published finding is being skipped. The separately reproduced lazy Retry/storage/lifecycle defects remain a separate repair and do not broaden this sealed change. Proceeding through native prepare/merge. |
|
Codex review: found issues before merge. Reviewed August 27, 2026, 1:26 AM ET / 05:26 UTC. ClawSweeper reviewWhat this changesThe PR moves custom-theme URL importing into the lazy Appearance Settings bundle while leaving saved-theme validation and style restoration in the startup bundle. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep this maintainer PR open: the lazy import split is sound, but the branch also removes the existing reduced-motion guard from two Settings scroll paths, reintroducing a current-main accessibility regression. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherControl UI startup reads saved settings and restores a selected custom theme immediately. The lazy Settings route loads the Appearance page, where a user can import a theme URL and persist the resulting palette. flowchart LR
A[Control UI startup] --> B[Saved theme validation]
B --> C[Theme CSS restoration]
D[Appearance Settings route] --> E[Lazy Config page]
E --> F[Theme URL importer]
F --> G[Validated palette persistence]
G --> B
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +10, Tests +38. Total +48 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the lazy importer boundary, but restore the shared reduced-motion resolver at both Settings scroll call sites and cover those callers under a reduced-motion media query. Do we have a high-confidence way to reproduce the issue? Yes, from source: with matchMedia('(prefers-reduced-motion: reduce)') true, each changed literal smooth call bypasses the current resolver that returns auto. Is this the best way to solve the issue? No: the importer move is the right owner boundary, but removing the unrelated Settings motion-policy calls is not required for it and regresses current behavior. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 95c318669520. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Control UI startup eagerly loaded the custom-theme URL parser, network importer, and external token conversion, even though only the lazy Appearance settings page uses them. Startup sat at the committed performance ceiling, making unrelated PR builds fail as embedded build metadata and chunk hashes changed.
This moves import-only work into the existing lazy ConfigPage boundary. Saved palette validation and CSS restoration remain on startup, so an already selected custom theme still appears immediately.
Why This Change Was Made
The existing
app/custom-theme.tsowned two different lifetimes: restoring browser-local theme state at boot and importing an external theme on demand. ConfigPage now directly imports its owncustom-theme-import.ts; the eager owner exposes only the shared validation primitives it needs. The old importer path is removed, with no forwarding wrapper, new dynamic import, dependency, configuration option, or compatibility branch.Independent AST review confirms the existing function bodies and constants were preserved. The 200,000-byte response cap, 10-second timeout, redirect policy, CSS/font validation, token order, cancellation, and stale-owner handling are unchanged. Production is +324/-314, net +10 lines, solely for the module/import boundary; tests are +46/-8, net +38. No performance budget, generated boot manifest, translation baseline, or changelog change.
User Impact
The initial Control UI download no longer includes theme import work that is only needed in Settings. Import, retry, clearing a pending import, newer server selections, and saved-theme restoration retain their behavior.
With identical build identity, Node 26.7.0 and the pinned UI dependency closure, including Pako 3.0.1:
The existing 343,442-byte ceiling is unchanged. Startup falls by 6,476 raw bytes and 2,139 gzip bytes. A second build with current branch metadata measured 341,318 gzip bytes. This is a startup optimization: total gzip across all JavaScript chunks increases by 1,128 bytes because compression boundaries change; total JavaScript requests remain 338.
Evidence
The screenshots below come from separate baseline and candidate browser runs. They are byte-identical after reloading the saved fixture palette, demonstrating preserved appearance rather than a visual redesign. No personal data, operator state, or credentials are included.
Before:
After: