Skip to content

experiment(control-ui): older-history page-size curve [do not merge] - #176385

Closed
steipete wants to merge 1 commit into
mainfrom
steipete/coldload-older-page-size
Closed

steipete wants to merge 1 commit into
mainfrom
steipete/coldload-older-page-size

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Tests whether larger older-history pages make backscroll through long conversations faster without long arrival frames. The current client budget is 1 MiB despite a 6 MiB server ceiling and compressed transport.

User Impact

Experiment rejected; no production change. Keep 1 MiB. All larger budgets improve total traversal time, but none meets the approximately 120 ms arrival-frame target. At 2 MiB, tool-heavy traversal drops from 19 pages / 6.55 s to 10 pages / 4.25 s, while worst-arrival median rises from 142 to 171 ms (worse in all seven pairs, non-overlapping IQRs). The baseline also exceeds the target on these long stress cases; the existing render cost is not being declared acceptable.

Why This Change Was Made

Compression reduces bytes, while the client still pays native history projection and rendering work. This draft enabled the fresh-PR remote-clone experiment. It contains only a five-line experiment note; runtime LOC delta is 0, and no production file changed. No larger default or slicing workaround is proposed from this evidence.

Evidence

56 unprofiled runs on one quiet AWS c7a.4xlarge, seven interleaved rounds per history shape, plus separate source-mapped profiles. Exact head: 090fe184415c30d3b30b0c486aa18e1686cbbb11; main base: e08207aea9d41cde8a8621fb1f2d3ce1296faea4.

Environment and method

AWS Crabbox cbx_4964b2ff9098, fixed c7a.4xlarge, 16 vCPUs (AMD EPYC 9R14), 30 GiB RAM. Node v24.19.0, pnpm v12.11.1, and the repository Playwright Chromium build (Chrome for Testing 156.0.8078.4). One instance and one boot ID served the complete comparison. Pre-run load averages ranged from 0.52 to 2.47. Setup, UI build, and initial attribution succeeded in run_ea1047a451d2147bc40f4b0708f9e31e. The curve continued through the sanctioned SSH transport on that retained lease.

The production-bundle Team-scale benchmark retained its canonical shell, Online roster, plugin inventory, and common 240-message tail. The older prefix contains either 4,000 plain-text messages (1,000-character questions and 7,200-character answers) or 6,200 messages in 100 tool-heavy turns (30 call/result pairs per turn, collapsed activity). Full histories contain 4,240 and 6,440 messages respectively. These are long synthetic stress cases, not copies of a private conversation.

Seven rounds per history shape covered 1/2/3/5 MiB, reversing order on even rounds: 56 unprofiled browser runs. All use the same bundle and source, Chromium, 35 ms synthetic inbound latency, and 4 ms minimum reply spacing. The benchmark changes only outgoing older-history maxBytes after the reload measurement. The server fixture honors that budget and the unchanged 1,000-message limit. Startup requests remain untouched.

Each measured page goes through the native history owner with staging disabled (loadOlderMessages(false)) to isolate one request and one prepend. The driver moves to older content between pages and reaches the beginning. It validates progress, exactly one history response per step, and a visible transcript viewport. This is a controlled page-through experiment; it does not measure continuous-wheel prefetch effectiveness or a real Gateway network.

Page fill is response arrival to the visible-viewport receipt after two paint opportunities. LoAF records are drained after the phase. Arrival-frame statistics include completed frames after response arrival and before that page's filled receipt; the next scroll can begin in the same task as the receipt, so its later-ending frame is attributed to the overall traversal instead. The whole-traversal maximum includes every scroll and the final movement to the beginning. Raw data retains the timestamps and the original overinclusive prototype field; analyze.py reconstructs the completed-arrival metric. Frames below the browser's 50 ms LoAF threshold are conservatively reported as at most 50 ms.

Bytes below are actual history response JSON bytes. Compression is a separate level-1, fresh-context permessage-deflate estimate, excluding WebSocket/TLS overhead; the mock transport does not negotiate compression. Estimates run outside the measured interval. Profiled setup runs and the two superseded boundary-calibration attempts are excluded from the curve.

Curve

Times are milliseconds, shown as median [Q1, Q3] across seven runs. Arrival is each run's worst completed arrival frame. Fill is each run's median per-page fill. Byte totals cover history responses only.

