Repository navigation
perf: load web chat history in larger, faster batches - #133565
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 6:32 PM ET / 22:32 UTC. ClawSweeper reviewWhat this changesThe branch expands Control UI chat-history batches, updates pagination coverage and docs, and removes avoidable work from history-display preparation. Merge readinessThis member-owned PR remains necessary: current main still requests 100 recent and 400 older rows, while the branch safely raises those bounded requests to 400 and 1,000 within the existing Gateway contract. No blocking patch defect was found; retain it for normal maintainer review after exact-head CI completes. Priority: P2 Review scores
Verification
How this fits togetherControl UI Chat requests stored session history from Gateway, projects rows into display-safe messages, and virtualizes them for initial rendering and older-message pagination. The changed limits affect the request volume at open, refresh, prefetch, and scroll-back boundaries. flowchart LR
A[Stored session transcript] --> B[Gateway history API]
B --> C[Control UI history loader]
C --> D[Display projection]
D --> E[Virtualized chat view]
E --> F[Older-page prefetch]
Decision needed
Why: The limits alter the default browser workload and user-visible history availability; the branch is technically bounded, but final acceptance is an owner-level performance tradeoff. Before merge
Agent review detailsSecurityNone. PR surfaceSource +20, Tests +38, Docs 0. Total +58 across 28 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the centralized 400/1,000 request policy, its existing Gateway cap, and the pagination/scroll regression coverage as one bounded Control UI performance change. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect reproduction: this is a measured performance and default-window change, with supplied benchmark and browser-flow evidence for the affected path. Is this the best way to solve the issue? Yes: the limits are changed at the shared Control UI requester, while the existing Gateway schema and server clamp retain the 1,000-entry boundary without adding configuration or protocol surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7504a3b3c453. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
e755ce0 to
75591d3
Compare
|
Ready to land the maintainer-requested 400-message initial window and 1,000-message older pages. The measured browser/server tradeoff is accepted; existing Gateway entry/byte caps, virtualization, and projection lookback remain. This resolves the default-size decision in the latest ClawSweeper review. The final head is CI caught two capture-group type accesses, now corrected, and a pre-existing hard-coded docs release inventory, now replaced by locale parity against English navigation. The later rebase resolved a concurrent release-inventory update; reviewed history modules and the parity test stayed byte-identical, and the focused navigation test passed again. The PR body contains commands, Testbox run links, Node/browser measurements, inspected synthetic before/after captures, and measurement limits. Production: +47/-27 (net +20); tests: +130/-92 (net +38); docs: net zero. The remaining CPU costs are SQLite parsing/iteration and inbound metadata work; reducing projection lookback needs separate tool/audio boundary proof. |
|
Merged via squash.
|
…cked-delivery * origin/main: fix(ui): wait for restored draft before clearing (openclaw#133575) fix(deps): update fast-uri security patches (openclaw#133572) test: reduce workflow sanity fixture cleanup time (openclaw#133588) fix(media): normalize detected Matroska MIME (openclaw#133383) refactor(docker): retire ClawDock shell helpers (openclaw#133594) perf(browser): reuse snapshot refs and screenshot metadata (openclaw#133598) perf: load web chat history in larger, faster batches (openclaw#133565) fix(plugins): keep bundled plugins bundled when selected by plugins.load.paths (openclaw#133584) test: isolate shared /tmp session-store paths in runner and health suites (openclaw#133568) fix(cron): avoid no-op schedule repair writes (openclaw#133552)
* perf: load web chat history in larger, faster batches * fix: type-check history token capture groups * test: derive localized release routes from English navigation
…prior run, seen on other unrelated PRs openclaw#140331/openclaw#133565/openclaw#133580, passes locally on current main)
What Problem This Solves
Opening and scrolling through long Control UI conversations repeatedly pauses to load small history pages. Preparing larger pages also spends unnecessary CPU scanning ordinary reply text and validating message fields that the caller does not use.
Why This Change Was Made
Increase the shared recent-history window from 100 to 400 messages and older pages from 400 to 1,000. Session prefetch, refresh, and task previews use the same recent window. Existing response byte limits, text caps, cache bounds, virtualization, and projection lookback remain in force.
Make punctuation and trailing-control-token matching start at the string edges; skip runtime-context and sender parsing when required markers are absent; avoid media scans and repeated control classification when they cannot affect the result. Browser tool predicates now inspect only role and string-valued tool identifiers. Text, media, custom tokens, forwarded replies, and scroll anchoring retain their behavior.
User Impact
Four times as much recent history is available on open, and larger older pages reduce request/prepend frequency. Gateway preparation is substantially cheaper. Larger pages still cost more per browser prepend, especially on slower CPUs; 400 is the measured initial-window compromise. No configuration, dependency, schema, or protocol changes.
Evidence
Real SQLite transcripts with 3,000 alternating user/assistant messages; five warmups and 30 timed reads per window. Rich messages contain 2,048 Markdown characters. Both sides of each comparison ran on the same Blacksmith Testbox with Node inspector profiling enabled. Times exclude RPC/network and browser work.
Payload byte counts stayed identical. The trailing-token classifier's sampled self time fell from 507.6 to 10.7 ms in the second comparison. Short-message preparation improved too: 9.05 → 6.53 ms for 400 rows.
Chromium 144, production bundle, 1280×800, synthetic Gateway: 60 paired browser samples, five fresh contexts per scenario. The final 1,000-row prepend median was 229.7 → 211.3 ms on normal CPU; 1,000-row initial render was 1,202.2 → 1,031.6 ms under 4× CPU throttling. Browser gains are smaller and noisy; the default 400-row initial median changed only 218.1 → 212.7 ms. Maximum anchor drift remained 1.875 px. These timings exclude network/Gateway latency.
Fresh Codex autoreview reported no blocking findings. The first PR CI run caught two optional regex-capture type accesses; both are corrected, with 92 token tests, a strict module type check, formatting, targeted lint, and a second clean Codex review. The full local type check is blocked by unrelated errors in the shared logging dependency installation; fresh hosted CI verifies the complete build. Validation: 693 focused/integration tests across 16 files, seven native-history browser scenarios, lint, formatting, and diff checks passed. This includes real ephemeral Gateway REST/SSE history, projection/media/forwarding, runtime-context stripping, message normalization, and scrolling/retry/prefetch. The trailing-token rewrite matched the original in 140,000 deterministic differential cases including Unicode and custom tokens. The first page-size pass additionally passed 900 focused tests and 12 browser scenarios.
Proof runs: initial measurements and tests, paired final measurements and tests. Both task-owned Testbox leases were stopped after command success; the backing job may show cancellation from lease cleanup. Temporary measurement harnesses and CPU profiles are retained locally and excluded from the source diff.
Production LOC: +47/-27 (net +20); tests +130/-92 (net +38); docs +1/-1. Added production lines express measured skip conditions and backward suffix capture. Smaller initial raw lookback was rejected because earlier tool calls and audio supplements can affect later projection.
The second CI run passed the history, browser, type, lint, and package checks, but exposed a pre-existing docs-navigation test that hard-coded the release list. Current main adds
releases/2026.8.1, so this PR also removes that copied inventory while retaining localized route parity, labels, ordering, and duplicate checks. The focused navigation test passes against current-main docs input; this follow-up changes no production code.Exact local follow-up commands:
node scripts/run-vitest.mjs src/auto-reply/tokens.test.ts node scripts/run-tsgo.mjs --ignoreConfig --noEmit --strict --noUncheckedIndexedAccess --target es2022 --module nodenext --types node --skipLibCheck src/auto-reply/tokens.ts node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/auto-reply/tokens.ts node scripts/run-vitest.mjs test/scripts/docs-sync-publish.test.ts -t 'keeps generated locale navigation aligned with English routes' node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.scripts.json test/scripts/docs-sync-publish.test.ts git diff --checkThe navigation check first used current-main
docs/docs.jsonas its input, then restored the branch input. A concurrent main change subsequently updated the same hard-coded release lists; the rebase preserves the reviewed parity-based test. The focused test passes again on the rebased tree, and the history modules and test are byte-identical to their reviewed versions.Synthetic before/after captures
The viewport intentionally stays the same because rows are virtualized; the loaded-history count changes from 100 to 400. Both captures were inspected and contain only synthetic data.
Before: 100 messages loaded.
After: 400 messages loaded.