Skip to content

perf(ui): defer optional chat boot modules - #179491

Merged
steipete merged 6 commits into
mainfrom
solid2/w-perf-boot-4
Oct 21, 2026
Merged

steipete merged 6 commits into
mainfrom
solid2/w-perf-boot-4

Conversation

@steipete

@steipete steipete commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #178054

What Problem This Solves

Text-only chat boot downloads about 1.50 MB of JavaScript, including media players and optional status surfaces that are absent from its first paint.

User Impact

Chat boot now downloads 1,440,577 B gzip, 58,351 B less than the same-machine base and below the 1,445,000 B target. Startup and New Session also shrink. Optional surfaces load when needed; the transcript and composer remain mounted while they load.

Why This Change Was Made

Use Solid 2 lazy() with local Loading boundaries for message media, attachments, widgets, recommendations, approvals, queue/progress UI, suggestions, and mobile activity pills. Empty collections do not load their renderers. Swarm loads only when the selected parent has groups; mobile activity loads only when a pill is visible, using the same visibility predicates as their renderers. Chat, pending New Session messages, and Activity share the media boundary. Queue recovery still renders an edited source after it leaves the visible queue.

Regenerate the measured boot manifest. Avoid redundant target preloads for JavaScript-only dynamic imports: native import() immediately requests that target. CSS-bearing imports retain target preloads so the stylesheet wait does not postpone their download. This removes generated preload-table overhead without combining independent feature chunks.

Evidence

Paired production builds on the same Mac, base de08be26aadd9cfaa113bce5ded557668ad23459 after integrating the startup-budget restoration, with the strict performance checker and no budget changes in this PR:

Shipped gzip bytes Base Head Change
Startup JavaScript 323,944 322,753 -1,191
Chat boot JavaScript 1,498,928 1,440,577 -58,351
New Session JavaScript 1,020,971 1,018,647 -2,324
Startup CSS 40,501 / 1 request 40,501 / 1 request 0
Chat boot CSS 150,794 / 8 requests 147,408 / 8 requests -3,386

The final-head CI performance job also passes on tested merge c5b5ff7a2c49b757d3be0155e43b63cb69fcbd13 (base 4f1d233068b74e18eeb571496c368af7cde762ad, PR head 51f8df6): chat boot 1,496,670 → 1,439,247 B (-57,423 B), New Session 1,019,795 → 1,017,276 B (-2,519 B), startup 323,667 B with one CSS request. These are a separate Linux pair with newer-main inputs.

Both integrated builds pass the strict performance checker. Chat is 4,423 B below the requested 1,445,000 B target. Chat JavaScript requests rise from 25 to 26, within the 27-request cap, in exchange for removing 58,351 B from first paint. Startup remains at eight JavaScript requests and one CSS request.

pnpm tsgo:ui, focused lint, formatting, and git diff --check passed. The iframe-retention tests (3 cases), reconnect-recovery test, and focused Vite build test file (13 cases) passed. The emitted initial chunks contain 24 redundant JavaScript-only target preloads on base and zero on head. pnpm deadcode:knip passed on the original production head. On the integrated, empty-state, and final type-only heads it reports the same three unused heartbeat/cron files: src/cron/heartbeat-monitor.ts, src/cron/system-monitor-jobs.ts, and src/gateway/server-cron-system-jobs.ts. Scheduled main run 39608923095, job 119252570121, head bedbf6761e085133eb03badab3d116e0e33343de (an ancestor of the paired baseline), reports exactly those three files in both production Knip 6.40.0 and its independent unused-file scan. No new ignored files or dependencies were added. Independent Codex autoreviews of the production change and CI repair batch are scoped-clean through P2. A final test-only correction scopes an authored-paragraph assertion separately from loaded audio-player text, retaining the whole-transcript check against leaked MEDIA directives. ci:full requests all UI unit, Control UI E2E, browser-extension, and real-Gateway shards; the new browser regression runs there.

CI repairs preserve the original assertions while awaiting cold imports. Four real-Gateway fixtures also dropped the obsolete agents.defaults.heartbeat field removed in #179387; their harnesses already disable cron. Both real-Gateway shards passed on subsequent heads. Empty-state tests cover absent → visible → absent Swarm/mobile activity while retaining textarea identity, draft, caret, and focus. Two type-only Madge cycles were removed by moving unchanged prop contracts into leaf modules; typechecking and Madge pass with zero cycles.

Focused local proof across implementation and repairs includes 411 passing tests across 19 files, six Chromium layout cases, and 13 Vite build cases. A local MCP capability-change test timed out during cold widget imports; all UI unit shards subsequently passed on integrated head c1e888e01bb1f9d2291099c5912f242845fc031a and runtime head cfc5194c86b1b5052c136cae95f945ba0503970b. That remains a local setup gap, not inherited-CI evidence. Pinned Bun is retained; filesystem/transpiler caches were disabled after a sampled external-SSD renameat stall. A Vite test attempt waited on the concurrent build's artifact lock; the two affected cases passed in one serial run afterward.

The preceding head 5fe4645aedbcf32bb33331658f1d190940223976 passed performance, architecture, both real-Gateway shards, and two UI unit shards in run 39631839190. Its cold inline-approval unit failure is repaired by awaiting vi.dynamicImportSettled() before committed-DOM assertions; both focused footer tests pass. Its three E2E failures match the exact names and assertions in scheduled main 39626840495: agent-page scope (belowCard), compact identity menu (clipping), and native-nav sidebar toggle (box shadow). Replacement head: 51f8df61639407ac5463715e4506fe310be8eb72. Its completed full CI run 39641623206, attempt 1, passes all three UI unit shards, both real-Gateway shards, performance, architecture, security-fast, and eight of nine UI E2E shards. Prior-head results are not claimed for this head.

The pending-media repair removes route-sized skeletons from message-local Loading boundaries. Its browser regression holds the actual emitted renderer request, verifies authored text and the focused draft remain visible without a route skeleton, then releases the request and confirms the image renders with draft/focus intact. The independent repair review is scoped-clean through P2; final source-integrity verification completed successfully. The inspected synthetic before/after capture reduces the pending message from 566 px to 43 px, with zero route skeletons, no browser errors, and draft/focus preserved before and after image arrival. The final production build and strict checker both pass.

The synthetic production capture uses a valid empty configuration. Before: image rendering code is already fetched for text-only chat. After: the text transcript is ready before media code is fetched; delivering an image loads and renders it while preserving composer focus. Both captures have no browser errors. Screenshots below contain synthetic data only.

Touched production LOC against the integrated base: 5,645 → 5,820 (+175); tests: 16,344 → 16,613 (+269); generated manifest: 2,011 → 1,967 (-44). Added production lines express local loading boundaries and their shared typed media entry point; no domain state owner or renderer was duplicated. Solid refactor census is unchanged: 3 effects, 2 untrack calls, and zero rendering controllers, render effects, direct listeners, DOM queries, flushes, or owner escapes in the touched production components.

Historical attribution and measured savings

A second paired build of #178054 (2e602936e5f24ffc39554ba7a15e2e4bc70f939c) measured chat boot at 1,435,744 B, within 71 B of that PR's recorded value. Growth to the original base 173309b3fe903b7d4c99ef87a829dde679d99bd7 (1,500,965 B) is 65,221 B. Startup grew 6,713 B and New Session grew 17,700 B over the same interval.

Source maps show +198,173 mapped raw bytes across the chat boot graph. The rows below assign shared paths to the latest of the six named feature commits. They are source-group attribution between the paired builds, not six isolated per-commit builds. Isolated-module gzip is non-additive; shipped chunk totals above decide acceptance.

Source group Mapped raw delta Isolated-module gzip delta
Responsive headers/details #176653 (1894bb9b0a5) +57,514 +18,713
Panel frame #176356 (fb0ad93d014) +17,881 +5,213
Review controls #176349 (608a46761d4) +1,243 +613
File reader #176339 (9e2c766d84a) +1,904 +739
Workspace catalog #176326 (f15f221a533) -7,424 -2,167
PR details #176424 (33b16c7ef87) -37,337 -12,543
Solid runtime +13,242 +6,079
English copy +28,132 +10,874
Other modules +123,018 +42,068

Other large new eager modules include activity pills (#176378), mobile session menus (#176363), desktop subagents (#176347), sharing menus (#176398), and creator review (#173377). Runtime growth includes rc.16 (#179116) and action/lifetime activation (#179115). The PR-details lazy cut offsets part of the other growth.

The media/status boundaries alone saved 59,033 B of chat boot. Completing the Activity media boundary and removing redundant target preload entries saved another 2,832 B, for 61,865 B against that original base. After the main merge, owner-generated manifest refresh, empty-state guards, and pending-media repair, the final paired saving is 58,351 B. The empty-state repair saves another 1,312 B against the preceding integrated head. The first cut's 216 B startup increase came entirely from generated preload metadata; the final build removes that increase and saves a further 1,324 B against base.

Before: text-only chat with composer focus

After: identical text-only chat with deferred media code

Before: synthetic image delivered to the transcript

After: identical image with composer focus retained

Pending-media repair: inspected before/after screenshots. Both images are confirmed rendered in the PR comment.

Final CI attribution

The only failed root job is UI E2E 8/9. Both failing names and assertions match the latest completed scheduled main run 39635924183, verified again before admission:

Exact failing case PR assertion Matching scheduled-main evidence
compact identity menu > keeps common actions visible with nine native gateways and opens an unclipped keyboard switcher Expected false to be true (clipping) job 119346775261
Control UI native-nav sidebar toggle E2E > hosts navigation, search, sessions, and history in web titlebar chrome Expected none not to be none (focus box shadow) job 119346775328

The CI gate is red only because of this job. The two test files and layout styles are unchanged between CI's main parent and tested merge. The native inherited-failure route is selected with retained logs, exact run/head/attempt, checkout object, and artifact hashes. No PR-caused failure is waived. Native auto admission declined the red gate before creating an intent; no auto request was armed or cancelled.

Load media and optional status surfaces through local Solid loading boundaries, sharing media admission with Activity and pending New Session messages. Remove redundant JavaScript-only target preloads while retaining CSS-dependent preloads.

Same-machine builds reduce chat boot from 1,500,965 to 1,439,100 B gzip, startup by 1,324 B, and New Session by 2,498 B. Preserve transcript identity, queue recovery, and composer focus.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 21, 2026
@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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 🔄 Running since 2026-10-21T17:10:04.105534Z 51f8df6 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.

@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: be37651c7a

ℹ️ 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/src/pages/chat/chat-view.tsx Resolved
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 21, 2026
Preserve media, queue, progress, focus, and permission assertions across lazy rendering. Back the boot image event with authoritative fixture history and remove four retired heartbeat settings from real-Gateway fixtures.

@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: 19c4b39bd4

ℹ️ 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/src/pages/chat/chat-view.tsx Resolved
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 21, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 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: 5fe4645aed

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

@steipete

Copy link
Copy Markdown
Contributor Author

The message-local media fallback now stays empty while its lazy renderer loads; authored text and the composer remain visible. A held renderer request reproduces the old route-sized skeleton (566 px message) and verifies the repair (43 px), then releases the image and checks draft/focus retention. Both captures are synthetic-only, inspected, and have no browser errors.

Before: route-sized skeleton inside a pending media message

After: authored text and focused draft remain while media loads

@steipete

Copy link
Copy Markdown
Contributor Author

The pending-media fallback is fixed in 51f8df6. The delayed-renderer regression preserves authored text, draft, focus, and eventual image rendering; inspected before/after proof is linked in the current PR body. The final strict production measurement is 1,440,577 B chat boot gzip, down 58,351 B against the paired base.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 96dc080 into main Oct 21, 2026
112 of 115 checks passed
@steipete
steipete deleted the solid2/w-perf-boot-4 branch October 21, 2026 18:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
* perf(ui): defer optional chat boot modules

Load media and optional status surfaces through local Solid loading boundaries, sharing media admission with Activity and pending New Session messages. Remove redundant JavaScript-only target preloads while retaining CSS-dependent preloads.

Same-machine builds reduce chat boot from 1,500,965 to 1,439,100 B gzip, startup by 1,324 B, and New Session by 2,498 B. Preserve transcript identity, queue recovery, and composer focus.

* test(ui): await deferred chat surfaces in consumer tests

Preserve media, queue, progress, focus, and permission assertions across lazy rendering. Back the boot image event with authoritative fixture history and remove four retired heartbeat settings from real-Gateway fixtures.

* perf(ui): skip empty chat status renderers

* fix(ui): remove chat status type cycles

* fix(ui): keep pending media inside message boundaries
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. clawsweeper:intake:feature Preliminary submission classification; full source review pending. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant