Repository navigation
improve(ui): keep retained chats responsive - #195085
Conversation
Keep cached Chat panes mounted while excluding their contents from browser rendering until visible. Extend retained navigation proof for hidden rendering, resize, DOM identity, and reader-anchor recovery, and add scoped aging diagnostics.
|
🦞👀 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 Summary: ✅ CompletedThis 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. |
Allocate exactly the 46 net lines used by the retained-pane regression and native animation test helper. Keep the shared test-line scalar and asset budgets unchanged.
Wait for the current transcript instead of an identical hidden cached transcript during panel persistence coverage. Keep the existing desktop and mobile panel assertions and account for the one added test line.
|
Codex review: needs maintainer review before merge. What this changesThis PR skips rendering hidden retained chat contents while preserving mounted panes and extends the existing diagnostics and navigation coverage. Example: Typing in WebKit after 200 session switches with three retained panes.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR provides a focused, useful rendering improvement that current main lacks; no introduced defect was found, but required CI remains unresolved. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI retains recently visited chat presentations; its existing visibility classes select which mounted contents the browser renders. flowchart LR
A[Session navigation] --> B[Retained session owner]
B --> C[Mounted chat panes]
C --> D[Existing visibility classes]
D --> E[Visible pane rendering]
D --> F[Hidden contents skipped]
Technical reviewBest possible solution: Use the existing pane visibility rules to skip hidden rendering while retaining mounted state and reader restoration. Do we have a high-confidence way to reproduce the issue? Current main keeps cached descendants mounted with opacity-only hiding, establishing the rendering path; the supplied browser census corroborates it, but this read-only review ran no reproduction. Is this the best way to solve the issue? The smallest complete production fix is the existing CSS owner's hidden/visible pair; the benchmark extensions reuse existing collectors, and the tests cover distinct retention and restoration failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 79f5aeb13383. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +3, Tests +47, Docs +18, Other +138. Total +206 across 7 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label 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 November 8, 2026, 3:04 AM ET / 08:04 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* perf(ui): skip rendering inactive cached chat panes Keep cached Chat panes mounted while excluding their contents from browser rendering until visible. Extend retained navigation proof for hidden rendering, resize, DOM identity, and reader-anchor recovery, and add scoped aging diagnostics. * test(ui): allocate retained-pane regression proof Allocate exactly the 46 net lines used by the retained-pane regression and native animation test helper. Keep the shared test-line scalar and asset budgets unchanged. * test(ui): scope retained-session checks to the active pane Wait for the current transcript instead of an identical hidden cached transcript during panel persistence coverage. Keep the existing desktop and mobile panel assertions and account for the one added test line.
What Problem This Solves
Retained Chat panes remain expensive to render while another session is active, making typing and sidebar interactions slower in WebKit.
User Impact
Active chats respond faster while cached sessions keep their mounted content, draft state, and scroll restoration. The visible UI, scrollbar sizing, and pane retention policy stay the same.
Why This Change Was Made
Opacity-hidden cached panes still participate in browser rendering. Use
content-visibility: hiddenon the existing cached-pane rule and restorevisiblethrough the existing visible-pane class, including visible split panes. This adds no runtime state or cache owner.Extend the existing navigation regression to assert retained DOM identity, zero rendered hidden descendants, and reader-anchor restoration after a hidden resize. The benchmark additions expose bounded resource/animation diagnostics and independent Firefox qualification.
Evidence
Compared production bundles from base
9b8aa392679and candidate1a83550280don the same Mac. Each arm has its own browser process; A/B use identical base bundles. Twenty rotated triplets per action at initial and aged checkpoints (200 session switches and ten parks), with matched retained pane contents, 400-message probes, 202 sessions, and 15 sidebar rows. Application elapsed median / p95 in milliseconds follows; it is not paint time or WebKit CPU.All 1,080 observations completed across Chromium, WebKit, and Firefox.
All engine results and measurement limits
Chromium's initial typing p95 has a large A/A spread (107.2 / 62.1 ms; candidate 72.8 ms). Its thread CPU medians are 37.349 / 37.511 / 35.260 ms and p95s 46.121 / 41.149 / 38.692 ms. Aged typing medians are within 5% across arms; the candidate's CPU is 32.573 ms versus 32.868 / 31.984 ms. Sidebar improves at both checkpoints. Do not interpret these noisy input tails as a universal latency win.
Host load is recorded for every sample. Native typing includes driver gaps between keys. Initial/aged DOM counts differ slightly, so within-arm aging is not a pure temporal comparison; each checkpoint matches across arms. The final timing run uses no runtime CSS intervention, resource wrappers, trace, or forced GC. Native animation enumeration happens after timing. One earlier screening setup hit the content-equality guard before any accepted timing; the unchanged guard passed the later screen and final measurements.
The Chromium/WebKit run stopped after both engines completed because Firefox was missing. Their valid observations are retained; only the missing Firefox leg is run separately.
Cause split and retained-document census
A separate 20-triplet WebKit diagnostic on current main at
53f6c216645removed only scrollbar width/height at runtime. It did not recover typing or picker latency: aged typing A/B/ablation was 128.5/131.5/128 ms median, picker 152/156.5/162 ms, and sidebar 346/349.5/341 ms. Production scrollbar sizing is untouched. The final baseline was refreshed after the shell geometry change on main.The structural screen and final census reduce rendered pane descendants from 1,256 to 418 with identical retained pane DOM counts. The native animation census found no detached running animations, so the prior shimmer leak is not reproduced. Observer, listener, DOM and stylesheet-rule counts did not grow in the diagnostic; sheets/rules remained 21/7,840. Pending timeouts grew roughly 11 to 210, consistent with the router's 30-minute per-route cache, but that is not established as the typing cause. Inspector style records do not expose affected-element counts; Chromium task/style timings and the rendered-descendant count provide the available work evidence.
Post-GC detached wrappers were lower aged than fresh; heap sizes did not establish a memory win. This change removes rendering work from the bounded retained panes, not a claimed unbounded leak.
pnpm tsgo:ui,pnpm tsgo:scriptspnpm deadcode:knipLOC: production CSS 1,102 → 1,105; navigation test 751 → 774; panel-persistence test 114 → 115; benchmark 531 → 668; animation helper 77 → 100; benchmark docs 109 → 127; scoped test-line allocation 0 → 1. Total 2,684 → 2,890 (+241 / −35). Reports and generated media are not committed.
Before and after, aged WebKit, synthetic content only (inspected; layout unchanged):
Firefox confirmation and CI follow-through
Ten additional rotated triplets for typing and picker completed at both checkpoints (120 more observations). This was required by the initial Firefox typing tail and picker result; the original observations remain in the table above.
The typing tail did not repeat. Across all 30 Firefox picker triplets, initial medians are 64 / 68 / 68 ms and aged medians are 66.5 / 67 / 70 ms. Aged picker is a borderline result: +5.3% against A and +4.5% against B, with better pooled p95; confirmation A/A medians differ by 8%. It is not a claimed Firefox picker improvement or a precise zero-cost measurement. Chromium and WebKit measurements are not rerun to replace passing evidence. Per-cell ranges and host load are retained with the observations.
The initial CI run (42456941486) failed two panel-persistence cases because its global first-text locator selected an identical transcript in a hidden cached session after navigation. The replacement head scopes all three transcript waits to the active pane, retaining every mobile and desktop panel-state assertion. It passed focused typecheck, lint, formatting, and independent review. Runtime proof belongs to the new CI run; no broad local E2E suite was run.
The replacement head
fe86b6cd986incorporates disjoint current-main changes fromf01b0aae3cf; the measured UI implementation is unchanged. Its dedicated allocation covers exactly 47 new test/helper lines, with the shared scalar unchanged. Current main still carries 12 lines of test-budget debt, down from 16 on the original base. The 12-line overage is also present on the exact merge base; our own 47-line allocation preserves that debt without increasing it. Under the scoped campaign instruction, landing uses the native pre-existing-failure route with exact-base evidence; the shared scalar and allocation remain unchanged. A passing scheduled-main ratchet did not erase this independently reproduced debt. No performance size ceiling is raised.Landed through native confirmed recovery as
4423df8468329c5e1cad4219c4194a0a6b3bbd6dafter retiring the original auto request. The native workflow accepted the exact-base budget evidence and independently verified enforced security clearance. The replacement run's six CodeQL Security High jobs (run 42458451487) and changed-path scan (run 42458451492) failed withAPI rate limit exceeded for installationduring reporting. Each failure was inspected; these jobs did not finish successfully. The network-boundary and changed-path jobs received one targeted retry and failed again with the same installation-quota error. The core-auth retry also failed. Three independent targeted retries therefore reproduce the shared installation-quota failure; the other original boundary failures remain recorded. Native recovery must verify security clearance rather than convert these failures into passes. No security verdict or bypass is claimed. The replacement product-test run is 42458451522.The replacement run completed its product checks with one transient-looking question-footer landscape expand failure at
question-footer.test-support.ts:138: the panel remained collapsed after the tap. The snapshot has one active Chat pane, no browser errors, and closed Details; the same gesture sequence already received a layout-settling fix in #183072. The exact CI base837f871caf188401ec38bf86028c45ec71c2cdddpassed that single named test (1/1, 7.4 seconds) in an isolated headless browser. Latest scheduled main also passed it. This is not classified as inherited; one targeted shard retry was submitted with every assertion unchanged.Final primary-CI attempt 2 completed on
fe86b6cd986: all UI and real-Gateway shards passed. The retried shard passed 542 tests across 146 files with its assertions unchanged. Its only remaining primary failure is the proven unchanged 12-line budget debt; native recovery evidence pins the exact tested merge and attempt. Installation-quota-failed scans remain explicitly failed; native admission independently revalidated the enforced security guard and its current publisher evidence (run 42461336948). No failed scan was relabeled green.Closeout: merge commit verified reachable on
origin/main; native receipt is complete and its managed PR worktree was removed. Local large build/proof output was cleared. Total scoped LOC 2,684 → 2,890 (+241 / −35); no remote test leases.