History Budget (MiB) Pages Total traversal ms Worst arrival frame ms Fill/page ms Largest raw page MiB Total raw / deflate estimate MiB
normal 1 17 6068.7 [5966.2, 6092.2] 194.7 [184.4, 198.3] 160.3 [157.3, 165.4] 0.999 16.319 / 2.736
normal 2 9 3737.0 [3723.8, 3754.3] 213.3 [205.2, 214.5] 185.7 [180.4, 189.4] 2.001 16.303 / 2.725
normal 3 6 2811.9 [2795.5, 2848.2] 193.2 [188.7, 203.2] 186.0 [182.2, 191.9] 3.002 16.297 / 2.722
normal 5 5 2585.8 [2563.8, 2610.3] 223.9 [217.5, 228.9] 205.4 [193.5, 209.4] 4.057 16.295 / 2.721
tool-heavy 1 19 6550.1 [6490.3, 6585.2] 141.7 [139.3, 142.7] 135.5 [132.8, 140.2] 1.002 18.572 / 3.086
tool-heavy 2 10 4247.7 [4242.6, 4282.6] 171.0 [163.8, 173.9] 160.3 [155.1, 162.5] 2.002 18.555 / 3.074
tool-heavy 3 7 3451.4 [3339.4, 3508.5] 174.4 [168.9, 200.8] 167.7 [165.2, 169.2] 2.981 18.549 / 3.068
tool-heavy 5 7 3507.9 [3422.8, 3551.4] 172.8 [168.1, 178.9] 168.1 [167.0, 171.8] 2.981 18.549 / 3.068

The tool-heavy 3 and 5 MiB requests return the same pages: the 1,000-message cap binds at about 2.981 MiB. Normal 5 MiB requests bind at about 4.057 MiB. Response envelopes can slightly exceed the message-only budget.

Every larger budget improves total traversal with non-overlapping IQRs and all seven paired deltas below zero. None passes the arrival-frame gate. At 2 MiB, tool-heavy traversal improves 6.55 → 4.25 s and 19 → 10 pages, while worst-arrival median rises 141.7 → 171.0 ms (all seven pairs worse, non-overlapping IQRs). At 3 MiB it reaches 3.45 s / 7 pages, but arrival rises to 174.4 ms. Compression saves roughly 6× in estimated bytes; it does not remove the render work.

Paired deltas against 1 MiB

Candidate minus baseline, in round order. All values are milliseconds. No slow sample was discarded.

History Budget Total traversal deltas Worst arrival-frame deltas Whole-traversal maximum-frame deltas
normal 2 -2185.3, -2328.3, -2196.8, -2390.1, -2362.5, -2367.9, -2227.5 -3.8, +12.3, +31.3, +32.0, +7.1, +30.0, -10.5 -3.8, +12.3, +31.3, +32.0, +7.1, +30.0, -10.5
normal 3 -3116.0, -3224.0, -3172.2, -3181.4, -3279.0, -3293.9, -3186.8 -32.0, -5.1, +10.0, +3.6, +8.5, +23.3, +2.8 -32.0, -5.1, +10.0, +3.6, +8.5, +23.3, +2.8
normal 5 -3354.0, -3415.7, -3344.3, -3510.7, -3573.5, -3519.2, -3367.6 +13.1, +30.2, +27.4, +37.1, +46.7, +31.0, +23.6 +13.1, +30.2, +27.4, +37.1, +46.7, +31.0, +23.6
tool-heavy 2 -2341.0, -2342.2, -2309.1, -2114.6, -2273.7, -2287.2, -2210.5 +3.2, +33.9, +35.4, +26.5, +33.2, +18.7, +14.1 +3.2, +20.1, +13.4, -40.1, +26.1, +13.1, -1.3
tool-heavy 3 -3279.9, -3047.7, -2946.6, -2977.0, -3168.2, -3368.1, -3003.3 +13.2, +36.4, +36.5, +60.9, +22.7, +24.0, +57.2 +13.2, +25.1, +14.5, -16.8, +15.6, +18.4, +44.8
tool-heavy 5 -2949.7, -3262.9, -2985.1, -2921.3, -3013.5, -3194.5, -3002.4 -5.6, +28.6, +37.2, +33.5, +26.9, +22.0, +41.8 +2.0, +22.8, +15.2, -44.2, +34.6, +48.4, +26.4

Reload control

All 56 reloads issue zero boot chat.history calls and one unchanged 38,763-byte chat.startup response. This synthetic response does not model the live retained-receipt fast path. No reload timing metric regresses under the campaign's non-overlapping-IQR or ≥6/7 paired-sign-plus-size rule. The occasional slow paints remain in the data. Because the budget override activates after reload, these are unchanged-code controls, not a shipped-candidate reload proof.

