Repository navigation
improve(ui): reduce chat boot work from optional controls - #186004
Conversation
|
🦞👀 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 Chat controls, helpers, notices, and English catalogs while retaining boot-visible transcript content. Example: Cold-load Chat with the supplied desktop fixture.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 6 items remain Keep this PR open: the maintainer-directed boot improvement has measured value, but an introduced import cycle and incomplete test cutovers need repair. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe Control UI renders Gateway session facts through retained pane owners; this change moves optional presentation and interaction implementations behind lazy boundaries. flowchart TD
A[Gateway session facts] --> B[Retained pane owners]
B --> C[Transcript and composer]
B --> D[Optional control triggers]
D --> E[Lazy presentation modules]
E --> F[Existing mutation owners]
F --> A
Technical reviewBest possible solution: Retain the lazy boundaries and existing owners, remove the circular type dependency, and complete the affected test cutover. Do we have a high-confidence way to reproduce the issue? The import cycle and test defects are directly visible in source and corroborated by exact-head CI annotations; no target code was executed. Is this the best way to solve the issue? Deferring optional work through existing owners is coherent, and the remaining defects can be repaired without expanding the design. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f810bb4eede7. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 27, 2026, 10:54 AM ET / 14:54 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…86004) * perf(ui): load session management copy with its dialog * build(ui): refresh boot groups after session copy split * perf(ui): separate deferred chat rows by importing entry * perf(ui): retain compressed groups for deferred chat rows * perf(ui): group deferred run rows and delay voice easing setup * perf(ui): defer optional chat presentation and controls * fix(ui): retain board controls across lazy presentation * perf(ui): keep optional presentation in existing request groups * perf(ui): isolate visible chat rows from interaction code * perf(ui): share the boot callback projection chunk * perf(ui): share the cold avatar kickoff turn * fix(ui): keep cached chat frames ready on first commit * refactor(ui): keep boot-visible process rows synchronous * refactor(ui): make lazy preview dependency explicit * fix(ui): align lazy chat fixtures and capability types * test(ui): await deferred people query before hydration * test(ui): remove redundant pending handoff diagnostics
What Problem This Solves
Cold Chat boot downloads and evaluates optional controls even when the first screen only needs the transcript and composer. Split optional session/menu operations, composer helpers, notices, search, annotations, and their English copy at existing presentation or interaction boundaries. Keep the transcript frame and boot-visible process rows synchronous so cached history has its content on the first commit. Keep shared dependency groups and preload hints to avoid turning the split into a serial round trip.
This is a measured checkpoint, not completion of the boot-diet target: V8-recorded unused code falls by 33,983 B (1.54%), versus the requested approximately 950 KB / 40%. The larger target remains open. Supersedes #183601, #184591, and #184746; the prior-head failures are not claimed as inherited.
No dependency versions, public tags, CSS selectors, routes, authority, or Gateway state owners change. Optional presentation holds references to existing owners. Lazy-load failures remain visible with retry; menus retain keyboard-focus handoff and disposal. Current-row and cached-frame content is deliberately eager.
Evidence
Bundle proof
Same-machine production builds and strict performance checks, base
a4a8f632da0a9a2f5ab8ffc2e66fe2b46693ff6a, head001bfab965c5e9d3948123bb28d4df6db59b767e:Chat CSS grows 268 gzip B; total Chat bytes decrease. No budget increase or ignore was added. The strict checker passes.
Cold-load proof and acceptance
Workload: existing committed
scripts/bench-control-ui-cold-load.ts, compiled from frozen harness commit2868c5448f7c98853c5434888485a708a52bae8e. Production bundles served through its isolated Gateway HTTP fixture; desktop synthetic chat, fixed fixture clock, cold page and HTTP cache. Profiles: localhost and 100 ms RTT / 10 Mbps. Twenty interleaved base / same-base A/A / head triplets per profile; separate V8 coverage and eight traced cached-history/active-stream diagnostics. All samples retained. Source/build census matches before and after.Reproduction after compiling that committed harness (paths select the base/head build directories):
CPU counters span navigation through delivery of the fixture’s 18 events and more than 750 ms of Gateway quiet, including work after first readiness. Task CPU includes script, layout, style, partial compile and other renderer tasks; it is not just first-screen JavaScript.
Acceptance set before runs: median regression at most 5% with p95 no worse; noisy-host A/A control and at least twenty interleaved pairs for CPU interpretation. A move over 20% blocks. Coverage counts guide splitting but are not a substitute for readiness, CPU, or visible behavior.
Exact-head proof
Base
a4a8f632da0a; head001bfab965c5. Equal opening/closing source and bundle census. One sixty-run capture per profile: 20 base / 20 same-base A/A / 20 head loads on localhost and on 100 ms RTT, retaining every sample. Separate coverage and traced diagnostic captures are not pooled into timings.HTTP includes completed preload-only assets and synthetic fixture plugin scripts. V8 records only the frozen harness’s same-origin
/assetsfilter. Their difference is a coverage gap, not universal proof of nonexecution. Encoded bytes are reported as observed, not assumed gzip. Source-map rankings separately partition V8-covered output bytes.Timing acceptance is owner-interpreted: ≤5% median regression with p95 not worse, or the stated noisy-host A/A +20-pair CPU rule. The partial CDP compile counter is not total parse/compile CPU. Eight traced/profiled diagnostics report native compilation spans separately and never establish a timing verdict from one sample.
Normalized completed request identities:
en-board-Bl06qPz6.js; removedcallback-owner-DwHi_C6e.js.en-board-Bl06qPz6.js; removedcallback-owner-DwHi_C6e.js.Acceptance under the prescribed noisy-host rule
The original same-base A/A p95 changed +4.35% for route readiness and +4.50% for transcript paint despite identical code, triggering the campaign’s noisy-host interpretation. One additional ten-triplet cohort resolved the original CPU-tail concern. Across all 30 pairs, thread-clock script CPU changes +2.82% median / −6.03% p95; task CPU +0.59% / −1.64%; total thread CPU +0.53% / −1.48%. Requests, final rows and delivered events remain 62 / 4 / 18. This supports no aggregate CPU regression under the prescribed noisy-host rule, with fewer loaded/executed bytes.
The raw combined wall-time tails do not all improve: local readiness p95 is 492.0→517.7 ms (+5.22%), transcript paint 536→548 ms (+2.24%), and longest task 105→123 ms (+17.14%); their medians hold or improve. They are disclosed, not labeled passing ordinary p95 checks. The unchanged A/A and cohort-to-cohort tails vary substantially. The 100 ms RTT cohort has readiness median/p95 −0.73%/−1.00% and script CPU +0.34%/−2.20%. No measured cell exceeds the 20% regression stop rule. The thread-clock counters exclude descheduling; they integrate navigation through fixture settlement and do not identify first-ready CPU or individual task causes.
Original, supplemental, and combined localhost samples
One permitted localhost timing confirmation
The original 20 base/base/head triplets and one additional 10-triplet localhost cohort use identical frozen harness options, bundle hashes, source commits and fixture. Opening and closing supplemental censuses also equal the original census. All 90 localhost loads are retained, including both cohorts’ first triplets. Pairing stays within each cohort/triplet. RTT, coverage and diagnostic captures were not repeated. Values below use unrounded samples; nearest-rank p95 and full-precision values are preserved in
local-tail-confirmation/analysis/TIMING.json.Original 20 triplets
One-minute host load range: 20.238–26.166. Structural values across this cohort: [62] JS requests; [4] final transcript rows; [18] delivered fixture events; [72, 73] RPC counts.
Supplemental 10 triplets
One-minute host load range: 22.633–25.656. Structural values across this cohort: [62] JS requests; [4] final transcript rows; [18] delivered fixture events; [72] RPC counts.
Combined 30 triplets
One-minute host load range: 20.238–26.166. Structural values across this cohort: [62] JS requests; [4] final transcript rows; [18] delivered fixture events; [72, 73] RPC counts.
Paired CPU decomposition (head minus its own base, median / p95 ms)
Paired-delta p95 is a different statistic from the difference between distribution p95 values. CPU counter medians do not add to the median total; neither do their p95s. OtherTask is broad and unattributed, and may include product work. Task and Thread counters span navigation through fixture idle settlement, not only readiness. A/A variation describes the control; it does not automatically waive a head regression.
First-triplet longest tasks, all retained
Confirmation interpretation inputs
script_mshead p95 change: original +0.976769%, supplement -6.474956%, combined -6.032125%; combined median +2.824863%.task_mshead p95 change: original +3.589249%, supplement -5.677359%, combined -1.636944%; combined median +0.590051%.thread_mshead p95 change: original +3.507442%, supplement -5.266416%, combined -1.479005%; combined median +0.531711%.route_ready_mshead p95 change: original +2.344128%, supplement -19.835862%, combined +5.223577%; combined median -1.087781%.transcript_visible_mshead p95 change: original +2.367722%, supplement -20.009271%, combined +5.202195%; combined median -1.087369%.transcript_paint_mshead p95 change: original +0.000000%, supplement -19.883041%, combined +2.238806%; combined median -0.952381%.long_task_total_mshead p95 change: original +3.825137%, supplement -3.720930%, combined -3.720930%; combined median -0.800000%.long_task_max_mshead p95 change: original +1.449275%, supplement -2.380952%, combined +17.142857%; combined median +0.000000%.These are measured inputs to the stated acceptance rule, not an automatic clean verdict. No further timing cohort is authorized. Any unresolved cell remains explicit for the parent lane’s decision; a miss of the unused-byte target is still reported separately.
Diagnostic trace and compilation ledger
Descriptive one-sample diagnostics, not performance acceptance
Eight separate traced/profiled runs are behavioral/causal diagnostics, never pooled with untraced timing cohorts. Native trace compilation unions matching V8 parse/compile/deserialization event spans per renderer thread; values are coarse and non-exhaustive. All-renderer wall time sums per-thread event unions and is not elapsed boot latency; background parse spans can include scheduling or streaming waits. Missing thread clocks stay null; no proportional wall-to-CPU conversion. CDP Performance.V8CompileDuration is also non-exhaustive and is not a measure of full compilation. Historical runs use a warm application snapshot with browser HTTP cache cleared, active-stream runs first-load tool/code streaming. Mock Gateway transport.
These values characterize the captured work and instrumentation. They cannot establish a readiness improvement or regression from one traced sample.
Correctness and review
pnpm tsgo:uichat-session-workspace-loading.test.tspnpm ui:buildand strict performance checkerci:full; repair head pending. Previous run40522465991failed and remains attributed below.Solid text census across changed production/config files (not a native AST claim): rendering controllers 0→0, effects 3→3, render effects 0→0, untrack 1→1, direct listeners/DOM queries/flush/owner APIs all 0→0; lazy 24→35, onSettled 49→56, onCleanup 3→3.
Physical LOC across the final 151-path union (comments/blank lines included): production/config 32,844→34,012 (+1,168), tests/support 24,667→24,662 (−5), total 57,511→58,674 (+1,163). The union grows because CI repairs touch previously unchanged test files; this is not a 12,000-line addition. Growth is the small lazy entry surfaces, explicit load/error/focus lifecycle, and moved-body contracts needed to preserve interaction behavior. No duplicate registered implementation remains.
CI repair and attribution
Repair head:
361abe32d4cff6b073f87bd9801f9668d783759b. The production repair only extracts the existing composer capability types into a leaf module and renames a shadowed local binding; it does not change runtime behavior or the measured lazy graph. Bundle and timing evidence above remains pinned to001bf.Run
40522465991contained 25 failing executions / 24 distinct test names; none matched the latest completed scheduled main run checked (40513788150, head200f33bdb28712f25994b4134267515834903d81). They are not claimed as inherited. The repairs retain existing assertions while waiting for first lazy search/menu/notice content, supply current typed fixtures, and explicitly register the modal used by a focus test. The PR context check also required the exact authored headings now used here.pnpm tsgo:ui, scoped lint and formatThe pending-handoff failure was
does not recreate a consumed prompt outside the visible history page after reconnect(expected 0 visible prompt copies, observed 1). Its bounded local attempt did not reproduce it. The next exact-head CI must establish the outcome; the added diagnostics record queue/source/visible-bubble facts on recurrence without weakening its assertions.A later selective-transcript-body experiment is excluded from this PR. Twenty local and twenty RTT base/base/head triplets showed no consistent CPU win, +2,435 raw HTTP bytes and +375 encoded bytes; local script p95 rose 8.38% and long-task total p95 rose 42.62%. It is rejected, not counted as progress toward the target.
Synthetic visual proof
Inspected complete captures: synthetic-only cached history and active streaming on the exact base/head. First cached facts, final facts, row retention, and anchor position match on both profiles; captured/live anchor shift is zero. These selected images prove the touched first-content invariant, not every menu state. Broad interactions belong to CI.
Top 30 modules and functions by unused-at-boot raw bytes
Top 30 modules and functions unused during cold chat boot
Head
001bfab965c5. Raw UTF-8 bytes; same local coverage capture as the proof table. Common/conditional/rare labels describe reviewed call paths, not measured user frequency. Function and module tables overlap; do not add them.Modules
ui/src/components/markdown-parser.ts:135ui/src/components/markdown.ts:159ui/src/pages/chat/components/chat-transcript-virtualizer-host.ts:206ui/src/pages/chat/session-approval-projection.ts:92ui/src/pages/chat/chat-pane-header.ts:535ui/src/components/markdown-parser.ts:138ui/src/pages/chat/chat-pane-render.ts:524ui/src/app/app-shell-chrome.ts:124packages/net-policy/src/ip.ts:118ui/src/pages/chat/components/chat-composer-view.tsx:65ui/src/app/app-root.tsx:97ui/src/components/select-picker.ts:22ui/src/components/select-picker-view.tsx:86ui/src/pages/chat/tool-stream.ts:497ui/src/components/session-organizer.ts:54ui/src/pages/chat/chat-outbox-owner.ts:66ui/src/pages/chat/chat-view.tsx:59ui/src/app/gateway-store.ts:621ui/src/pages/chat/chat-pane-publication.ts:12ui/src/components/solid/menu.tsx:430ui/src/pages/chat/chat-state-page.ts:356ui/src/pages/chat/components/chat-composer-regions.tsx:73ui/src/pages/chat/chat-pane-lifecycle.ts:361ui/src/pages/chat/history-merge.ts:182node_modules/.pnpm/[email protected]/node_modules/markdown-it/dist/markdown-it.mjs:4ui/src/pages/chat/composer-dictation.ts:113ui/src/pages/chat/chat-pane-history.ts:33ui/src/pages/chat/chat-pane-context.ts:389ui/src/app-routes.ts:178node_modules/.pnpm/@[email protected]_patch_hash=421b418083c0218bb54ceb3e12bd0eb74a84e86474ca26cc1f1114abbe58de48/node_modules/@solidjs/signals/dist/prod/store/optimistic.js:394Functions
ui/src/pages/chat/chat-state-page.ts:356ui/src/lib/board/gateway-provider.ts:152ui/src/lib/sessions/session-roster-refresh.ts:656ui/src/pages/chat/chat-thread.ts:433ui/src/pages/chat/chat-outbox-drain.ts:68ui/src/pages/chat/route-loader.ts:253ui/src/lib/chat/outbox-store-codec.ts:112ui/src/components/solid/menu.tsx:430ui/src/pages/chat/chat-realtime.ts:205ui/src/pages/chat/chat-tool-activity-coalesce.ts:218ui/src/plugins/control-ui-view.solid.tsx:61ui/src/components/solid/person-reference.tsx:25ui/src/pages/chat/chat-pane-task-suggestions.ts:312ui/src/pages/chat/components/chat-working-indicator.tsx:189ui/src/components/markdown-json.ts:32ui/src/pages/chat/components/chat-message-bubble-tools.tsx:257packages/markdown-core/src/markdown-code-regions.ts:12ui/src/pages/chat/components/chat-attachments.ts:139ui/src/pages/chat/components/chat-thread-view.tsx:285ui/src/pages/chat/chat-history.ts:112ui/src/pages/chat/components/chat-session-workspace.ts:93ui/src/pages/chat/components/chat-agent-run-frame.tsx:257ui/src/pages/chat/components/chat-thread-view.tsx:319ui/src/components/markdown-json.ts:32ui/src/lib/sessions/index.ts:572ui/src/pages/chat/chat-pane-session-controls.ts:264ui/src/lib/chat/outbox-recovery.ts:246packages/markdown-core/src/markdown-code-regions.ts:12ui/src/app/server-prefs-drain.ts:188Source maps partition module bytes. Functions own their smallest V8 range but use the dominant mapped source for their label, so generated glue can make a function exceed its named module. The unmapped span remains unresolved; its CSS references are contextual only. V8 execution coverage is not complete parse/compile coverage; the proof reports completed HTTP resources and coarse compilation spans separately.
Exact-head CI repair: 9756485
CI run40528459901 had four failing test names. Three E2E failures match the exact names and errors on scheduled main run40523031614:
does not recreate a consumed prompt outside the visible history page after reconnect;keeps new batches in Details and opens Subagents manually without duplicate wait status; andreconciles an explicit suggestion refresh after an event while chat remains held (hidden: true). The remaining people-query unit failure was PR-owned and is repaired here.The pending people-query case asserted immediately after advancing150ms, before its cold dynamic import resolved. The test now waits for the exact one-request assertion before hydrating selected-session metadata; it retains all pending/resolved, selection, mention-range and no-send assertions. The original pending case failed locally with zero requests. After repair all30 tests in
chat-pane-history.test.tspass on the pinned Bun runner; UI types, scoped lint/format and independent P0–P2 repair review pass. No production input changed, so the existing build/Knip/performance evidence remains applicable. This repair adds two test lines. After the diagnostic removal below, the final changed-file union has tests/support 24,667→24,662; production/config 32,844→34,012.New exact-head CI is required; the previous run is not claimed green. The three named E2E matches are retained attribution evidence only, subject to failures on the replacement run.
Remaining-target investigation
The approximately950KB unused-raw target remains unmet. Further experiments were kept out of this PR: selective transcript bodies reduced V8-unused bytes but increased actual transferred bytes and local long-task tails; the context-details/PNG split saved4,891 raw bytes but retained an unexplained +27.8% local Other-task p95 after30 interleaved triplets and a bounded trace, so it was retired. Those results are not credited here.
A source/coverage audit of24 session/pane owners and their dependency closure found195,535 unused bytes, but only43,847 unused bytes in a deliberately generous explicit-command subset. That ceiling includes synchronous optimistic/custody prefixes and already-lazy wrappers; it is not achievable savings. Catalog initial discovery, companion hydration, and live row reconciliation are required outside the particular fixture. The link-preview renderers are already lazy: the observed IP dependency is retained by synchronous validated media normalization, whose entire parser/IP closure is21,684 raw/16,735 unused bytes. Catalog data also accounts for168,610 raw English bytes, marked executed during initialization; the existing namespace splits above remove optional copy without changing its owner. No100KB new independent boundary was established by these audits. Larger gains require restructuring the remaining synchronous normalization/live-state consumers; they are not claimed by this checkpoint.
Test-line repair: 1d913ae
Run
40535513116passed every UI unit shard and repeated the same three named E2E failures seen on completed scheduled main run40523031614. Its additional test-line failure was PR-owned: the branch added 54 lines while main was above the cap. This head removes only the 59-line failure-facts diagnostic import/block from the pending-handoff test; the complete scenario and every assertion remain. That file is now identical to the tested baseline.pnpm check:test-lines-ratchet --base 3bffe4f023190761d875238ed34c9e8f1b54106epasses with net delta −5. Independent P0–P2 review is scoped-clean. No runtime changed, and the existing measured build/coverage/timing proof remains applicable. Freshci:fullCI is required for this head; prior failures are historical attribution, not current-head admission evidence.Completed exact-head CI: 1d913ae
CI attribution: PR #186004 at 1d913ae
Every non-aggregate failed job is an exact-name inherited E2E failure. The completed run has three failed E2E jobs and the downstream CI gate; there are no new failed test names. The test-line ratchet, all UI unit shards, type checks, lint, and security-fast passed. CI itself remains failed; this report does not call it green.
Exact identities
PR run 40540105520, attempt 1, head
1d913aefd309a6362ca28ae0ac00b2deabf0cff5, completed at 2026-10-27T16:43:14Z. All 70 jobs were complete in the 16:44 UTC observation. Each failed E2E log declares checkout9c61b0d43b065bf12ab338fa4b817c2b2764fb5f: merge of head1d913aefd309a6362ca28ae0ac00b2deabf0cff5into baseline6c5e22056d96951c1d306b6838f68173cb23d7e7. The retained object has exactly those ordered parents.Latest completed scheduled main: run 40532514201, head
c168d2b0b7fb11f4cd463191a4f508c6775fbc9b, completed 2026-10-27T16:27:23Z. Newer run 40541472256 was queued at the observation. Only its two failed E2E job logs were needed for this comparison; unrelated main failures are not used to excuse the PR.Every failed test
ui/src/e2e/chat-startup-priority.e2e.test.ts— Chat startup request priority > reconciles an explicit suggestion refresh after an event while chat remains held (hidden: true)ui/src/e2e/chat-send-pending-handoff.e2e.test.ts— Control UI chat send pending handoff > does not recreate a consumed prompt outside the visible history page after reconnectui/src/e2e/chat-header-subagents.e2e.test.ts— Chat header and delegated work > keeps new batches in Details and opens Subagents manually without duplicate wait statusThe handoff assertion is
expect(latestPromptCount).toBe(0)at line 517 in both sources. The subagents case waits 30 seconds for the active pane's1 subagent runningbutton at line 211. The startup case fails the samehistoryTextcount assertion at line 235. Each PR E2E job reports exactly one failed test; repeated summary entries were deduplicated.Independent proof and source identity
1d913aef-source-equality.jsonrecords exact blob equality for all three test files across latest completed main, tested baseline, PR head, and tested merge.1d913aef-admin-delta.jsonbinds the native raw-diff SHA-2566dec01117185e703672d7fb7945592e51db41eb92febad60072df16ebb65cad0. Its delta is baseline-to-head, so its changed-path list includes main history absent from the branch; the tested merge is the actual CI tree.Passing exact-run job 122317755631 records
[ok] pnpm tsgo:uiat log line 1804. Passing ratchet job 122316902042 recordsnet delta: -5and[ok] test-linesat lines 1756–1757; the root-owned diagnostic removal is proven on this head. The metadata also shows all three UI unit jobs and the singlesecurity-fastjob successful.Gate job 122328362712 reports only the failed E2E group and has no independent failing test. The proposed native version-1 evidence is
ADMIN-EVIDENCE-1d913aef.json; it accounts for all three failed root jobs and this aggregate.REVIEW-PREEXISTING-CI-1d913aef.jsonsupplies the matching review fragment for root to inspect and apply. Neither file modifies native state.