Skip to content

improve(ui): keep retained chats responsive - #195085

Merged
steipete merged 4 commits into
mainfrom
solid2/w-perf-webkit-retained-1107
Nov 8, 2026
Merged

steipete merged 4 commits into
mainfrom
solid2/w-perf-webkit-retained-1107

Conversation

@steipete

@steipete steipete commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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: hidden on the existing cached-pane rule and restore visible through 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 9b8aa392679 and candidate 1a83550280d on 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.

Engine / state Action Base A Base B (A/A control) Candidate C
webkit / initial typing 112.5 / 126 113 / 133 88.5 / 122
webkit / initial model-picker 141.5 / 184 147 / 155 137 / 151
webkit / initial sidebar-toggle 319 / 345 323.5 / 345 240.5 / 262
webkit / aged typing 126 / 146 121 / 148 95 / 109
webkit / aged model-picker 152.5 / 173 151 / 163 141 / 151
webkit / aged sidebar-toggle 329.5 / 361 335 / 356 250.5 / 270

All 1,080 observations completed across Chromium, WebKit, and Firefox.

All engine results and measurement limits
Engine / state Action Base A Base B (A/A control) Candidate C
chromium / initial typing 54.2 / 107.2 52.65 / 62.1 50.45 / 72.8
chromium / initial model-picker 66.15 / 95.6 62.65 / 74.9 62.2 / 71.3
chromium / initial sidebar-toggle 160.05 / 192.4 161 / 193.9 145.05 / 163.8
chromium / aged typing 46.9 / 70.5 45.3 / 55.8 47.45 / 58.3
chromium / aged model-picker 59.85 / 67.5 61.1 / 98.2 61.95 / 65.3
chromium / aged sidebar-toggle 149.1 / 158.2 149.1 / 165.4 136.2 / 151
webkit / initial typing 112.5 / 126 113 / 133 88.5 / 122
webkit / initial model-picker 141.5 / 184 147 / 155 137 / 151
webkit / initial sidebar-toggle 319 / 345 323.5 / 345 240.5 / 262
webkit / aged typing 126 / 146 121 / 148 95 / 109
webkit / aged model-picker 152.5 / 173 151 / 163 141 / 151
webkit / aged sidebar-toggle 329.5 / 361 335 / 356 250.5 / 270
firefox / initial typing 63 / 92 63.5 / 72 60.5 / 75
firefox / initial model-picker 68.5 / 102 68 / 98 72.5 / 134
firefox / initial sidebar-toggle 235 / 251 236.5 / 320 191 / 219
firefox / aged typing 66.5 / 75 67.5 / 77 68 / 155
firefox / aged model-picker 65 / 135 67.5 / 109 70.5 / 109
firefox / aged sidebar-toggle 239 / 319 233 / 269 197 / 242

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 53f6c216645 removed 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.

Check Result
pnpm tsgo:ui, pnpm tsgo:scripts Pass
Targeted script/UI lint, CSS stylelint, format, diff check Pass
pnpm deadcode:knip Pass
Base/head production builds and strict paired performance check Pass; no violations
Startup JavaScript 90,865 → 90,865 B gzip
Startup CSS requests 1 → 1
Total CSS +53 raw / +8 gzip B; no ceiling changed
Independent Codex review No actionable P0–P2 findings
Navigation regression and full UI / E2E / real-Gateway suites Corrected panel-persistence cases and both real-Gateway shards passed. The question-footer gesture shard passed all 542 tests on its single targeted retry; the exact-base single-test reproduction also passed. Remaining non-product failure: unchanged 12-line budget debt.

LOC: 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):

Before: retained Chat on base

After: retained Chat with hidden pane rendering skipped

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.

Firefox confirmation, median / p95 ms A B C
Initial typing 73.5 / 247 68.5 / 127 69 / 81
Initial picker 62.5 / 192 66 / 136 60.5 / 69
Aged typing 66 / 74 68 / 79 66 / 75
Aged picker 67.5 / 119 62.5 / 145 68.5 / 117

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 fe86b6cd986 incorporates disjoint current-main changes from f01b0aae3cf; 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 4423df8468329c5e1cad4219c4194a0a6b3bbd6d after 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 with API rate limit exceeded for installation during 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 base 837f871caf188401ec38bf86028c45ec71c2cddd passed 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.

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.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T07:23:17.610807Z fe86b6c New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: M labels Nov 8, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
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.
@steipete
steipete enabled auto-merge (squash) November 8, 2026 07:27
@steipete
steipete disabled auto-merge November 8, 2026 07:33
@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Reported base/control typing medians are 126/121 ms, with 1,256 rendered pane descendants.
  • After: The candidate reports 95 ms and 418 rendered descendants while retaining the same pane DOM.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A minimal owner-preserving implementation with useful browser evidence; noisy cross-engine timings appropriately limit the performance claim.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Production Control UI bundles exercised typing, picker, and sidebar actions in real Chromium, WebKit, and Firefox browsers with synthetic transport; supplied measurements show reduced rendered descendants and WebKit improvement, and inspected screenshots preserve visible layout. The new regression's recorded base-failure run is absent, but the changed browser behavior has direct supplied evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Typing and sidebar interactions slow down while other retained chat presentations still incur rendering work.
Reason: The feature-history owner authored this direction, the measured WebKit benefit is concrete, and the production fix preserves existing retention and presentation contracts.

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
Reviewed head: fe86b6cd986a82f7256f08763f3a81dc67eb3b8b

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A recorded red-on-base run of the extended retained-rendering navigation regression is not supplied.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Cached-pane rendering keeps the original intent (750d0dc: Keep recent chat presentations mounted for immediate warm activation while preserving independent drafts, transcripts, and accessibility state.)
  • Aging benchmark and native animation census keeps the original intent (b9d3fb4: Separate progressive WebKit animation retention from bounded layout work using matched controls and post-timing native inspection.)
  • Mobile and desktop panel-persistence waits keeps the original intent (95f5e9a: Mobile session changes close sheets while desktop restores saved panels; active-pane transcript waits preserve every panel-state assertion.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +3, Tests +47, Docs +18, Other +138. Total +206 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 0 +3
Tests 3 68 21 +47
Docs 1 18 0 +18
Config 0 0 0 0
Generated 0 0 0 0
Other 2 152 14 +138
Total 7 241 35 +206

Preflight source

Source 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

Metric Value Why it matters
Diagnostic controls 8 benchmark-only CLI options; 0 product settings The controls select engines, workloads, and separate diagnostic interventions without expanding runtime configuration.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A bounded Control UI responsiveness improvement with measured WebKit benefit and no established core workflow outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 8, 2026, 3:04 AM ET / 08:04 UTC.

@steipete
steipete merged commit 4423df8 into main Nov 8, 2026
225 of 253 checks passed
@steipete
steipete deleted the solid2/w-perf-webkit-retained-1107 branch November 8, 2026 08:10
@steipete

steipete commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant