Repository navigation
perf(ui): defer New Session picker bodies and obsolete preload code - #180852
Conversation
Keep the New Session placement menu and mobile sharing options behind their first-use boundaries. Preserve idle pet loading instead of promoting it into route preloads. Add emitted-module attribution and compare production reloads using each bundle’s actual build identity. Ratchet the measured boot caps while retaining their relative headroom.
|
🦞👀 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: 2a9335035e
ℹ️ 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".
| <Errored | ||
| fallback={(error, retry) => <LazyViewError error={error()} onRetry={retry} inline />} |
There was a problem hiding this comment.
Recover stale picker chunks with a document reload
When a New Session tab survives a Gateway update and the user first opens Where afterward, the newly deferred chunk can reference an old hashed URL and fail to import; this fallback treats that as an ordinary render error and invokes only Solid's retry, so the button retries the cached failed import instead of loading the document that references the new chunk. This is especially visible when an unsaved draft blocks automatic stale-build recovery: the placement picker remains unavailable until the user manually reloads. Detect isStaleChunkImportError here and route Retry through retryStaleChunkReloadWhenReachable, as the mobile lazy boundary does.
AGENTS.md reference: AGENTS.md:L76-L77
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR defers New Session picker bodies, removes unnecessary preload work, and extends bundle measurement tooling. Example: Open New Session with Where, Project, and Checkout closed.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains This PR provides a useful, maintainer-approved loading improvement and fixes the prior stale-chunk finding, but an unmigrated ownership assertion now fails exact-head CI. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe Control UI renders placement triggers from existing draft owners, loads menu renderers on interaction, and uses generated boot manifests and build tooling to control initial asset delivery. flowchart LR
A[New Session page] --> B[Placement triggers]
B --> C[Retained lazy popovers]
C --> D[Picker renderers]
D --> E[Existing draft owners]
C --> F[Shared loading and recovery]
G[Boot manifest and Vite] --> A
Technical reviewBest possible solution: Retain the lazy boundaries and shared recovery, and migrate the combobox ownership assertion to the moved checkout renderer. Do we have a high-confidence way to reproduce the issue? Source inspection and the exact-head CI annotation establish the ownership assertion failure; no target code was executed during this review. Is this the best way to solve the issue? The existing Popover retention and draft owners provide the smallest coherent implementation, with only the consumer ownership assertion left unmigrated. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 013240515205. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +127, Tests +247, Docs +15, Other +211. Total +600 across 27 files. Added test files: 2. View PR surface stats
Review metrics
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 HistoryReview history (1 earlier review cycle)
Reviewed October 22, 2026, 6:21 PM ET / 22:21 UTC (Revision 2). |
|
The stale Where-picker recovery finding is fixed on the current head through the shared SessionPicker boundary. It distinguishes stale imports, uses the existing guarded reload owner with a current-open-picker check, and preserves ordinary retry for render errors. The PR body now includes the coordinator's timing acceptance, the complete grouped boot attribution, and the integrated proof and CI repairs. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…penclaw#180852) * perf(ui): defer optional chat and placement boot content Keep the New Session placement menu and mobile sharing options behind their first-use boundaries. Preserve idle pet loading instead of promoting it into route preloads. Add emitted-module attribution and compare production reloads using each bundle’s actual build identity. Ratchet the measured boot caps while retaining their relative headroom. * test(ui): exercise deferred picker and stable chunk fixtures * perf(ui): refresh boot budgets against current main * perf(ui): defer retained file draft review renderer * perf(ui): defer Claw review dialog body * perf(ui): keep panel renderers behind the sidebar boundary * perf(ui): refresh deferred chat boot modules * perf(ui): reuse the existing panel header action module * perf(ui): ratchet deferred session boot budgets * fix(perf): wait for pinned sessions in their current sidebar section * perf(ui): retain the original panel dependency order * perf(ui): defer project and checkout picker bodies * perf(ui): rely on native module preloading in supported browsers * perf(ui): keep this checkpoint focused on New Session loading * perf(bench): serialize full reload reports after measurement * fix(ui): recover stale New Session picker imports * test(ui): await opened lazy New Session pickers * style(ui): format lazy picker regression coverage * test(ui): follow lazy checkout combobox owner * perf(ui): ratchet chat boot cap against matched plugin inputs
What Problem This Solves
New Session loaded the closed Where, Project, and Checkout menu bodies before its composer was usable. The generated boot capture also promoted an idle pet decoration into the New Session preload. Startup additionally included Vite's modulepreload compatibility probe despite every documented supported browser implementing native modulepreload.
User Impact
New Session transfers less code before its composer is usable. Picker labels, search, focus, and retained content remain unchanged; the detailed picker content loads on first open.
Why This Change Was Made
Keep the existing state owners, tags, classes, visible triggers, and routes. Load each New Session picker body on first open and retain it across closes. Preserve Where search autofocus after its first import; Project and Checkout preserve their existing trigger focus. Keep the pet's existing idle loader. Share the picker error boundary; its Reload action uses the existing guarded recovery owner for stale chunks, checks that the picker remains open, and retains ordinary retry for other errors. Disable only the modulepreload polyfill; retain native preload links, dependency hints, and Vite's CSS waits. Safari 26.2+, Chrome 147+, and Firefox 150+ are the documented browser floor.
Conflict integration (
66ac6866a2d):mainnow owns bundle identity switching in the existing comparison helper; this PR retains that implementation and adds only cold-load comparison, readiness sampling, host-load recording, and compact timed-run output. The benchmark scripts typecheck after the merge.The performance checker now reports emitted, source-mapped module gzip attribution. The existing reload benchmark alternates production bundles using their actual embedded build identities and records visible transcript/composer readiness. Full diagnostic records are written after the timed run, rather than serialized twice by the preview-server process. Its pinned-session setup now uses the existing pinned sidebar section rather than an obsolete rail selector.
Evidence
The final integration merges
da8b252a70aca34d141bf26ae7c550095a143b72without replaying main. A stale side-effect import inchat-pasted-text.tspulled its optional renderer into boot; the renderer has no registration side effect, and its actual consumers already import it. Removing that import keeps the picker savings without adding Chat bytes. All six pasted-text component tests and the UI typecheck pass; the final P0–P2 independent review is clean.Both builds use the same Node 26.12.1/Vite 8.3.4/Pako 3.0.2 toolchain, fixed embedded build identity, and all 29 byte-identical consumed packaged-plugin artifacts across seven plugins. An unmatched initial base omitted extra packaged plugins and was rejected as comparison evidence.
The strict matched-base performance check has no violations or warnings. Chat's cap ratchets to 1,469,628 B with the same relative headroom; New Session retains its already-stricter 929,032 B cap. The existing stricter startup baseline remains unchanged. The approved timing below remains the checkpoint's ten-pair evidence; this integration adds no renderer behavior change. Fresh full CI is required on the integrated head.
Production Knip was run on the final head and pinned base. Both report the identical unused exports
MAX_PLUGIN_COMMAND_SCHEDULE_BYTES,createGatewayCronAgentJobRunner, and the four approval-presentation functions, plus typesXRefreshClaim,SessionCleanupSummary, andScheduledOccurrenceRun; the base has additional unused dependencies andPluginHookReplyDispatchResult. This PR introduces no new Knip finding. No ignores were added.Current complete-file LOC versus the pinned base: production UI 1,625 → 1,768; tests/support 3,038 → 3,288; measurement/tooling/docs 4,263 → 4,493; generated config 1,966 → 1,941. The small production increase is the shared retry/loading boundary and retained focus handoff around moved picker bodies. Refactor checklist: effect, untrack, direct listener, query, owner APIs and component cleanup remain zero; onSettled 2 → 4 and lazy 0 → 3.
Exact-head full CI run 39869745484 is complete. All jobs pass except the inherited
Native plugin UI ownership > loads without asset grants for auth:none and preserves canonical chat admission and view recoveryfooter expectations and the downstream gate. Its 72 normalized assertion log lines match the latest completed scheduled-main run 39865398397, with no additional failure signature. The entire styles tree and test/support files are unchanged between the CI baseline and tested merge. This uses the native inherited-failure route; failed CI is not relabeled green.Earlier checkpoint evidence
Same machine, identical packaged-plugin inputs. Baseline
c4fd27d76ca; candidate runtime sources82135bc170d(all 3,056 consumed local input files match byte-for-byte; embedded build commitc4fd27d76caplus the candidate source overlay).Strict performance checks pass without violations or warnings. Chat/New Session caps become 1,471,597 B / 928,864 B, preserving each surface's relative headroom over the measured base. The already-stricter startup baseline is retained. All ten packaged-plugin input files match; unrelated extra plugin artifacts in the primary checkout are excluded by using the matched proof checkout.
Local timing remains unqualified. The last ten alternating pairs on updated main measured transcript median 864.1 → 527.5 ms, p95 3,128.4 → 5,532.1 ms; one-minute host load reached 27.4. The pre-integration candidate
82135bc170dwas measured once on Blacksmith Testbox, allocated in 4.0 s without queueing: 4 available CPUs, 16 GB RAM, initial load 0.73. Across ten alternating cold-cache pairs, transcript median 572.65 → 593.40 ms (+3.62%), p95 899.90 → 729.20 ms (−18.97%); composer median 571.50 → 592.10 ms, p95 898.20 → 727.50 ms. The coordinator explicitly accepted this result: No measured rerun was performed. Setup-only attempts corrected the native sync identity check and fetched the missing exact base; all 26 changed source files were verified by hash before building.Acceptance: no startup growth beyond the 64 B build-variance allowance, seven startup requests, reduced New Session transfer, no Chat growth, and no real readiness regression in ten alternating cold-HTTP-cache Chat pairs. The coordinator accepted this checkpoint and set the future rule to median regression ≤5% with p95 no worse, or ten additional pairs bringing the result within that band. The committed 240-message workload uses persisted state per build, no profiler, and records host load. Readiness means visible-DOM animation-frame observation, not a compositor paint timestamp.
Earlier candidates that also deferred optional Chat/Claw content did not satisfy the timing rule. Their measurements are retained as failed experiment evidence; those production and test changes are fully removed. This checkpoint makes no claim to meet the campaign's 15% Chat target. The original top-30 attribution below identifies the remaining required Markdown/runtime/composer costs and the New Session imports removed by separate focused wins.
Commands:
pnpm ui:boot-manifest:gen;pnpm ui:build;pnpm ui:check-performance --module-attribution --base-dist <base> --json;node --import ./scripts/tsx.mjs scripts/bench-control-ui-cold-load.ts --bundle-dir <base> --compare-bundle-dir <head> --runs 20 --face chat --untraced --cold-http-cache --output <evidence>.Local proof: shared picker recovery plus Where 20/20; Project/Checkout picker files 30 tests with two focused fixture-wait repairs; performance checker 36/36 and attribution fixture 1/1; production Vite build tests 13/13; UI typecheck, targeted formatting/lint, and production
pnpm deadcode:knippass. Exact-head broad UI unit/E2E/real-Gateway proof runs withci:full.The stale-chunk review finding is fixed for all three pickers through the shared boundary and existing manual reload owner. The original CI repair opens the picker before inspecting its lazy content, gives the stylesheet fixture explicit membership, and retains a spy rather than an unbound method. The earlier catalog failure was fixed on main by #180742 and is incorporated. No inherited-failure exception is claimed without matching test-name evidence.
Scoped complete-file LOC: production UI 1,604 → 1,748 (+144); tests/support 2,772 → 3,012 (+240); measurement tooling/config/docs 4,231 → 4,474 (+243); generated manifest 1,972 → 1,951 (−21). Renderer changes mostly move existing bodies. The remaining growth supplies lazy loading/error boundaries, the delayed Where focus handoff, emitted-module attribution, and actual-bundle benchmark identity.
Refactor checklist across touched production UI: effects, untrack, direct listeners, DOM queries, owner APIs, and component cleanup remain 0 → 0;
onSettled2 → 4,lazy0 → 3. Domain owners remain plain TypeScript; the final integration only removes the stale Chat pasted-text renderer side-effect import.Inspected synthetic captures preserve Where search autofocus and all six Project/Checkout focus checkpoints. Project is pixel-identical; Checkout differs only in glyph rasterization within the same text bounds. These captures use the same New Session renderer source as the final candidate; the later polyfill and Chat rollback do not change their rendering inputs. The original module tables and Chat/Where captures remain below.
Complete Chat graph: all 1,750 modules by feature, first-paint necessity
Every mapped module appears once in these 93 groups. This uses the same measured
82135bc170druntime-source build as the table above. Standalone gzip is non-additive: group sums are diagnostics, not transfer savings. Source inspection includes the subsequently merged main changes.Coverage reconciles exactly: 4,336,425 mapped + 78,277 unmapped = 4,414,702 raw JS bytes (98.23% mapped). Independent mapped-module gzip sums to 1,747,025 B, plus 27,569 B for unmapped fragments; chunk dictionaries produce the authoritative 1,417,243 B shipped JS. The small entry and bundler runtime lack source maps. CSS is separate: 146,932 B gzip / 8 requests.
All groups above 10 KB were inspected at their owners. The next candidates are optional MCP surfaces, camera capture, workspace actions, closed menus, and unused English namespaces. Xterm, syntax highlighters and language grammars, math/diagram renderers, expanded tool output, detailed diff viewers, and A2UI renderer bodies are already outside this graph; their weight cannot be claimed as a new saving.
Module attribution: top 30 per boot graph, with first-paint necessity
Standalone module gzip is non-additive: each module’s emitted ranges are compressed alone, while actual transfer uses a chunk-wide dictionary. Shipped sidecar totals above are authoritative. Source-map coverage is explicit; missing maps and unmapped bytes remain in the report.
Chat — initial baseline top 30 (
082e55e28d3)ui/src/i18n/locales/en.tsnode_modules/markdown-it/dist/markdown-it.mjsnode_modules/markdown-it-emoji/lib/data/full.mjsnode_modules/entities/dist/generated/decode-data-html.jsnode_modules/dompurify/dist/purify.es.mjsui/src/i18n/locales/en-chat-session.tsnode_modules/@solidjs/web/dist/web.jsui/src/lib/chat/composer-draft-store.runtime.tsnode_modules/@tanstack/virtual-core/dist/esm/index.jsnode_modules/@solidjs/signals/dist/prod/store/store.jsnode_modules/remend/dist/index.jsui/src/pages/chat/chat-pane-render.tsui/src/pages/chat/components/chat-composer-view.tsxnode_modules/@zag-js/vanilla/dist/machine.mjsui/src/i18n/locales/en-chat-composer.tsui/src/i18n/locales/en-session-organization.tsui/src/components/icon-data.tsui/src/pages/chat/chat-pane-sidebar-view.tsxnode_modules/@openclaw/uirouter/dist/index.jsui/src/components/select-picker-view.tsxui/src/app/app-shell-view.tsxui/src/components/icon-data-tools.tsui/src/app/app-root.tsxui/src/i18n/locales/en-new-session-setup.tsnode_modules/@zag-js/menu/dist/menu.machine.mjsui/src/pages/chat/chat-view.tsxui/src/pages/chat/components/chat-composer-controls.tsxui/src/components/app-sidebar-render.tsxui/src/pages/chat/chat-pane-lifecycle.tsui/src/pages/chat/components/chat-transcript-projection.tsNew Session — initial baseline top 30 (
082e55e28d3)ui/src/i18n/locales/en.tsnode_modules/markdown-it/dist/markdown-it.mjsnode_modules/markdown-it-emoji/lib/data/full.mjsnode_modules/entities/dist/generated/decode-data-html.jsui/src/i18n/locales/en-chat-session.tsnode_modules/@solidjs/web/dist/web.jsui/src/lib/chat/composer-draft-store.runtime.tsnode_modules/@solidjs/signals/dist/prod/store/store.jsnode_modules/@zag-js/vanilla/dist/machine.mjsui/src/i18n/locales/en-chat-composer.tsui/src/components/icon-data.tsui/src/pages/new-session/composer.tsxnode_modules/@openclaw/uirouter/dist/index.jsui/src/components/select-picker-view.tsxui/src/app/app-shell-view.tsxui/src/pages/new-session/where-chip.tsxui/src/components/icon-data-tools.tsui/src/app/app-root.tsxui/src/i18n/locales/en-new-session-setup.tsnode_modules/@zag-js/menu/dist/menu.machine.mjsui/src/pages/chat/components/chat-composer-controls.tsxui/src/components/app-sidebar-render.tsxsrc/logging/redact-patterns.tsui/src/components/app-sidebar-rail.tsxui/src/components/app-sidebar-session-row-render.tsxui/src/api/gateway.tsnode_modules/ipaddr.js/lib/ipaddr.jsui/src/pages/chat/components/chat-effort-picker.tsxui/src/app/app-host.tsxui/src/components/solid/session-presentation.tsxCI repair
Run 39857859975 passed all nine Control UI E2E shards and both real-Gateway shards. Seven unit assertions in
target-controls-view.test.tsxandplacement-invalidation.test.tsxread closed or unresolved picker content. Updated those fixtures to open the real project picker and await visible content; all authorization, IME, and retained-DOM assertions remain. Both files now pass locally (11/11), UI typechecking passes, and the isolated P0–P2 repair review is clean. This test-only repair does not change the measured production inputs. The other UI unit shard ended without a failing assertion in its available log; the repair push supplies fresh full-CI evidence.Integrated main proof (7951d38 → 9a931a0)
The merge preserves main’s visible-name-only project search in the lazy body and removes its obsolete cloud menu
compactoption. UI types and 19 directly affected Project/Where tests pass; final integrated P0–P2 review is scoped-clean. The earlier seven CI unit failures were reproduced and fixed in the tests by opening/waiting for the actual lazy owner before inspecting content.Same-machine production builds and strict performance comparison:
Caps retain main’s relative headroom: Chat 1,471,508 B and New Session 929,032 B. Main’s canonical corrected startup baseline is retained. The original ten alternating timing pairs and the coordinator’s explicit acceptance above remain the runtime timing evidence; this merge changes the existing search contract and removes an obsolete presentation option, without changing the measured lazy boundaries. Exact-head
ci:fullremains required.Final formatting repair
Run 39862657859 reported the same formatting difference in
target-controls-view.test.tsxthrough both the lint and documentation jobs. Applied the repository formatter; the resulting change is whitespace and call wrapping only. The focused format check passes, and an isolated P0–P2 review confirmed identical execution order, branches, event payloads, and assertions. Production inputs and the measured bundles are unchanged.The same CI attempt also found the searchable-combobox ownership guard still pointing to
checkout-chip.ts. Updated that single path to its new lazy owner,checkout-picker-content.ts; the approved control set is unchanged. Both focused ownership-guard tests pass.