Skip to content

perf(ui): keep JSON5 out of chat boot - #174728

Merged
steipete merged 2 commits into
mainfrom
solid2/w-perf-boot
Oct 16, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-perf-boot

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat and new-session boot downloaded the JSON5 parser even though configuration parsing already has a lazy boundary. The build grouped JSON5 with Zod, which these routes need for snapshot validation.

User Impact

The measured chat boot preload graph shrinks by 7,294 B gzip and the new-session graph by 7,290 B, with the same request counts and CSS. JSON5 loads when a configuration consumer warms it, rather than through snapshot validation. Initial startup stays at 7 JavaScript requests and one CSS request. The startup ceiling is tightened from 374,285 B to 342,000 B, about 2 KB above the measured result.

Why This Change Was Made

Give JSON5 its own chunk so only consumers that warm the parser load it. Remove the obsolete Lit decorator chunk rule and replace its retired fixture with an emitted-import regression test. Regenerate the measured cold/warm boot manifest to pick up the two renamed sidebar owners and remove the retired controller host. Route ownership, parsing, and rendering behavior stay with their existing owners.

Evidence

Both production builds used the same machine, installed toolchain, fixed build identity, and the strict performance checker. Base: 9fa4e5618912d5f866670108214b5a5ca5e1fa3b.

Metric Base Head
Startup JS gzip 340,081 B 340,058 B
Startup JS requests 7 7
Startup CSS requests 1 1
Startup CSS gzip 38,784 B 38,784 B
Chat boot JS gzip 1,652,404 B 1,645,110 B
Chat boot JS requests 30 30
New-session boot JS gzip 1,346,844 B 1,339,554 B
New-session boot JS requests 27 27
  • pnpm ui:build: base and final generated-manifest head pass.
  • pnpm ui:boot-manifest:gen: cold/warm synthetic /new and /chat captures pass; generated manifest changes two owner paths and removes one retired host entry.
  • Strict ui:check-performance with the base distribution: passes, zero violations.
  • pnpm tsgo:ui: passes.
  • Chunking tests on the final manifest: 6 pass, 2.71 s suite time (5.28 s wrapper wall time). The regression inspects emitted static and dynamic imports and would fail with the combined parser/validator chunk.
  • Performance-budget tests: 24 pass, 36.35 s suite time (74.82 s wrapper wall time).
  • Targeted lint and formatting: pass.
  • Production Knip on the final manifest: passes, no unused files or dependencies (6m 35s wall time).
  • Independent Codex reviews of the code and generated-manifest delta: no actionable findings (P0–P2); local builds/captures provide the measured evidence.

No rendering or stylesheet changes; screenshots are not applicable. Final-head ci:full run 38978074694 passed on f3c5571f81e7f81ad79b718bd40e4f75904ae5cd, including the full UI selection. The preceding head had the same optional-hover-runtime test failure as scheduled main; final-head CI is green, so no inherited-failure exception is needed.

Refactor checklist, touched production files Before After
Controller patterns 0 0
createEffect / createRenderEffect 0 / 0 0 / 0
untrack 0 0
Native listeners / DOM queries 0 / 0 0 / 0
Manual class strings / flush 0 / 0 0 / 0
Owner capture 0 0
Production TypeScript LOC 1,029 1,025
Generated boot-manifest LOC 2,688 2,687
Test LOC 250 247

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 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 16, 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-16T22:01:55.525944Z 83455ac PR opened
ℹ️ 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 scripts Repository scripts size: S labels Oct 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83455acd28

ℹ️ 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".

Comment thread ui/config/control-ui-chunking.ts Resolved
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR separates JSON5 from eagerly needed validation code and tightens the Control UI startup JavaScript budget.

Example: A browser opens Chat without visiting configuration settings.

  • Before: JSON5 shares Zod's chunk; reported Chat boot JavaScript totals 1,652,404 B gzip.
  • After: JSON5 has a deferred chunk; reported Chat boot JavaScript totals 1,645,110 B gzip with the same request count.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused optimization has useful build evidence and sound ownership, but the generated capture remains inconsistent and browser behavior was not directly shown.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body supplies same-machine production-build measurements and targeted validation, without a browser runtime capture.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Chat and New Session download a configuration parser they do not need during boot.
Reason: The existing lazy boundary supports this small optimization, and the maintainer-authored PR supplies direction for both the split and the tighter budget.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored PR provides a useful loading improvement, but its generated boot manifest must be refreshed before merge.

Priority: P2
Reviewed head: 83455acd28af52e846216525ea7792fe6ba7bf62

Before merge

  • Regenerate the boot manifest after separating JSON5 (P2) - This split changes which modules belong to boot, but ui/config/control-ui-boot-modules.json still records node_modules/json5/dist/index.mjs in shared boot membership. The priority-20 rule currently keeps that stale membership from assigning the parser to the shared chunk, so this is not a demonstrated failure of the present split; it leaves the generated build input inconsistent with the changed loading graph. ui/AGENTS.md:82 explicitly requires regeneration for material boot-path changes. Run pnpm ui:boot-manifest:gen, commit its generated result, and rebuild to verify the grouped output.

Findings

  • [P2] Regenerate the boot manifest after separating JSON5 — ui/config/control-ui-chunking.ts:121-123

Tests

  • Missing end-to-end proof: The supplied evidence reports production-asset measurements and emitted-import tests, rather than a browser cold-load network capture.
Agent review details

How this fits together

Vite chunk rules turn UI imports and measured boot-module membership into browser assets; Chat needs Zod for snapshots, while configuration consumers warm JSON5 separately.

flowchart TD
  A[UI source imports] --> B[Vite chunk rules]
  C[Generated boot manifest] --> B
  B --> D[Chat and New Session assets]
  B --> E[Deferred JSON5 asset]
  D --> F[Snapshot validation with Zod]
  G[Configuration consumer] --> E
Loading

Technical review

Best possible solution:

Keep the focused dependency split and approved budget reduction, with the generated boot capture refreshed to match.

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

Current main groups JSON5 with eagerly needed Zod despite the parser's dynamic import, establishing the unwanted loading path without executing target code.

Is this the best way to solve the issue?

Separating the dependencies at the existing build owner addresses the loading cause without changing parser ownership or introducing another runtime path.

Full review comments:

  • [P2] Regenerate the boot manifest after separating JSON5 — ui/config/control-ui-chunking.ts:121-123
    This split changes which modules belong to boot, but ui/config/control-ui-boot-modules.json still records node_modules/json5/dist/index.mjs in shared boot membership. The priority-20 rule currently keeps that stale membership from assigning the parser to the shared chunk, so this is not a demonstrated failure of the present split; it leaves the generated build input inconsistent with the changed loading graph. ui/AGENTS.md:82 explicitly requires regeneration for material boot-path changes. Run pnpm ui:boot-manifest:gen, commit its generated result, and rebuild to verify the grouped output.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Combined Zod and JSON5 runtime chunk changes intended behavior with a stated reason (8bf4f7d: The original runtime-chunk split grouped both configuration dependencies together; this PR explains why snapshot validation now makes that grouping unnecessarily eager.)
  • Decorator helper isolation and regression fixtures changes intended behavior with a stated reason (cb801e8: A shared compiler helper previously pulled New Session into Chat; subsequent merged Lit retirement removed the relevant consumers, explaining removal of the obsolete rule and fixtures.)
  • Startup JavaScript budget changes intended behavior with a stated reason (6d1700c: The previous change restored the pre-transition budget; this maintainer-authored PR deliberately tightens it after further startup reductions while preserving existing allowances.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm ui:boot-manifest:gen
  • pnpm test ui/src/app/control-ui-chunking.test.ts --maxWorkers=1
  • pnpm ui:build
  • pnpm ui:check-performance
  • git diff --check

What I checked:

PR surface

Source -4, Tests -3, Docs +2, Other 0. Total -5 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 5 9 -4
Tests 1 17 20 -3
Docs 2 5 3 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 2 4 4 0
Total 6 31 36 -5

Labels

Label changes:

  • add P2: This is a bounded Control UI loading improvement with a focused generated-artifact correction.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a bounded Control UI loading improvement with a focused generated-artifact correction.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • 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 16, 2026, 6:41 PM ET / 22:41 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the boot-manifest finding in f3c5571. Ran the canonical generator's cold/warm synthetic New Session and Chat captures, committed its generated output, rebuilt, and reran the strict base comparison plus the six chunking tests. The generator updates the two sidebar owner paths and removes the retired controller host; no manifest entries were hand-edited.

The generator retains JSON5 in its conservative cold/warm union; that generated membership was left intact. The explicit stable chunk preserves the lazy loading boundary independently of membership in the generic boot groups.

The final measurements remain 340,058 B startup JS gzip, 1,645,110 B chat boot JS gzip, and 1,339,554 B new-session boot JS gzip, with 7/30/27 JS requests and one startup CSS request. Both local review passes are clean. Final-head ci:full run 38978074694 passed.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit abb1009 into main Oct 16, 2026
121 of 122 checks passed
@steipete
steipete deleted the solid2/w-perf-boot branch October 16, 2026 23:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* perf(ui): keep JSON5 out of chat boot and tighten startup budget

* build(ui): refresh measured boot module manifest
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. docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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