Repository navigation
fix(ui): speed up older chat history loading - #152979
Conversation
|
🦞👀 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: needs maintainer review before merge. Reviewed September 19, 2026, 12:13 PM ET / 16:13 UTC (Revision 4). ClawSweeper reviewWhat this changesThe Control UI loads larger older-history pages and avoids comparing nonoverlapping message bodies, with updated regression coverage, a config-helper import repair, and a cancellation-test observation fix. Merge readiness✅ Ready for maintainer review The optimization remains absent from current main, and the supplied real-Gateway evidence supports it. No actionable correctness or security findings remain. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI requests stored conversation pages from the Gateway when readers scroll backward. It merges those pages into the displayed conversation while preserving message identity, order, and scroll position. flowchart LR
A[Backscroll or viewport filling] --> B[Older-history request]
B --> C[Gateway response limits]
C --> D[Stored conversation page]
D --> E[Check overlapping message sources]
E --> F[Prepend messages and preserve scroll]
F --> G[Stage one next page]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +20, Tests +54, Docs 0. Total +74 across 16 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep startup small while amortizing backscroll work within the existing Gateway limits and preserving exact message and scroll behavior. Do we have a high-confidence way to reproduce the issue? Yes: current main retains the small-page request path, and the supplied 900-message real-Gateway comparison establishes a focused reproduction scenario. This reviewer did not rerun it. Is this the best way to solve the issue? Yes: the patch reuses the existing Gateway budget owner and narrows expensive comparisons without introducing another cache, configuration option, or competing pagination path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2b341cd3cef7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Restore Gateway-owned older-page byte limits and compare full message projections only for overlapping transcript sources. Keep the small startup tail and preserve projected siblings, duplicate counts, and scroll behavior. Real-Gateway synthetic backscroll improved from eight requests and 2.68–2.91 seconds to one request and 656 ms for 900 messages. Long-task time fell from 883–1051 ms to 124 ms. Focused tests, browser proof, changed checks, and independent review passed.
Subscribe the fake tool to its abort notification and assert exactly one delivery. Node 24 composites can lose an unobserved weak source to GC before a post-request aborted getter. Keep all previous assertions and leave production cancellation unchanged.
Use the canonical value-tree helper in the include writer and remove the unused mutation import. This completes the caller migration from #152490 without restoring the old export. All 87 config mutation tests, a full build, and independent review passed.
8be10d2 to
fa00b87
Compare
|
Merged via squash.
|
* fix(ui): speed up older chat history loading Restore Gateway-owned older-page byte limits and compare full message projections only for overlapping transcript sources. Keep the small startup tail and preserve projected siblings, duplicate counts, and scroll behavior. Real-Gateway synthetic backscroll improved from eight requests and 2.68–2.91 seconds to one request and 656 ms for 900 messages. Long-task time fell from 883–1051 ms to 124 ms. Focused tests, browser proof, changed checks, and independent review passed. * test(gateway): observe tool revocation before owner collection Subscribe the fake tool to its abort notification and assert exactly one delivery. Node 24 composites can lose an unobserved weak source to GC before a post-request aborted getter. Keep all previous assertions and leave production cancellation unchanged. * fix(config): complete include value validation import cutover Use the canonical value-tree helper in the include writer and remove the unused mutation import. This completes the caller migration from openclaw#152490 without restoring the old export. All 87 config mutation tests, a full build, and independent review passed.
50f38c6 (#165897) intentionally changed ordinary history responses to a 512 KiB target and documented continuation through nextOffset. The old single-request assertion measured scrolling through all 900 messages under the previous 6 MiB policy from #152979; it did not measure opening a chat. Match older requests to committed pagination steps, check contiguous coverage and bounded nonempty responses, and allow at most one staged successor. Assert that all three startup samples issue no older-history requests. Preserve the ordered transcript, initial-tail, identity, Home, avatar, and cache assertions. The real Gateway reproduces the old failure with eight requests for eight backscroll steps. Startup remains one reply with 59 messages and 260,813 history bytes. The updated file passes locally, as do type-aware/boundary lint, its test-type graph, formatting, full local check-changed, and independent P2 review. No production or dependency changes; security-fast's source-map-js advisory (#165918) is inherited. Testbox-congestion exception: the lease timed out after 15 minutes queued, before sync or execution. Use the authorized ready-PR fallback; three Linux real-Gateway runs and the complete owning UI e2e config remain unrun.
815d4c3 (openclaw#165897) intentionally changed ordinary history responses to a 512 KiB target and documented continuation through nextOffset. The old single-request assertion measured scrolling through all 900 messages under the previous 6 MiB policy from openclaw#152979; it did not measure opening a chat. Match older requests to committed pagination steps, check contiguous coverage and bounded nonempty responses, and allow at most one staged successor. Assert that all three startup samples issue no older-history requests. Preserve the ordered transcript, initial-tail, identity, Home, avatar, and cache assertions. The real Gateway reproduces the old failure with eight requests for eight backscroll steps. Startup remains one reply with 59 messages and 260,813 history bytes. The updated file passes locally, as do type-aware/boundary lint, its test-type graph, formatting, full local check-changed, and independent P2 review. No production or dependency changes; security-fast's source-map-js advisory (openclaw#165918) is inherited. Testbox-congestion exception: the lease timed out after 15 minutes queued, before sync or execution. Use the authorized ready-PR fallback; three Linux real-Gateway runs and the complete owning UI e2e config remain unrun.
What Problem This Solves
Fixes slow backscroll in long chats after older history pages were reduced to 512 KiB. Related: #152093.
User Impact
Older messages arrive in fewer batches, with less browser work as the loaded conversation grows. The small initial tail is unchanged. Older responses can again use the Gateway's existing 6 MiB ceiling, trading larger individual transfers for fewer round trips; message completeness and scroll anchoring are preserved. Slower-network and lower-memory-device timings remain unmeasured. The accepted tradeoff restores a previously used bounded response size while keeping startup small and prefetch limited to one staged page; no persistent comparison cache is added.
Why This Change Was Made
Remove the UI's older-page byte override while keeping its 1,000-message ceiling. Small responses repeated Gateway reads/projection and browser prepend work. For overlap detection, compare transcript IDs first and serialize only rows whose sources overlap, preserving distinct projected siblings and duplicate counts without a persistent cache.
Evidence
Real Chromium against an isolated Gateway, using the same synthetic 900-message conversation and approximately 4 KiB of text per message:
The local browser measurement includes successive scroll gestures, response application, and prepend work; it is not a production-network latency claim. The initial tail remains 59 messages in this fixture. One larger request returned the remaining 841 messages (3.72 MB).
These A/B measurements compare the original UI patch with its original base. After refreshing main and completing an upstream config-helper import cutover from #152490, the browser scenario passed again with all 900 messages in order, one older request, 435 ms backscroll completion, and 126 ms of browser long tasks. The full build (including 52 runtime-module checks), 87 config mutation tests, and independent review of the import repair passed. The same import correction reached main before this PR merged, so the landed diff contains the history improvement and test-observation fix, without additional config changes.
A separate prepend benchmark used 30 warm, alternating paired samples and checked exact output identity/order against the previous algorithm. With 1,000 incoming and 10,000 held messages, median prepend time fell from 62.9 to 1.93 ms for 4 KiB text and 75.8 to 1.87 ms for 8 KiB text. Disjoint pages serialize zero message-body bytes for deduplication; a 5% overlap serializes only the shared boundary.
The browser one-page regression and serialization-budget regressions failed on the original code. All 108 focused tests and eight browser E2E cases passed, including lossless Gateway pagination, projected siblings, duplicate multiplicity, timestamp normalization, reply navigation, underfilled viewports, scroll anchoring, and retry behavior. Runtime and UI builds, changed-file checks, all test typechecks, UI typechecking, lint, and formatting passed. Independent review found no actionable P0–P2 findings.
CI also exposed an unrelated Node 24.19 test-observation flake in tool cancellation. A deterministic GC probe showed that an unobserved composite abort signal can lose its weak source before a later getter. The fake tool now subscribes during execution and asserts exactly one revocation, retaining its prior assertions; production cancellation is unchanged. The full six-test cancellation file passes on the exact CI Node version, and independent review passed.
Inspected synthetic before/after captures show the same oldest messages after complete history loading: