Skip to content

improve: load 800 chat messages with less layout work - #133734

Merged
steipete merged 2 commits into
mainfrom
codex/history-800-browser-perf
Aug 31, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/history-800-browser-perf

Conversation

@steipete

@steipete steipete commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Opening a long conversation shows only 400 messages before another history fetch is needed. Rendering and prepending history also repeatedly measures closed tooltip triggers, forcing avoidable layout work.

Related: #133680.

Why This Change Was Made

Raise the shared initial history window to 800 for startup, refresh, prefetch and task previews. Older pages remain 1,000, within the existing Gateway limit and response/cache byte budgets.

The shared tooltip component now checks text redundancy during updates only while open. Opening still checks the current trigger, and changing an open tooltip to redundant content still dismisses it. This removes unnecessary computed-style and geometry reads at their lifecycle owner without adding a cache or changing Web Awesome popup ownership.

User Impact

Twice as much initial history is available before loading another page. On the synthetic rich-history fixture, the new 800-message default paints in 248.6 ms versus 217.3 ms for the previous 400-message default: about 31 ms additional browser time, excluding Gateway/network. Payload doubles from 1.05 to 2.10 MiB; median resident JS heap rises from 18.04 to 19.42 MiB.

Evidence

Same prepared Linux Testbox, Chromium 144.0.7559.0, shipped UI bundle, 1280×800 viewport. Five fresh browser contexts per cell, rotated initial-size order; normal CPU and CDP 4× throttling. Actual startup request limits, returned message counts, virtualization and prepend anchors are asserted. Timings begin at synthetic Gateway response serialization/release and end at the first painted transcript frame; network and Gateway execution are excluded.

Scenario CPU Before median After median
Initial 800 1× 264.6 ms 248.6 ms
Initial 800 4× 1,014.2 ms 943.8 ms
Prepend 1,000 onto 800 1× 253.9 ms 243.4 ms
Prepend 1,000 onto 800 4× 1,156.3 ms 1,001.5 ms

These are observed medians from five samples per cell, not statistical significance claims. The profiled updated → isRedundant subtree disappears: 127.8 → 0 ms for initial 800 and 140.5 → 0 ms for prepend at 4× CPU. Continuous scrolling shows no reliable speedup. Initial rendering stays at seven rows, the maximum observed set is 15, and maximum prepend-anchor drift stays 1.875 px.

Fresh Node inspector measurements use real isolated SQLite, 3,000-message fixtures, five warmups and 30 rotated iterations per scenario. Preparing 800 messages takes 16.6 ms for short text, 34.3 ms for rich text, 60.9 ms with metadata and 38.8–40.3 ms for retained reset history. This quantifies the larger request; no Gateway source changes or additional server speedup are claimed.

  • 776 tests across 11 UI files passed, including tooltip accessibility/title behavior, startup, refresh, reconnect, sends, history ownership, prefetch and task previews.
  • Six E2E tests passed for session selection, final-reply recovery, background tasks and shared tooltip styling/dismissal.
  • 100 browser measurement samples and 20 real-SQLite Node measurement scenarios passed.
  • Clean-environment core test types, UI types, type-aware lint and stylelint passed. Formatting and diff checks passed.
  • Fresh independent Codex autoreview passed with no accepted/actionable findings at the configured P0 threshold.
  • Local changed checks passed guards, exports, graph boundaries and i18n, then stopped at existing shared-install tslog declarations; local DOM/browser runs encountered incomplete lit-html/CSS dependencies. The prepared Testbox successfully ran the affected checks without changing the shared install.
  • Existing repeated-label tooltip coverage now verifies an open distinct hint closes after becoming redundant.

Prepared Testbox run: per-command wrapper exit codes were zero; the task-owned lease was stopped afterward.

Production LOC: +8/-2 (net +6), entirely the formatted open-state guard and invariant comment. Tests: +45/-36 (net +9). The shared default changes one existing constant; no new dependency, configuration, protocol, schema or persistence surface.

Before and after

Synthetic-only captures. Visible fixture code is identical (including its sample limit: 400); the benchmark separately asserts actual startup requests of 400 before and 800 after. The viewport stays visually identical because history is virtualized.

Before, initial 400:

Initial 400 messages

After, initial 800:

Initial 800 messages

Latest review disposition

The maintainer explicitly requested the 800-message default after discussing the larger startup payload, then requested this PR be landed. The measured browser, Gateway and payload tradeoffs above are accepted for this bounded default; no network speedup is claimed.

The latest ClawSweeper accessibility finding and associated Rank-up move are not an introduced regression: close() in both parent 5de1376b7f62 and head 952ca186ff4e leaves descriptions intact. It never calls restoreDescription(); restoration is owned by detachTrigger() and describe=false, unchanged by this PR. syncDescription() also remains unchanged. The review's claimed previous cleanup path does not exist. Any desire to suppress repeated accessible descriptions is a separate pre-existing behavior follow-up.

The Web Awesome dependency contract was inspected directly in the installed package: its tooltip constructor initializes open = false; the adapter already reads and writes that property in scheduleOpen(), show(), close() and click handling. The new guard uses the same supported property.

Full exact-head CI passed at 952ca186ff4e3cbbfd4e61ad045532fdc818ac69, including openclaw/ci-gate.

@steipete steipete self-assigned this Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 31, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 30, 2026, 10:59 PM ET / August 31, 2026, 02:59 UTC.

ClawSweeper review

What this changes

This PR raises the Control UI’s initial chat-history window from 400 to 800 messages and avoids measuring redundant tooltip triggers until the tooltip is open.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: the performance change is not on current main, but the new lazy tooltip guard leaves redundant closed tooltips with a duplicate accessible description, a P2 regression to fix before merge.

Priority: P2
Reviewed head: 952ca186ff4e3cbbfd4e61ad045532fdc818ac69
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The bounded performance direction is well scoped, but an introduced P2 accessibility regression prevents a higher patch rating.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable to the maintainer-authored PR proof gate. The supplied Testbox and synthetic-browser evidence is relevant to the UI change, but this review could not inspect the linked run because GitHub DNS access was unavailable.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable to the maintainer-authored PR proof gate. The supplied Testbox and synthetic-browser evidence is relevant to the UI change, but this review could not inspect the linked run because GitHub DNS access was unavailable.
Evidence reviewed 5 items Introduced accessibility regression: The introduced guard skips redundancy evaluation for closed tooltips after syncDescription has already created aria-describedby. A redundant closed tooltip therefore retains duplicate hidden descriptive text.
Previous lifecycle behavior: The parent implementation evaluated redundancy during every update and called close(), whose restoreDescription path removed the duplicate description; show() now returns for redundancy without that cleanup.
Coverage gap: The changed test verifies that the popup stays closed, but does not assert that a closed redundant tooltip has no aria-describedby; existing nearby tests establish the component’s accessible-description contract.
Findings 1 actionable finding [P2] Restore redundant-tooltip description cleanup
Security None None.

How this fits together

The Control UI requests a bounded transcript tail from the Gateway and virtualizes it in the browser. Its shared tooltip component updates alongside transcript rendering and manages both popup visibility and accessible descriptions.

flowchart LR
  A[Gateway transcript] --> B[History request window]
  B --> C[Control UI chat state]
  C --> D[Virtualized transcript]
  D --> E[Shared tooltip update]
  E --> F[Popup and accessible description]
Loading

Decision needed

Question Recommendation
Should the Control UI’s default initial transcript tail change from 400 to 800 messages given the deliberately larger startup payload? Accept 800 after the accessibility repair: Keep the larger bounded tail, fix the redundant-tooltip description regression, and accept the documented startup payload tradeoff.

Why: The server accepts the bound, but this changes the default browser/network cost for existing users and the supplied measurements do not include Gateway or network time.

