Repository navigation
perf(control-ui): load older history in fewer pages - #177017
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 changes before merge. What this changesThis PR increases Control UI older-history requests from 2 MiB to 3 MiB and updates several request-budget assertions. Example: A reader loads an older conversation page.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this maintainer-authored experiment open and unmerged as requested; the change is focused, but remaining backscroll tests still expect the previous budget. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI history request owner supplies byte budgets for direct backscroll and staged prefetch; Gateway history responses flow into the existing transcript projection and renderer. flowchart LR
Reader[Reader backscroll] --> Pane[Chat history owner]
Pane --> Request[Older page request]
Request --> Gateway[Gateway history handler]
Gateway --> Projection[Transcript projection]
Projection --> View[Visible conversation]
Technical reviewBest possible solution: Keep the existing request owner, update the remaining test helper to 3 MiB, and retain the budget increase only if its declared performance gates pass. Do we have a high-confidence way to reproduce the issue? Source establishes the budget change and incompatible exact test expectations, but the claimed performance improvement was not independently reproduced and no target code was executed. Is this the best way to solve the issue? Changing the existing shared older-page budget is the smallest implementation for reducing page requests; its performance value depends on the declared traversal and arrival-frame comparison. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d958966b09ea. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
PR surfaceSource 0, Tests 0. Total 0 across 5 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 19, 2026, 2:31 AM ET / 06:31 UTC. |
Amortize older-history requests across 3 MiB pages while preserving the 1,000-message limit and small startup budget. Update the existing history and reply-navigation expectations.
0e50944 to
9e1b3d2
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…7017) Backscrolling a long conversation loaded older history in 2 MiB pages, so an 820-message tool-heavy conversation took two older-history round trips and normal/tool-heavy Team-scale fixtures took 9-10 pages to reach the start. Raise the older-history page budget to 3 MiB; startup paging (80 messages / 256 KiB), the 1,000-message limit and the 6 MiB server cap are unchanged. Evidence (56 runs, AWS c7a.4xlarge, 7 interleaved pairs per shape and latency): traversal improves in 7/7 pairs everywhere: at 35 ms latency normal 3.48 -> 2.70 s and tool-heavy 4.14 -> 3.41 s; with +230 ms reply delay 4.95 -> 3.72 s and 6.09 -> 4.74 s. Pages 9 -> 6 and 10 -> 7. Accepted tradeoff: page-arrival frames get heavier (35 ms latency: tool-heavy worst +14.3 ms and median +21.6 ms paired; normal worst +33.5 ms paired, overlapping IQRs; smaller at higher latency). The secondary gate failed and the maintainer accepted it for fewer history steps. Runtime +1/-1 LOC. 44 focused tests, full UI e2e (831 files; remaining failure reproduces on main). The only exact-head red is the New Session boot JS ceiling from the pre-openclaw#176696 base (1,050,246 B vs 1,050,000 B; this change is 27 B smaller); current main is 1,044,947 B.
What Problem This Solves
Readers need fewer history-loading steps when scrolling back through long conversations. Live r164 evidence showed an 820-message tool-heavy conversation requiring two older-history requests: 661 messages / 2,097,313 bytes, then 159 messages / 498,499 bytes. A 3 MiB page lets that history arrive in one round trip instead of two. (The live replies were observed 249–327 ms and 253–259 ms after their requests, but that includes main-thread dispatch delay: the second reply waited behind the first page's ~224 ms apply task. On a faithful fixture the handler itself takes ~92 ms for the 2 MiB page and ~19 ms for the 0.5 MB page, scaling with payload; see #177020. There is no fixed per-page server cost.)
Only the older-history byte budget changes, from 2 to 3 MiB. The 1,000-message limit and startup paging (80 messages / 256 KiB) remain unchanged. Server history stays capped at 6 MiB; no protocol, configuration, storage, cache-policy, or layout change is needed.
Accepted tradeoff
The maintainer explicitly accepted the arrival-frame regression in exchange for fewer history steps and round trips. The original secondary gate failed: at 35 ms latency, tool-heavy worst-arrival frames worsened in 6/7 pairs, with a +14.3 ms median paired increase, above the 10 ms threshold. Worst-frame medians were 164.7 → 172.1 ms, with overlapping IQRs. The failure is the paired-sign-and-size rule, not non-overlapping IQRs.
At 35 ms latency, normal worst-arrival frames also have a +33.5 ms median paired increase (5/7 worse, overlapping IQRs), and tool-heavy median-arrival frames increase +21.6 ms paired (7/7 worse). With 230 ms added reply delay (a sensitivity run, not the live condition), worst-arrival paired medians increase +6.0 ms normal / +8.6 ms tool-heavy, and median-arrival paired medians increase +7.7 ms / +12.8 ms. These costs are retained explicitly in the table and paired samples below.
The primary result improves in 7/7 pairs for both shapes at both latencies: at 35 ms, normal traversal median paired −774 ms (3.48 → 2.70 s) and tool-heavy −752 ms (4.14 → 3.41 s); with +230 ms reply delay, normal 4.95 → 3.72 s and tool-heavy 6.09 → 4.74 s. The maintainer overrode the secondary gate after reviewing these numbers and the live two-to-one round-trip reduction for the reported conversation. No chunked apply, alternate page size, or scheduling change is included.
Evidence
56 unprofiled production-renderer runs: seven interleaved 2/3 MiB pairs for each normal/tool-heavy shape at both 35 ms synthetic transport latency and 230 ms additional delay on every older-history reply. One AWS
c7a.4xlargelease (cbx_11c83ed13a55), 16 vCPUs, AMD EPYC 9R14, 30 GiB RAM, repository Playwright Chromium, one bundle and boot ID. Even blocks reverse the pair order. All runs reached the beginning, with normal pages 9 → 6 and tool-heavy 10 → 7.The measured source was
0e5094494f96bca45e7d01a7bff68b3b0338ad38; this is retained performance evidence, not a new measurement of the rebased head. The L142 Team-scale driver invokes the production history owner with staging disabled, one request/prepend per step, through mock transport. It changes only the outgoing older-history byte budget. Startup/reload behavior is unchanged and is not a performance gate for this change.Values are median [Q1, Q3]. All runs reached the start; page counts and 1,000-message limits were validated. Normal has 4,240 messages, tool-heavy 6,440. Completed arrival frames follow L142’s boundary: frame end must be after arrival and no later than visible-fill receipt. Frames below the 50 ms LoAF threshold are bounded at 50 ms.
Paired deltas
Candidate minus baseline, milliseconds; every sample retained.
normal, +0 ms
Traversal: -918.5, -780.6, -742.8, -763.1, -833.6, -774.2, -752.9 (median -774.2).
Worst arrival: +41.4, -1.3, +61.4, +6.6, -11.6, +33.5, +34.1 (median +33.5).
Median arrival: +6.1, +5.5, +6.0, +8.9, +5.2, +6.7, +9.9 (median +6.1).
Primary passes: True; arrival regression: False.
tool-heavy, +0 ms
Traversal: -752.0, -725.6, -500.3, -829.0, -717.6, -854.4, -814.9 (median -752.0).
Worst arrival: +14.3, +15.7, -21.4, +54.7, +0.9, +20.0, +7.4 (median +14.3).
Median arrival: +15.0, +15.1, +24.2, +26.3, +21.6, +18.2, +24.9 (median +21.6).
Primary passes: True; arrival regression: True.
normal, +230 ms
Traversal: -1344.0, -1270.6, -1300.9, -1032.7, -1157.3, -1214.7, -1078.8 (median -1214.7).
Worst arrival: -2.2, +3.3, +9.8, +6.0, +18.1, +3.4, +12.1 (median +6.0).
Median arrival: -0.6, +10.7, -3.7, +5.7, +15.6, +9.2, +7.7 (median +7.7).
Primary passes: True; arrival regression: False.
tool-heavy, +230 ms
Traversal: -1196.1, -1160.9, -1436.8, -1254.3, -1312.1, -1429.2, -1404.0 (median -1312.1).
Worst arrival: +12.5, +0.3, -7.0, -7.0, +14.6, +12.5, +8.6 (median +8.6).
Median arrival: +12.8, +8.2, +3.3, +14.3, +5.6, +12.8, +23.6 (median +12.8).
Primary passes: True; arrival regression: False.
Validation
Final head:
9e1b3d29f5825763064ba8ec3f589b3afae6fa21. Independent branch autoreview completed clean through P2 on this exact head. The diff is six files, 7 insertions / 7 deletions; production is +1 / −1, net 0. The only runtime change replaces the existing older-page budget literal. No appearance change or private capture is published.AWS
c7a.4xlargeleasecbx_1fc5bdffd058(run), Node 24.19.0, pnpm 12.11.1. Focused proof passed 44 tests:chat-pane-history.test.tschat-pane-history-maintenance.test.tsxchat-pane-history-reply.test.tschat-history-loading.e2e.test.tschat-loading-performance.real-gateway.e2e.test.tsThe unit files ran one at a time via
node scripts/run-vitest.mjs <file> --maxWorkers=1. Both touched e2e files ran throughnode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts <file> --maxWorkers=1.The full native UI e2e suite ran once on the final head, with real-Gateway coverage enabled: 831 files passed / 3 failed / 4 skipped; 3,593 tests passed / 1 failed / 8 skipped, 6,140 s command wall time. All three failures were investigated:
workboard-native-bundle.e2e.test.tsandtooltip-first-activation.e2e.test.ts: the fresh box lacked the WebKit executable. Installed it via the repository's Playwright, then reran each file individually: 2/2 passed in 36 s; 2/2 passed in 28 s. No source change or assertion weakening.extensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.ts: “configured owners and admin chat manage a Telegram-created job while a non-owner cannot” failed before the browser flow, in the Crabline fixture's private-file ancestry check:Private mutation boundary is writable by another POSIX principal.Reproduced the same error and stack on main base0b702b5508545fb70fa5b3c4e72930c3004f26abvia the native UI e2e runner with this file and--testNamePattern="configured owners"(178 s including fresh build). This failure is inherited; the security check was not bypassed.desktop-resize.real-gateway,peer-followup-restart.real-gateway,chat-steer-deferred-custody.real-gateway, anddeepseek-search.real-gateway. Their skip conditions were not changed.node scripts/check-changed.mjscompleted in 604 s. Typechecks, lint, i18n and guards passed. Its only failure was the unused exportMCP_CATALOG_LIST_LIMITSinsrc/agents/mcp-catalog-listing.ts, in both production and full-tree scans. Reproduced both identical findings on the same main base withnode --import ./scripts/tsx.mjs scripts/check-deadcode-exports.mts(105 s). No unrelated export or scan configuration was changed.Exact-head CI
CI run 39211996103: 38 successful checks, 44 skipped, three red checks. The reds are one underlying
control-ui-performancefailure plus two aggregateopenclaw/ci-gatechecks. The selected UI and UI e2e checks, production/test typechecks, lint, guards and security checks passed.The failed performance job builds both the exact main base and candidate. Its New Session boot-JS ceiling fails on both: base
0b702b5508545fb70fa5b3c4e72930c3004f26ab1,050,273 B, candidate 1,050,246 B, ceiling 1,050,000 B. This change is 27 B smaller; chat boot JS is also 30 B smaller. The CI failure classifier initially labels this “new” using an older scheduled main run and explicitly has no selected-scope comparison; the same-job base build establishes that the ceiling failure is inherited. No unrelated budget increase or CI rerun was used.Validation lease
cbx_1fc5bdffd058is released; provider cleanup confirmed no retained host. Full-suite, focused-rerun and main-comparison logs are retained locally with the original failures.The earlier performance lease
cbx_11c83ed13a55is released. Initial benchmark setup failures (fixture/bundle build-ID mismatch, then fresh-PR checkout replacement) produced no samples; the complete 56-run comparison followed on the retained lease through SSH. Synthetic inputs only; no live state or account was accessed.