Repository navigation
perf(ui): defer optional chat boot modules - #179491
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
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: 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".
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.
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
|
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. |
|
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 |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* 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


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 localLoadingboundaries 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
de08be26aadd9cfaa113bce5ded557668ad23459after integrating the startup-budget restoration, with the strict performance checker and no budget changes in this PR:The final-head CI performance job also passes on tested merge
c5b5ff7a2c49b757d3be0155e43b63cb69fcbd13(base4f1d233068b74e18eeb571496c368af7cde762ad, PR head51f8df6): 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, andgit diff --checkpassed. 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:knippassed 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, andsrc/gateway/server-cron-system-jobs.ts. Scheduled main run 39608923095, job 119252570121, headbedbf6761e085133eb03badab3d116e0e33343de(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:fullrequests 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.heartbeatfield 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
c1e888e01bb1f9d2291099c5912f242845fc031aand runtime headcfc5194c86b1b5052c136cae95f945ba0503970b. That remains a local setup gap, not inherited-CI evidence. Pinned Bun is retained; filesystem/transpiler caches were disabled after a sampled external-SSDrenameatstall. 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
5fe4645aedbcf32bb33331658f1d190940223976passed performance, architecture, both real-Gateway shards, and two UI unit shards in run 39631839190. Its cold inline-approval unit failure is repaired by awaitingvi.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
Loadingboundaries. 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
untrackcalls, 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 base173309b3fe903b7d4c99ef87a829dde679d99bd7(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.
1894bb9b0a5)fb0ad93d014)608a46761d4)9e2c766d84a)f15f221a533)33b16c7ef87)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.
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:
compact identity menu > keeps common actions visible with nine native gateways and opens an unclipped keyboard switcherControl UI native-nav sidebar toggle E2E > hosts navigation, search, sessions, and history in web titlebar chromenonenot to benone(focus box shadow)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.