Before merge

  • Restore redundant-tooltip description cleanup (P2) - syncDescription() creates aria-describedby before this guard skips redundancy for a closed tooltip. show() then returns without calling close(), so a fully visible repeated label retains a duplicate hidden description; the parent implementation removed it through close()/restoreDescription(). Cover the initially closed and closed-update cases, not only the popup count.
  • Resolve merge risk (P1) - Changing the shared initial tail from 400 to 800 doubles the requested startup payload; the supplied benchmark excludes Gateway and network time, so maintainers should explicitly accept that default-path tradeoff.
  • Resolve merge risk (P1) - The new open-state read directly uses Web Awesome’s tooltip object; its local source was unavailable and upstream inspection was blocked by DNS, although existing code already reads the same property elsewhere.

Findings

  • [P2] Restore redundant-tooltip description cleanup — ui/src/components/tooltip.ts:218-225
Agent review details

Security

None.

PR surface

Source +6, Tests +9, Docs 0. Total +15 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 2 +6
Tests 13 45 36 +9
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 54 39 +15

Review metrics

Metric Value Why it matters
Production versus test delta production +6, tests +9, docs 0 net The production growth is limited to the shared default and tooltip lifecycle guard, while updated coverage spans its request consumers.
Initial history default 1 default changed: 400 → 800 This changes the transcript amount fetched by startup, refresh, prefetch, and task-preview paths for existing Control UI users.

Merge-risk options

Maintainer options:

  1. Repair accessibility and confirm the default (recommended)
    Restore redundant-tooltip description cleanup and explicitly accept the 400-to-800 startup-tail tradeoff before merge.
  2. Keep the current startup tail
    Pause or narrow the change if the larger default payload is not appropriate for existing browser clients.

Technical review

Best possible solution:

Preserve the bounded 800-message path if maintainers accept its startup tradeoff, and restore the redundant-tooltip accessibility cleanup without reintroducing geometry reads for every closed tooltip update.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: render a tooltip whose content repeats a fully visible trigger, await its first update, and inspect aria-describedby. The branch retains it, while the parent update calls close() and removes it.

Is this the best way to solve the issue?

No. The layout optimization is sound in principle, but deferring every closed-state redundancy check also changes accessible-description cleanup; separate that cleanup from the costly geometry path and add a regression assertion.

Full review comments:

  • [P2] Restore redundant-tooltip description cleanup — ui/src/components/tooltip.ts:218-225
    syncDescription() creates aria-describedby before this guard skips redundancy for a closed tooltip. show() then returns without calling close(), so a fully visible repeated label retains a duplicate hidden description; the parent implementation removed it through close()/restoreDescription(). Cover the initially closed and closed-update cases, not only the popup count.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 237f23b45897.

Labels

Label changes:

  • add P2: The introduced tooltip lifecycle change can cause redundant accessible descriptions for normal keyboard and assistive-technology users.
  • add merge-risk: 🚨 compatibility: The shared initial browser history default doubles from 400 to 800 messages, changing the startup payload for existing users.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable to the maintainer-authored PR proof gate. The supplied Testbox and synthetic-browser evidence is relevant to the UI change, but this review could not inspect the linked run because GitHub DNS access was unavailable.

Label justifications:

  • P2: The introduced tooltip lifecycle change can cause redundant accessible descriptions for normal keyboard and assistive-technology users.
  • merge-risk: 🚨 compatibility: The shared initial browser history default doubles from 400 to 800 messages, changing the startup payload for existing users.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable to the maintainer-authored PR proof gate. The supplied Testbox and synthetic-browser evidence is relevant to the UI change, but this review could not inspect the linked run because GitHub DNS access was unavailable.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore the closed redundant-tooltip accessible-description behavior and add a focused regression assertion.
  • Record maintainer acceptance of the 800-message default’s larger startup payload before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit bef84be into main Aug 31, 2026
162 checks passed
@steipete
steipete deleted the codex/history-800-browser-perf branch August 31, 2026 03:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
* perf: load more chat history with less layout work

* chore: leave history release notes to release generation
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 docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant