Skip to content

perf(control-ui): load older history in fewer pages - #177017

Merged
steipete merged 2 commits into
mainfrom
steipete/coldload-older-page-3mib
Oct 19, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/coldload-older-page-3mib

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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.4xlarge lease (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.

Shape Added delay Budget Pages Traversal ms Worst arrival frame ms Median arrival frame ms Median RPC ms
normal 0 2 MiB 9 3483.2 [3463.3, 3498.5] 167.3 [160.8, 173.2] 147.0 [146.6, 148.9] 209.2 [209.0, 219.6]
normal 0 3 MiB 6 2698.2 [2655.8, 2729.5] 194.1 [172.0, 207.7] 153.0 [152.9, 155.8] 273.4 [259.9, 276.0]
tool-heavy 0 2 MiB 10 4136.0 [4072.5, 4189.0] 164.7 [155.4, 169.8] 133.2 [131.1, 135.8] 269.0 [265.9, 271.8]
tool-heavy 0 3 MiB 7 3410.4 [3373.2, 3443.1] 172.1 [167.3, 187.7] 153.8 [153.2, 156.2] 301.1 [299.3, 322.9]
normal 230 2 MiB 9 4949.6 [4887.8, 4959.0] 165.7 [162.8, 167.5] 144.0 [142.4, 148.8] 389.1 [388.6, 389.2]
normal 230 3 MiB 6 3716.8 [3678.0, 3775.3] 169.8 [167.4, 178.0] 151.7 [151.2, 153.7] 452.4 [450.3, 453.2]
tool-heavy 230 2 MiB 10 6092.8 [5975.8, 6201.5] 161.3 [160.9, 172.6] 139.0 [133.3, 141.1] 465.2 [429.5, 485.9]
tool-heavy 230 3 MiB 7 4740.2 [4709.2, 4835.7] 170.6 [168.6, 172.7] 145.2 [144.5, 151.0] 490.3 [486.2, 497.6]

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.4xlarge lease cbx_1fc5bdffd058 (run), Node 24.19.0, pnpm 12.11.1. Focused proof passed 44 tests:

File Tests passed Command wall time
chat-pane-history.test.ts 30 11 s
chat-pane-history-maintenance.test.tsx 3 11 s
chat-pane-history-reply.test.ts 7 5 s
chat-history-loading.e2e.test.ts 3 30 s
chat-loading-performance.real-gateway.e2e.test.ts 1 182 s, including fresh CLI/plugin build

The unit files ran one at a time via node scripts/run-vitest.mjs <file> --maxWorkers=1. Both touched e2e files ran through node 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.ts and tooltip-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 base 0b702b5508545fb70fa5b3c4e72930c3004f26ab via 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.
  • The existing four skipped files were desktop-resize.real-gateway, peer-followup-restart.real-gateway, chat-steer-deferred-custody.real-gateway, and deepseek-search.real-gateway. Their skip conditions were not changed.

node scripts/check-changed.mjs completed in 604 s. Typechecks, lint, i18n and guards passed. Its only failure was the unused export MCP_CATALOG_LIST_LIMITS in src/agents/mcp-catalog-listing.ts, in both production and full-tree scans. Reproduced both identical findings on the same main base with node --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-performance failure plus two aggregate openclaw/ci-gate checks. 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 0b702b5508545fb70fa5b3c4e72930c3004f26ab 1,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_1fc5bdffd058 is 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_11c83ed13a55 is 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.

@clawsweeper

clawsweeper Bot commented Oct 19, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: The client requests up to 2,097,152 bytes and 1,000 messages.
  • After: The client requests up to 3,145,728 bytes and 1,000 messages.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is small and coherent, but an affected test suite retains incompatible expectations and the required confirmatory behavior evidence is pending.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Readers traversing long conversations wait through additional older-history requests and transcript prepends.
Reason: The maintainer-authored experiment tests a measurable user benefit with minimal production change and an explicit stopping rule; it does not yet establish readiness to ship.

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
Reviewed head: 0e5094494f96bca45e7d01a7bff68b3b0338ad38

Before merge

  • Update the remaining older-history request expectations (P2) - Changing this constant makes both direct loads and staged prefetch send maxBytes=3145728, but olderRequest() in ui/src/pages/chat/chat-pane-history.test.ts:68-69 still returns 2097152. Its exact assertions, including the upward-prefetch case at line 526 and recovery cases below it, therefore fail when exercising the changed owner. Update that helper alongside the other budget expectations and validate the affected history suite.

Findings

  • [P2] Update the remaining older-history request expectations — ui/src/pages/chat/chat-history-request.ts:53

Tests

  • Missing end-to-end proof: Supply current-head browser and real-Gateway backscroll results plus the declared interleaved 2/3 MiB traversal and arrival-frame comparison for both history shapes and latency conditions.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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:

  • [P2] Update the remaining older-history request expectations — ui/src/pages/chat/chat-history-request.ts:53
    Changing this constant makes both direct loads and staged prefetch send maxBytes=3145728, but olderRequest() in ui/src/pages/chat/chat-pane-history.test.ts:68-69 still returns 2097152. Its exact assertions, including the upward-prefetch case at line 526 and recovery cases below it, therefore fail when exercising the changed owner. Update that helper alongside the other budget expectations and validate the affected history suite.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Older-history byte budget and corresponding request assertions changes intended behavior with a stated reason (a70b7c2: The preceding optimization selected 2 MiB to reduce traversal requests while explicitly accepting measured arrival-frame increases and preserving startup behavior.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced diff changes one production constant and existing test assertions; startup remains 80 messages and 256 KiB, and older pages retain the 1,000-message limit. (ui/src/pages/chat/chat-history-request.ts:53, 0e5094494f96)
  • Remaining incompatible test expectations: The unchanged olderRequest helper supplies 2 MiB to exact request assertions covering prefetch, stale staged pages, exhaustion, cache refill, and session reset, while production now sends 3 MiB. (ui/src/pages/chat/chat-pane-history.test.ts:69, 0e5094494f96)
  • Current-main behavior and provenance: Fetched main retains 2 MiB. The preceding change, perf(control-ui): load older history in 2 MiB pages #176480, deliberately selected that budget after measuring traversal gains and accepting higher arrival-frame costs. (ui/src/pages/chat/chat-history-request.ts:53, d958966b09ea)
  • Explicit experiment pause: The current PR remains draft and explicitly says do not merge; its body declares confirmatory paired traversal and arrival-frame measurements pending, and both discussion comments contain review-status information rather than additional results. (0e5094494f96)
  • Existing server boundary: The Gateway honors explicit backscroll budgets below its existing 6 MiB ceiling; the PR introduces no protocol, authorization, storage-format, or cache-policy change. (src/gateway/server-methods/chat-history-handler.ts:201, 0e5094494f96)
  • Policy and history inspection: Root and UI policies were read and applied, including performance measurement and smallest-fix guidance; no maintainer-notes directory exists here. History was searched across the maintenance test rename; some older blobs and the installed Solid cheatsheet are unavailable locally. (ui/AGENTS.md:1, 0e5094494f96)

PR surface

Source 0, Tests 0. Total 0 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 4 5 5 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 6 6 0

Labels

Label changes:

  • add P2: This is a bounded backscroll performance improvement with a concrete test-expectation defect and no established urgent user regression.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a bounded backscroll performance improvement with a concrete test-expectation defect and no established urgent user regression.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 19, 2026, 2:31 AM ET / 06:31 UTC.

@steipete steipete closed this Oct 19, 2026
@steipete steipete reopened this Oct 19, 2026
@steipete steipete changed the title experiment(control-ui): older history in 3 MiB pages [do not merge] perf(control-ui): load older history in fewer pages Oct 19, 2026
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.
@steipete
steipete force-pushed the steipete/coldload-older-page-3mib branch from 0e50944 to 9e1b3d2 Compare October 19, 2026 06:47
@steipete
steipete marked this pull request as ready for review October 19, 2026 06:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T06:51:06.755082Z 9e1b3d2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete merged commit 7d9c4a7 into main Oct 19, 2026
148 of 151 checks passed
@steipete
steipete deleted the steipete/coldload-older-page-3mib branch October 19, 2026 09:01
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
…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.
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 P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS 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