History Budget FCP ms LoAF blocking ms Worst reload frame ms
normal 1 384.0 [380.0, 404.0] 237.0 [226.0, 280.5] 170.0 [166.5, 172.5]
normal 2 380.0 [374.0, 394.0] 230.0 [216.5, 248.5] 169.0 [165.0, 171.0]
normal 3 372.0 [370.0, 490.0] 272.0 [243.5, 300.5] 171.0 [167.5, 247.0]
normal 5 388.0 [378.0, 494.0] 246.0 [226.5, 276.5] 167.0 [164.5, 252.5]
tool-heavy 1 384.0 [376.0, 402.0] 248.0 [239.0, 267.5] 174.0 [169.5, 179.5]
tool-heavy 2 376.0 [354.0, 380.0] 233.0 [222.5, 299.0] 165.0 [164.0, 205.5]
tool-heavy 3 404.0 [390.0, 404.0] 237.0 [228.5, 256.5] 170.0 [167.5, 172.0]
tool-heavy 5 376.0 [374.0, 390.0] 246.0 [224.5, 281.0] 167.0 [165.0, 171.0]
History Budget FCP deltas Blocking deltas Worst-frame deltas
normal 2 -196.0, +0.0, -24.0, -4.0, +28.0, -12.0, +20.0 -92.0, -13.0, -24.0, +1.0, -22.0, -41.0, +38.0 -161.0, -6.0, +4.0, -1.0, +24.0, -8.0, +1.0
normal 3 -204.0, -8.0, -36.0, +192.0, +212.0, +20.0, -28.0 -29.0, -13.0, +18.0, +85.0, +104.0, -52.0, +11.0 -160.0, +4.0, +5.0, +153.0, +178.0, -6.0, -4.0
normal 5 -184.0, +232.0, -36.0, +24.0, +204.0, -16.0, -16.0 -79.0, +73.0, -30.0, -41.0, +94.0, -61.0, +29.0 -160.0, +171.0, -2.0, -2.0, +175.0, -12.0, -4.0
tool-heavy 2 -48.0, -52.0, -24.0, -8.0, +4.0, +44.0, -32.0 +103.0, +95.0, -28.0, -17.0, -21.0, -99.0, -24.0 +69.0, +80.0, -10.0, -3.0, -13.0, -80.0, -10.0
tool-heavy 3 +20.0, -8.0, -4.0, +192.0, +32.0, +72.0, -28.0 -18.0, +26.0, -46.0, +107.0, -3.0, -108.0, -17.0 -15.0, +3.0, -1.0, +171.0, -7.0, -76.0, -3.0
tool-heavy 5 -48.0, +16.0, -32.0, -16.0, +32.0, +44.0, -32.0 +115.0, +54.0, -55.0, +33.0, -21.0, -86.0, -51.0 +62.0, +8.0, -10.0, +2.0, -11.0, -80.0, -14.0

Attribution and limits

Source-mapped --cpu-profile captures execute requestOlderChatHistoryPage, performOlderMessagesLoad, the pane projection, and the real transcript render path. On the 1 MiB diagnostic runs, Solid flush contains 65.4% of sampled normal-history work and 62.1% of tool-heavy work. maxTranscriptScrollOffset accounts for 19.4% and 15.5% self time; its principal chain is syncHistoryObserver → isMaintenanceScroll → transcript geometry. The supplied live source-mapped frame places the same geometry function at 12.3% of sampled busy time. This demonstrates the relevant hot path at a comparable share, while the synthetic long histories and controlled scroll pattern limit extrapolation to a particular live conversation.

The immediate history-apply function accounts for only 0.9–1.5% inclusive time in those diagnostic runs. The evidence points to render/layout work, not a large synchronous history-apply loop. It does not prove that a slicing change at the request owner would remove that cost, and no scheduling, caching, or transport workaround was added. Remaining rendering cost is not claimed to be inherent.

The separate 2 MiB --cpu-profile-compare captures preserve that attribution: Solid flush contains 58.1% (normal) and 54.8% (tool-heavy), direct history application 1.0% and 1.4%, and transcript geometry 15.4% and 12.8%. Median synchronous message dispatch is approximately 11.0 and 10.2 ms. These profiles are diagnostic, not samples in the timing table.

Frozen curve probe hashes:

  • older.init.js: c918ec138a7155a8ca7de9d181e30668267801df6923e1e1baef190458a8c2c4
  • history.ts: c8e7ffb9dc92dfe5751a79e23908cec244c8251a76cdea74fc1072253f0649c3
  • Instrumented benchmark: 7e46ebab39e7442a7adeefc50041295476cfe4230c8e4f248b4ee3ac207722d4

Validation and disposition

The UI production build and startup-asset budget checks passed on AWS. Both history shapes reached their beginning in all 56 unprofiled runs; exact source/mode, seven pairs per cell, page counts, response count, and viewport progress were checked. Separate profile captures passed. The local proof scripts passed Python/JavaScript/shell syntax checks and git diff --check passed.

No production UI file changed, so no regression test or full UI suite was added/run for a candidate that is being rejected. The experiment-note commit received a clean P0–P2 autoreview. Its exact-head GitHub checks finished with 7 pass, 53 skip, 0 fail; those checks do not validate the ignored benchmark prototype.

Proof files are under .local/l142/: analysis.json, curve/, curve.log, profile-anchor/, the benchmark extension (history.ts, older.init.js, patch-bench.py), measure.sh, and analyze.py. The local source worktree stays on the lane branch. No real account, private capture, live Gateway, schema, or stored server shape was used or modified.

Lead follow-up: reduce the transcript commit/render cost before raising the page budget, or explicitly choose a higher responsiveness budget. This lane supplies no passing larger default.

@clawsweeper

clawsweeper Bot commented Oct 18, 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 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 Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds a plan to compare older-history page budgets while preserving initial conversation loading.

Example: Scroll backward through a long conversation with a 1 MiB older-history budget.

  • Before: The application requests older history using the existing budget.
  • After: Application behavior is unchanged; the note proposes comparing 1, 2, 3, and 5 MiB budgets.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused and coherent experiment note with no identified defect; its explicit non-merging status remains appropriate.
Proof confidence 🌊 off-meta tidepool Not applicable: Only an experiment description is added, so there is no changed application behavior requiring runtime proof at this revision.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Docs · Worth it: Yes · Fix scope: Complete
User problem: Repeated older-history arrivals may make scrolling through long conversations slow.
Reason: The approved experiment direction tests a concrete performance tradeoff while preserving startup behavior and making no premature runtime change.

Merge readiness

✅ Ready for maintainer review

Keep this PR open as the explicitly non-merging experiment draft; the documentation-only diff introduces no application defect.

Priority: P3
Reviewed head: 090fe184415c30d3b30b0c486aa18e1686cbbb11

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI history request owner sends paginated chat.history requests to the Gateway and supplies returned messages to the conversation view.

flowchart LR
  A[Reader scrolls backward] --> B[Control UI history owner]
  B --> C[Gateway chat history]
  C --> D[Older message page]
  D --> E[Conversation view]
Loading

Technical review

Best possible solution:

Retain the experiment draft until its owner records the comparison and selects any production change supported by the results.

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

This PR proposes measurement rather than reporting or fixing a reproducible defect; no target code was executed.

Is this the best way to solve the issue?

The note is a minimal experiment description using the existing history owner, with no unnecessary production machinery or test scaffolding.

AGENTS.md: found and applied where relevant.

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

Security

None.

Evidence

What I checked:

  • Pinned introduced diff: The PR adds only the experiment description; it changes no runtime code, tests, configuration, or automation. (.local/l142/EXPERIMENT.md:3, 090fe184415c)
  • Explicit experiment hold: The note explicitly withholds merging pending measured results and a reviewed implementation; the live PR remains draft and its body says no application change exists yet. (.local/l142/EXPERIMENT.md:5, 090fe184415c)
  • Current history budgets: Current main separates the 80-message, 256 KiB startup request from older-history pages capped at 1,000 messages and 1 MiB. (ui/src/pages/chat/chat-history-request.ts:45, acdbc6017d6d)
  • Feature ownership history: History identifies Peter Steinberger across history-loading changes and the benchmark's creation and subsequent CPU-attribution work, supporting routing this experiment to steipete. (scripts/bench-control-ui-cold-load.ts, ec430f5cd126)
  • Inspection limits and policy: Root AGENTS.md and the required simplification instructions were read; neither changed-path ancestor has additional instructions, and maintainer notes are absent. Historical content searches encountered unavailable promisor objects, so no exact introduction attribution is asserted. (AGENTS.md, 090fe184415c)

PR surface

Docs +5. Total +5 across 1 file. Added test files: 0.

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

Labels

Label changes:

  • add P3: This is a documentation-only performance experiment with no current user-facing behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a documentation-only performance experiment with no current user-facing behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 18, 2026, 4:16 PM ET / 20:16 UTC.

@steipete steipete closed this Oct 18, 2026
@RomneyDa
RomneyDa deleted the steipete/coldload-older-page-size branch October 22, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant