Skip to content

perf(control-ui): bound automatic history fill to one viewport page - #175392

Closed
steipete wants to merge 1 commit into
mainfrom
steipete/coldload-boot-fill-to-viewport
Closed

steipete wants to merge 1 commit into
mainfrom
steipete/coldload-boot-fill-to-viewport

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Bounds automatic older-history downloads when a signed-in operator reloads a dashboard or chat deep link with a short collapsed transcript.

User Impact

The change permits at most one automatic older page, using the viewport itself as the fill target. Further history, including the offset-zero bounded-cache refill, requires reader intent. Upward paging keeps its 1,200 px prefetch margin. Very short transcripts may leave unused space until the reader scrolls up or chooses Show earlier.

Why This Change Was Made

The previous implementation allowed three boot pages and expanded the target to viewport + 1,200 px after page one. A collapsed history shorter than that target kept downloading through the cap. A single attempted-fill Boolean replaces the counter and expanded-margin branch. Production LOC: 8 added / 9 removed, net −1. No Gateway schema, stored-shape, config, or protocol changes.

Evidence

The campaign observed about 2.7 MB of older-history responses on a signed-in dashboard deep-link reload. The synthetic Team-scale fixture reproduces three automatic pages at offsets 79, 404, and 729 (2,520,253 bytes), with the full collapsed history about 2,106 px tall. The first older page reaches 1,461 px versus a 1,238 px transcript viewport, yet the baseline continues toward the unreachable 2,438 px target. A source-mapped profile confirms syncHistoryObserver → loadOlderMessages → performOlderMessagesLoad. The fix stops after that first page.

Quiet AWS: c7a.4xlarge, 16 observed CPUs / 30 GiB RAM, repo Playwright Chromium. Final comparison lease cbx_54c79cb77899, run run_c3c61a2b046924f91642fed9a148dc78; one fixed instance for all 116 valid runs. Eleven interleaved pairs per tool-heavy case; seven per normal case. Unprofiled timing runs use a row-count-only growth probe with no geometry reads. The primary LoAF gate is the Team-size warm reload; the remaining cases use the campaign no-regression rule. Cold means an empty persisted transcript cache; browser assets remain warmed by the setup navigation.

LoAF blocking in ms: median [Q1, Q3].

Case Baseline Candidate Candidate faster Median paired delta
normal-large-warm 848 [766.5, 884.5] 896 [840.5, 936.5] 2/7 53 ms
normal-small-warm 649 [636, 975] 622 [600.5, 634] 6/7 -54 ms
tool-large-cold 763 [739.5, 786.5] 630 [582, 679.5] 10/11 -152 ms
tool-large-warm 765 [714, 824.5] 645 [634.5, 696.5] 11/11 -116 ms
tool-small-cold 577 [559, 814] 571 [539.5, 588.5] 8/11 -46 ms
tool-small-warm 666 [622, 949.5] 654 [625, 777] 4/11 11 ms

In both large tool-heavy cases, older-history RPCs fall 3 → 1, raw response bytes 2,520,253 → 1,107,704 (−56.0%), and observed row-growth steps 7 → 4. Both small tool-heavy cases fall 2 → 1 RPC, 2,208,852 → 1,107,704 bytes (−49.9%); row-growth steps remain 5. Normal cases make zero older-history requests in both versions and retain the same growth-step count. Large warm FCP is 444 ms in both versions; large normal FCP is 484 ms in both.

The normal large-session increase is noise under the updated campaign rule: its IQRs overlap ([766.5, 884.5] versus [840.5, 936.5]), and only 5/7 pairs are worse, below the 6/7 threshold. Both versions issue zero older-history requests in this case, so the changed fill path has identical behavior. Normal-small improves 649 → 622 ms (6/7 pairs). A secondary regression requires non-overlapping IQRs or at least 6/7 (9/11) worse pairs; none of these cases meets that criterion. The primary large tool-heavy warm case improves in all 11 pairs and has non-overlapping IQRs.

All per-pair LoAF deltas (candidate − baseline, ms)
  • normal-large-warm: -113, +497, +27, +116, -341, +53, +116
  • normal-small-warm: -6, -483, -16, -370, +2, -317, -54
  • tool-large-cold: -214, -281, -187, -132, -81, -86, -229, -152, -51, -171, +166
  • tool-large-warm: -82, -215, -465, -456, -125, -134, -116, -13, -78, -47, -51
  • tool-small-cold: -215, -46, -298, +20, -232, -241, -234, -27, +13, +45, -31
  • tool-small-warm: +5, +21, -394, +304, -438, +171, +11, -278, +34, -80, +35

Correctness and validation

Rebased on current main, retaining #175393's startup-cursor fix. Focused autofill and history units pass (13 + 29 tests). The two changed autofill assertions were verified to fail against the previous three-page implementation. Fresh full UI E2E, changed-file checks, and independent review through P2 are in progress; final results will be recorded here.

The retained performance comparison predates this rebase. No measurement timings were taken on the loaded Mac. Initial harness attempts and the first timing batch are excluded: bundle identity needed matching, the tool-heavy fixture needed transcript readiness rather than a header-title assertion, and the growth probe needed layout-free counting. All measurement leases were stopped. No private capture was uploaded.

Release-note context: avoid downloading the full collapsed history during a Control UI reload while preserving reader-driven backscroll.

Before: synthetic tool-heavy reload downloads three older pages

After: synthetic tool-heavy reload stops after one older page

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: M labels Oct 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR limits automatic chat-history filling to one attempted older page while preserving reader-driven pagination.

Example: A short chat starts at offset 2 and its first older page advances to offset 6 without filling the viewport.

  • Before: Boot automatically requests offset 6 and may fetch a third page.
  • After: Boot stops after offset 2; scrolling upward or choosing Show earlier continues at offset 6.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch appears correct, with useful reported browser coverage, but its intended performance benefit remains unmeasured.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored experiment is outside the ordinary contributor proof gate; reported cold/warm reload and empty-tail runs use a mocked Gateway, and comparative reload evidence is explicitly pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Reloading a collapsed or sparse conversation can download multiple older pages without reader input.
Reason: The area owner's experiment explicitly chooses reduced boot traffic over repeatedly filling short transcripts, with visible Show earlier recovery and no new setting.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored experiment open and honor its explicit do-not-merge hold; current main retains three-page boot filling, and inspection found no concrete introduced defect.

Priority: P2
Reviewed head: 7e82c51abf6aa9226f32018be87e6f245b6b411a

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Comparable production-bundle reload measurements and inspected before/after captures remain pending; the body reports base-failing unit assertions and passing mocked-Gateway browser cases.
Agent review details

How this fits together

The Control UI history owner combines settled transcript geometry and reader intent to request older Gateway history pages and prepend them to the conversation.

flowchart LR
  A[Chat startup] --> B[Transcript placement]
  B --> C[History owner]
  D[Reader input] --> C
  C --> E[Gateway history request]
  E --> F[Transcript messages]
  F --> B
Loading

Technical review

Best possible solution:

Conclude the bounded-fill experiment with comparable reload evidence while retaining the existing history owner and reader-controlled recovery.

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

Current main demonstrably permits three automatic pages for an underfilled transcript; the PR reports a matching three-request reload, but no target code was executed during this review.

Is this the best way to solve the issue?

The change directly bounds unsolicited downloads in the existing owner without adding policy layers or disturbing reader intent, staged prefetch, failure handling, or offset-zero refill protection.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Automatic history allowance and associated regressions changes intended behavior with a stated reason (b410516: Bound short-chat filling to three pages, include the prefetch margin, and avoid unused staged boot requests after restoring underfilled-chat loading.)
  • Empty and hidden-only history recovery changes intended behavior with a stated reason (a6a8754: Prevent existing conversations from appearing as new chats and recover visible earlier messages through pagination.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b410516 adds ui/src/pages/chat/chat-pane-history.ts:268 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b410516f5bd6; files: ui/src/pages/chat/chat-pane-history.ts)
  • RoboClaw: Raw commit a6a8754 adds ui/src/e2e/chat-history-empty-tail.e2e.test.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: a6a875496221; files: ui/src/e2e/chat-history-empty-tail.e2e.test.ts)

PR surface

Source -1, Tests +28, Docs +2. Total +29 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 8 9 -1
Tests 3 183 155 +28
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 193 164 +29

Review metrics

Metric Value Why it matters
Production versus test changes Production +8/-9; tests +183/-155 Production simplifies the existing allowance; test growth primarily adds cold/warm reload coverage and updates empty-page reader navigation.

Labels

Label changes:

  • add P2: Avoidable history downloads affect reload efficiency, while existing reader controls preserve access to older messages.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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:

  • P2: Avoidable history downloads affect reload efficiency, while existing reader controls preserve access to older messages.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide comparable reload request counts and performance results, with sanitized before/after captures showing reader-driven continuation.

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 17, 2026, 5:51 AM ET / 09:51 UTC.

@steipete steipete closed this Oct 17, 2026
@steipete steipete changed the title experiment(control-ui): bound boot history fill [do not merge] perf(control-ui): bound automatic history fill to one viewport page Oct 17, 2026
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 docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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