Skip to content

improve(ui): speed up populated Usage timelines - #146947

Merged
steipete merged 1 commit into
mainfrom
codex/v8-usage-chart-format
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/v8-usage-chart-format

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #146932

What Problem This Solves

Populated Usage timelines repeatedly format every point's timestamp while the page updates.

User Impact

Loaded timelines with 50–200 points take less CPU to render while preserving localized labels, UTC selection, and existing interactions. Small and invalid-only cases have mixed results, including measured increases below 1 ms per render; this is not a universal page speedup.

Why This Change Was Made

The chart reuses the existing timestamp formatter for one render. Explicit chart fields and UTC options remain local to that render, while existing no-argument callers keep minute precision and the next render picks up locale or system timezone changes.

Evidence

  • Six fresh processes across Node 24.19.0 and 26.8.2 passed 198 complete-render parity cases. Every warm 50/200-point case improved in all three processes and all nine paired rounds on each runtime.
  • For 200 points and 50 conversation entries, median synchronous render time changed from 7.691 to 2.434 ms on Node 24 and 7.087 to 2.330 ms on Node 26. The 50-point case changed from 3.169 to 1.937 ms and 2.974 to 1.761 ms respectively.
  • 140 focused tests passed, covering the shared formatter, Usage details/page, Cron history and Tasks. New explicit-options tests failed against the original helper for the expected options/fallback mismatch and passed with the candidate.
  • Both bundled Chromium calendar cases passed on the DST-fixed base. The America/Santiago case preserves exact local labels, switches the actual page to UTC, verifies its request, and checks exact UTC labels; the America/Los_Angeles repeated-hour flow remains responsive.
  • Test and UI production types, other selected guards, lint, stylelint and formatting passed. The aggregate selected check remains blocked only by two unchanged script exports (canonicalProviderName and listPackagedStaticExtensionAssetOutputs), previously reproduced on a clean campaign baseline; the production unused-export scan passed.
  • Fresh independent P2 review completed across all three evidence parts with no findings. Hosted CI 34752739652 and the required gate passed at aebd13d43300f9f7b48f55d0bec4fc0f0143c259, including all seven browser shards and the real-Gateway UI flow.
Measurement scope and adverse controls

The benchmark measures the incremental chart change over the already optimized timestamp-list renderer. Both variants share the same independently reviewed DST repair; that repair's effect is not attributed to this optimization. Each process runs the same 31 timing cells and 33 parity cases, with three warmups and three alternating paired rounds of two complete renders.

These are synchronous Lit/jsdom renders, excluding browser paint, layout, network and module startup. Cold means a fresh DOM mount in a warm process. Warm means updating draft state on an existing page. Locale, selected timezone, cursor and mode transitions also have parity coverage.

The minimum two-point chart with 50 conversation entries regressed on all three processes: 1.397 to 1.728 ms on Node 24 and 1.271 to 1.436 ms on Node 26. One-point bypass cases also regressed. Node 26 invalid-only rows increased by 0.401–0.469 ms. Cold results are mixed; all empty, small, invalid and filtered-out cases remain in the retained evidence.

Both variants, imports, parity checks and DOM churn share each measured process. Whole-process peak RSS was 1232.78–1283.85 MiB on Node 24 and 1155.64–1347.69 MiB on Node 26; it does not establish a per-variant memory or retained-allocation improvement.

All 31 timing controls

Times are medians of three process medians in milliseconds. Wins compare paired process medians and all nine paired rounds; positive changes mean slower. Ordinary cells use UTC; local, French and DST names identify the additional conditions. Local/French/DST rows include 50 conversation entries; French and DST rows have 200 points.

Cell Node24 before→after ms Change Process / pair wins Node26 before→after ms Change Process / pair wins
points-0-logs-0-cold 7.751 → 7.712 -0.5% 2/3, 6/9 7.795 → 8.614 +10.5% 1/3, 3/9
points-0-logs-0-warm 0.754 → 0.772 +2.3% 1/3, 4/9 0.657 → 0.693 +5.4% 1/3, 4/9
points-0-logs-50-cold 16.289 → 15.806 -3.0% 2/3, 5/9 16.757 → 15.990 -4.6% 2/3, 6/9
points-0-logs-50-warm 0.794 → 1.116 +40.5% 0/3, 3/9 1.502 → 1.330 -11.4% 1/3, 5/9
points-1-logs-0-cold 12.403 → 12.645 +2.0% 1/3, 4/9 12.069 → 11.715 -2.9% 1/3, 5/9
points-1-logs-0-warm 0.693 → 0.925 +33.5% 0/3, 3/9 0.640 → 0.639 -0.3% 2/3, 5/9
points-1-logs-50-cold 19.286 → 20.003 +3.7% 0/3, 3/9 19.641 → 19.417 -1.1% 2/3, 5/9
points-1-logs-50-warm 1.190 → 1.298 +9.1% 0/3, 3/9 0.996 → 1.326 +33.2% 0/3, 3/9
points-50-logs-0-cold 16.302 → 15.296 -6.2% 3/3, 8/9 16.246 → 15.308 -5.8% 2/3, 7/9
points-50-logs-0-warm 2.519 → 1.310 -48.0% 3/3, 9/9 2.188 → 1.131 -48.3% 3/3, 9/9
points-50-logs-50-cold 23.760 → 22.649 -4.7% 3/3, 8/9 24.080 → 22.525 -6.5% 3/3, 9/9
points-50-logs-50-warm 3.169 → 1.937 -38.9% 3/3, 9/9 2.974 → 1.761 -40.8% 3/3, 9/9
points-200-logs-0-cold 27.478 → 22.119 -19.5% 3/3, 9/9 27.190 → 20.849 -23.3% 3/3, 9/9
points-200-logs-0-warm 6.968 → 1.669 -76.0% 3/3, 9/9 6.785 → 2.060 -69.6% 3/3, 9/9
points-200-logs-50-cold 33.461 → 27.608 -17.5% 3/3, 8/9 35.910 → 28.957 -19.4% 3/3, 9/9
points-200-logs-50-warm 7.691 → 2.434 -68.4% 3/3, 9/9 7.087 → 2.330 -67.1% 3/3, 9/9
points-2-logs-50-cold 20.518 → 20.430 -0.4% 1/3, 5/9 22.877 → 22.612 -1.2% 2/3, 4/9
points-2-logs-50-warm 1.397 → 1.728 +23.8% 0/3, 2/9 1.271 → 1.436 +12.9% 0/3, 3/9
local-50-cold 23.027 → 22.782 -1.1% 2/3, 4/9 25.763 → 22.049 -14.4% 3/3, 9/9
local-50-warm 2.785 → 1.570 -43.6% 3/3, 9/9 2.367 → 1.695 -28.4% 3/3, 9/9
local-200-cold 33.953 → 27.287 -19.6% 3/3, 9/9 34.350 → 31.467 -8.4% 3/3, 8/9
local-200-warm 7.190 → 2.071 -71.2% 3/3, 9/9 6.442 → 2.073 -67.8% 3/3, 9/9
fr-utc-cold 34.262 → 28.644 -16.4% 3/3, 7/9 34.653 → 28.712 -17.1% 3/3, 9/9
fr-utc-warm 8.115 → 2.864 -64.7% 3/3, 9/9 6.772 → 2.141 -68.4% 3/3, 9/9
fr-local-cold 33.596 → 27.999 -16.7% 3/3, 9/9 35.545 → 29.633 -16.6% 3/3, 9/9
fr-local-warm 7.583 → 2.154 -71.6% 3/3, 9/9 6.804 → 2.173 -68.1% 3/3, 9/9
dst-utc 8.407 → 2.265 -73.1% 3/3, 9/9 6.932 → 2.179 -68.6% 3/3, 9/9
dst-local 7.394 → 2.189 -70.4% 3/3, 9/9 7.186 → 2.743 -61.8% 3/3, 9/9
invalid-utc 1.760 → 1.510 -14.2% 2/3, 4/9 1.054 → 1.523 +44.5% 0/3, 4/9
invalid-local 1.619 → 1.608 -0.7% 1/3, 4/9 1.251 → 1.652 +32.1% 0/3, 3/9
filtered-empty 1.090 → 1.338 +22.8% 1/3, 3/9 1.028 → 1.294 +25.8% 1/3, 4/9

@clawsweeper

clawsweeper Bot commented Sep 13, 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.

@steipete
steipete marked this pull request as ready for review September 13, 2026 10:46
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 13, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 6:52 AM ET / 10:52 UTC.

ClawSweeper review

What this changes

Reuse one timestamp formatter per Usage chart render to reduce populated-timeline rendering work while preserving localized tooltips and UTC selection.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful and is not implemented on current main or the latest release. No introduced correctness or security defects were found; the protected maintainer PR should remain open for normal landing.

Priority: P3
Reviewed head: aebd13d43300f9f7b48f55d0bec4fc0f0143c259

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, compatible optimization with useful parity coverage and candid measurement limits; no actionable defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored exemption applies and no authority boundary changes. Supplied evidence exercises complete Usage rendering and Chromium local-to-UTC labels; its timing claims are limited to synchronous Lit/jsdom work.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored exemption applies and no authority boundary changes. Supplied evidence exercises complete Usage rendering and Chromium local-to-UTC labels; its timing claims are limited to synchronous Lit/jsdom work.
Evidence reviewed 7 items Introduced production change: The pinned merge-base-to-head diff extends the existing formatter with optional fields and fallback, then creates one instance outside the chart point loop. Existing no-argument defaults and timestamp validation remain intact.
Current-main necessity: Fetched main still calls formatDateTimeMs separately inside the chart point loop; conversation timestamp reuse does not cover this work.
Latest-release check: The v2026.9.4 source also retains the per-point formatDateTimeMs call. GitHub source retrieval succeeded after local retrieval of the release blob failed.
Findings None None.
Security None None.

How this fits together

The Control UI receives session usage points from the Gateway and renders an interactive timeline. Its timestamp formatter supplies tooltip and accessibility labels using the selected timezone and current locale.

flowchart LR
  A[Gateway usage points] --> B[Date and interval filters]
  B --> C[Usage timeline render]
  D[Locale and timezone] --> E[Render-scoped formatter]
  C --> E
  E --> F[Tooltip and accessibility labels]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1, Tests +69. Total +70 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 23 22 +1
Tests 3 84 15 +69
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 107 37 +70

Review metrics

Metric Value Why it matters
Reported populated-chart rendering 200 points: 7.691 → 2.434 ms on Node 24; 7.087 → 2.330 ms on Node 26 The complete synchronous-render measurements support the targeted benefit, while the retained controls prevent treating it as a universal browser speedup.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #146932
Summary: This PR directly implements the linked chart-formatting request; the earlier merged list optimization covers a separate loop.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep formatter reuse local to each chart render, preserving timestamp fields, invalid-date labels, and next-render locale and timezone refresh.

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

Yes for the repeated-work mechanism: current main formats each populated chart point separately during every render. The reported timing magnitudes were not independently reproduced.

Is this the best way to solve the issue?

Yes: extending the existing formatter and sharing it within one render removes repeated setup without creating persistent cache state or changing existing callers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e9c1cb7e71b7.

Labels

Label changes:

  • add P3: This is a bounded rendering optimization with no reported broken workflow or urgent user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored exemption applies and no authority boundary changes. Supplied evidence exercises complete Usage rendering and Chromium local-to-UTC labels; its timing claims are limited to synchronous Lit/jsdom work.

Label justifications:

  • P3: This is a bounded rendering optimization with no reported broken workflow or urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored exemption applies and no authority boundary changes. Supplied evidence exercises complete Usage rendering and Chromium local-to-UTC labels; its timing claims are limited to synchronous Lit/jsdom work.

Evidence

