Repository navigation
perf(ui): defer optional transcript renderers and session copy - #182953
Conversation
Keep frame and basic stream rendering eager so an initial active run does not wait for another import round trip. Load independent work summaries, activity details, notices, and previews within their existing conditions. Keep transcript CSS consolidated and preserve synchronous domain owners. Local WIP evidence: chat boot shrinks by 42,859 raw and 12,217 gzip bytes against the starting base, with unchanged requests. The five-pair active run probe removes the original 133 ms lazy-frame regression. Focused stream, disclosure, and lifecycle tests and the UI typecheck pass. Final twenty-pair readiness and coverage measurements remain for the combined head after the preceding boot-diet change lands on main.
Keep the 25 labels needed by cold chat consumers in a small shared catalog. Existing lazy consumers retain the full catalog with identical values and property ordering.
|
🦞👀 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. |
|
Codex review: needs changes before merge. What this changesThis PR defers optional transcript renderers and session-management English copy while keeping answers and the composer eager. Example: Open Chat with ordinary messages and no browser previews.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open for focused repair: the measured boot reduction is useful, but existing UI tests assert before the newly lazy content mounts. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe Control UI projects Gateway transcript state into retained Solid rows; this change moves optional rendering code and English labels behind existing loading boundaries. flowchart LR
A[Gateway transcript state] --> B[Transcript projection]
B --> C[Retained row registry]
C --> D[Eager messages and answers]
C --> E[Optional lazy renderers]
F[Shared English labels] --> D
G[Management catalog] --> E
Technical reviewBest possible solution: Retain the focused deferrals and update affected test consumers to await mounted rows without weakening their behavioral assertions. Do we have a high-confidence way to reproduce the issue? Source shows eager optional imports on main and immediate DOM assertions in affected tests; exact-head CI confirms those assertions encounter empty deferred regions. Is this the best way to solve the issue? Conditional imports through existing boundaries are a proportionate optimization, and the extracted renderer and shared catalog retain their existing owners. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4c3bf18daa6c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +88, Tests +169, Docs +18, Other +281. Total +556 across 27 files. Added test files: 1. 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 Reviewed October 24, 2026, 6:14 PM ET / 22:14 UTC. |
Keep current main media-read admission on the extracted eager work summary and its browser previews. Verify that completed-work text remains visible as preview admission changes.
|
Merged via squash.
|
…law#182953) * perf(ui): defer optional chat transcript renderers Keep frame and basic stream rendering eager so an initial active run does not wait for another import round trip. Load independent work summaries, activity details, notices, and previews within their existing conditions. Keep transcript CSS consolidated and preserve synchronous domain owners. Local WIP evidence: chat boot shrinks by 42,859 raw and 12,217 gzip bytes against the starting base, with unchanged requests. The five-pair active run probe removes the original 133 ms lazy-frame regression. Focused stream, disclosure, and lifecycle tests and the UI typecheck pass. Final twenty-pair readiness and coverage measurements remain for the combined head after the preceding boot-diet change lands on main. * perf(ui): defer session management English catalog Keep the 25 labels needed by cold chat consumers in a small shared catalog. Existing lazy consumers retain the full catalog with identical values and property ordering. * perf(ui): keep already loaded recap rendering synchronous * test(ui): add initial transcript boot benchmark * fix(ui): preserve eager chat timing and await optional views * test(ui): await optional transcript content in remaining fixtures
What Problem This Solves
Cold chat loads renderers for optional transcript content and the full session-management English catalog even when the first screen does not use them.
User Impact
Chat loads 13,992 B less preloaded JavaScript gzip (49,958 B raw). Ordinary messages, active answers, the composer, and run frames remain eager. Optional content retains its current selectors, behavior, error boundaries, and CSS order.
Why This Change Was Made
Load activity details, source previews, question summaries, system notices, typing rows, and browser-card renderers when their content is present. Move the work-summary implementation intact into its own module. Seven cold-chat consumers register a shared catalog with their 25 additional labels instead of loading management copy; the full catalog references the same literals in its original order. All 378 catalog leaves, namespace identity, and active foreign translations are retained.
Completed-work summaries remain eager: the first CI attempt showed that deferring the header hid duration metadata on the first cached frame. The repair restores that first-frame contract. Optional activity and raw-detail bodies still load when needed.
The whole-run-frame lazy prototype was rejected after a 133 ms active-text delay at 100 ms RTT. This change retains the frame and text stream synchronously. A redundant recap lazy wrapper was also removed because that renderer was already eager through message rendering.
Evidence
Asset base:
285f5be610f. Head:f78992cc400. Node 26.12.1 on the same Mac. Current-main integration preserves its saved-conversation media gate in the extracted work summary and frame previews; a focused regression passes denied/allowed/denied preview access while completed-work text stays visible. Full CI passed on this exact head: 40142398817. Measurements use production bundles, the production Gateway HTTP entry, and synthetic RPC data; they do not claim real-provider latency.The strict base/head comparison passes. Startup remains within its current budget; the 178 B gzip growth accompanies the split shared labels/lazy bindings. Startup/Chat/New retain 7/19/16 JS and 1/3/3 CSS requests. The existing aggregate CSS cap excess does not grow. Refreshed coverage on the integrated bundles includes 53 scripts on each side. Gzip totals use the Gateway sidecars, falling back to identity bytes for uncompressed assets, matching the performance checker.
After full CI exposed missing first-frame duration, synchronous lazy-content assertions, and a missing required fixture option, the repaired head passes UI and chat-test types, 81 unit cases, and five production E2E cases across cached boot and desktop/mobile delegated-work history. The E2E opens Worked, waits for the nested Raw details control, and verifies retained tool results. A second CI run exposed the remaining standalone preview/typing/retry assumptions plus missing browser-card fixture CSS; all 23 affected cases pass locally, including dark/light menu geometry. Formatting and affected chat-test types pass. Both failed full CI attempts and their repairs remain explicit evidence: 40136445254, 40139345164. The repairs add no preloads or longer timeouts and remove no assertions. Prior unchanged-input proof also passed: integrated UI typecheck; lazy transcript lifecycle (1), streaming (9), message groups (11), activity disclosure (28), optional English loading (4), and two browser files (12). The lifecycle case preserves adjacent message identity, Reply focus, current callbacks through row changes, and the completed frame. Production Knip on the integrated head reports four unused non-UI files, 33 export entries and 12 type entries, with no UI findings or new ignores. Its output is byte-identical to current main. The extra export compared with the original measured base is an untouched OpenAI-plugin export from main. Independent current-diff P0–P2 autoreview found no actionable issues.
Solid refactor census: effects 1→1, untrack 1→1, owner API calls 3→3, onSettled 6→6, lazy declarations 4→13; controllers, render effects, direct listeners, DOM queries, flush, and onCleanup remain zero. Touched production UI LOC: 4,696→4,798; tests: 10,593→10,838; tooling/generated: 2,791→3,077. Added production lines are local lazy boundaries and the shared catalog; the moved renderer is not duplicated. Test LOC now includes the additional consumers repaired after full CI exposed their synchronous readiness assumptions.
This follow-up is an incremental measured step toward the −30% boot goal. It does not reach that target. The first step landed as #182813.
Readiness and renderer CPU
Readiness proof was captured before current-main integration, on base
3df26eebaf4and the corrected production candidate committed asd3533cf7c0c. The integration preserves those lazy boundaries and adds the current-main media gate; its focused regression and UI types pass, and exact-head full CI passed on the combined code. These timings are retained evidence, not a rerun on the final merge. Twenty interleaved base/control/head observations per cell, with ten additional rich-RTT pairs (30 total). Each control uses the identical base bundle. Entries are median / p95 (min–max), ms. RTT uses 100 ms latency and 10 Mbps.One-minute host load (base/control/head medians): Ordinary / local: 60.0/59.4/60.4; Ordinary / 100 ms RTT: 62.4/62.5/62.1; Rich / local: 85.6/85.6/85.6; Rich / 100 ms RTT (30 pairs): 77.1/77.5/77.5.
Local A/A wall medians move beyond the acceptance band, so those wall timings are noisy. Ordinary-local script CPU is +1.7% at median with a lower p95; task CPU median falls 0.6%. Ordinary RTT script/task CPU medians and p95s fall; transcript median improves while p95 is +3.6%. Rich-local CPU stays within 2.4%. Initial rich RTT composer p95 was +5.1%, so ten more interleaved pairs were collected: supplemental head p95 is 1657.1 ms versus base 1754.7 ms; pooled 30-pair composer p95 is +4.3%, with active-answer p95 +3.2% and both median CPU measures within 0.5%. All four profiles have no browser errors. This is a transfer-size improvement; no general CPU or latency win is claimed.
Reproduction
Build both pinned commits on the same host, save their
dist/control-uitrees, then run:For ordinary RTT add
--network-latency-ms 100 --download-kbps 10000; for rich RTT add--network-latency-ms 100. The supplemental rich-RTT confirmation used--pairs 10; the public table pools both samples. Capture V8 separately with ordinary--runs 2 --coverage, one base/head pair, and no thread-CPU flag. Production Knip:pnpm dlx --package [email protected] knip --config config/knip.config.ts --production --no-progress --reporter compact --no-config-hints --exclude duplicates.Screenshots
Synthetic data only, inspected locally. Before/after collapsed and expanded captures are byte-identical. The expanded case exercises the completed-work action, browser preview, final answer, and enabled composer.