What I checked:

  • Introduced production change: The pinned merge-base-to-head diff extends the existing formatter with optional fields and fallback, then creates one instance outside the chart point loop. Existing no-argument defaults and timestamp validation remain intact. (ui/src/lib/format.ts:169, aebd13d43300)
  • Current-main necessity: Fetched main still calls formatDateTimeMs separately inside the chart point loop; conversation timestamp reuse does not cover this work. (ui/src/pages/usage/view-details.ts:620, e9c1cb7e71b7)
  • Latest-release check: The v2026.9.4 source also retains the per-point formatDateTimeMs call. GitHub source retrieval succeeded after local retrieval of the release blob failed. (ui/src/pages/usage/view-details.ts:619, 3a9d69db306c)
  • Existing formatter history: GitHub verifies improve(ui): reuse date formatters across timestamp lists #146789 as merged at this commit. Its patch establishes the shared render-scoped formatter used by this proposal. Local history identifies Peter Steinberger's related work; deeper local blame encountered unavailable blobs, so no causal attribution is inferred from it. (ui/src/lib/format.ts, 744e7e5829af)
  • Behavioral coverage: The complete tests preserve real date-format output, tooltip/accessibility-label equality, invalid-date fallbacks, and locale refresh. The browser case changes the actual Usage page from Santiago local time to UTC and asserts both the request and exact resulting labels. (ui/src/e2e/usage-calendar-boundaries.e2e.test.ts:281, aebd13d43300)
  • Performance evidence and its limits: The supplied complete PR body reports 198 DOM/interaction parity comparisons across six processes and lower warm-render times for 50–200 points. It explicitly retains small-case regressions and excludes browser layout, paint, network, and comparative memory claims. These measurements and reported Chromium passes were not independently rerun during this read-only review. (aebd13d43300)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 f23889d into main Sep 13, 2026
182 checks passed
@steipete
steipete deleted the codex/v8-usage-chart-format branch September 13, 2026 11:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* temp/pr-146802: (51 commits)
  improve: reduce worktree filesystem stalls and archive syncs (#146906)
  fix(ui): avoid extra chat rail work while replies stream (#146883)
  improve(ui): speed up populated Usage timelines (#146947)
  test(gateway): retain auth recovery failure diagnostics (#146925)
  fix(tests): create private temporary home directories (#146931)
  fix(backup): preserve discovery under concurrent state writes (#146912)
  fix: keep queued deliveries in their original state directory (#146917)
  fix(discord): settle voice waveform work before releasing input (#146885)
  fix(memory): preserve newer indexes and disclose automatic rebuild costs (#146908)
  fix: retain route ownership while discovering conversations (#146927)
  refactor: reuse plugin fixture shell runner (#146920)
  fix(worker): stop preparing disabled live previews (#146896)
  fix(runtime): support Bun across tooling suite (#146807)
  chore(i18n): refresh native locales (#146924)
  perf(secrets): limit expiry metadata to transient credentials (#146882)
  fix(ui): preserve queued refreshes during session discovery (#146535)
  test(ui): wait for quiet scrolling and close named file tabs (#146836)
  fix(ui): prevent Usage hour filters from freezing during DST (#146919)
  test(ui): share browser page cleanup across layout fixtures (#146805)
  ci: balance complete PR runtime test groups (#146916)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit 'ccfd2377cd07d1ad3a583ba64d08e29a065f7061': (1587 commits)
  fix(ui): avoid recapturing chat drafts during UI updates (#146884)
  fix(ui): show system uptime in the debug overlay (#146960)
  fix(retry): honor waits beyond the native timer limit (#145718)
  fix(ui): keep chat history idle when run status changes (#146802)
  fix(ui): reuse persisted text during chat streaming (#146831)
  refactor(qa): share harness drift result construction (#146903)
  test(agents): coordinate settings lock contention (#146949)
  fix(worker): avoid repeatedly serializing screenshot history (#146907)
  fix(secrets): stop buffered upload writes after cancellation (#146840)
  perf(doctor): avoid unnecessary state runtime imports (#146926)
  improve: reduce compaction request estimation work (#146961)
  fix(ci): wait for forwarded avatar imports before assertions (#146729)
  perf(workers): skip configured Git author lookups (#146833)
  fix: admit borrowed memory writes through the agent database owner (#146760)
  fix(discord): prevent voice playback gaps and stale turn controls (#146798)
  improve: reduce worktree filesystem stalls and archive syncs (#146906)
  fix(ui): avoid extra chat rail work while replies stream (#146883)
  improve(ui): speed up populated Usage timelines (#146947)
  test(gateway): retain auth recovery failure diagnostics (#146925)
  fix(tests): create private temporary home directories (#146931)
  ...

# Conflicts:
#	test/tsconfig/tsconfig.core.test.agents-other.json
#	test/tsconfig/tsconfig.core.test.agents-root.json
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

Usage timeline rebuilds date formatters for every chart point

1 participant