Skip to content

fix(control-ui): stop history refill during warm reload - #175171

Merged
steipete merged 1 commit into
mainfrom
steipete/coldload-bounded-snapshot-boot-refill
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/coldload-bounded-snapshot-boot-refill

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an automatic history refill immediately after a signed-in dashboard deep-link reload restores a bounded transcript cache. The refill downloads up to 1 MiB and replaces the just-restored 80-row window without reader input.

User Impact

Warm reload retains the cached transcript. Upward scrolling or Show earlier still refills the authoritative window and backscrolls through the entire conversation. Normal nonzero viewport-fill pagination remains available.

Why This Change Was Made

The bounded cache introduced in #174593 marks a trimmed window with hasMore: true, nextOffset: 0. A collapsed tool tail can genuinely fit within the viewport, so the existing IntersectionObserver starts automatic filling after layout settles. The history owner now uses its existing reader-intent argument to reserve offset-zero refill for reader navigation.

Production delta: +2 lines (7 added, 5 removed), from extending the existing condition and documenting the marker. No additional owner or state is introduced. The automatic route no longer has permission to consume that marker.

Evidence

Eleven interleaved A/B pairs on one quiet AWS c7a.4xlarge lease, cbx_f1c058687b2a (16 cores, AMD EPYC 9R14, about 30 GiB RAM), headless repository Playwright Chromium. Baseline 5b5a59508a81; candidate e2f0296a88f916df930072f861ec17341f8a6e5f. Both use the Team-scale production-bundle bench, a schema-v8 IndexedDB 80-message cache (169,490 B), a collapsed tool tail, 350 ms simulated wire latency, and 4 ms frame spacing. Measurement runs are untraced; separate profiles establish attribution.

The baseline observer sees one rendered row with scrollHeight === clientHeight === 1017, and requests chat.history offset=0 limit=1000: 1,045,072 response bytes, 397 rows within the response byte cap. Candidate issues no boot history request. The mapped baseline profile attributes about 160 ms (4.9% of sampled busy time) to syncHistoryObserver, with the refill driving transcript reconciliation and geometry work.

Metric, ms: median [Q1, Q3] Baseline Candidate
LoAF blocking 880 [847.5, 886.5] 350 [340.5, 353]
Message-delivery scripts 781 [760.5, 807.5] 225 [210.5, 229]
Forced layout in delivery scripts 184 [177, 188] 2 [2, 2]
First contentful paint 656 [656, 656] 656 [640, 656]

LoAF blocking improves 60.2%, with non-overlapping IQRs and 11/11 better pairs (median paired delta −526 ms). Message-delivery work improves 71.2%. The mock socket delivers through timers; delivery cost is the LoAF script duration, including reconciliation microtasks, matched to the existing delivery callback start times. It is the bench equivalent of native WebSocket onmessage attribution, not a measurement of network transport time.

Pair Blocking baseline Blocking candidate Blocking Δ Delivery Δ FCP Δ
1 792 345 -447 -511 0
2 886 360 -526 -560 -32
3 844 354 -490 -545 0
4 883 328 -555 -609 0
5 901 337 -564 -590 -16
6 851 352 -499 -543 0
7 887 356 -531 -574 0
8 864 342 -522 -525 -16
9 880 350 -530 -562 16
10 806 352 -454 -519 16
11 890 339 -551 -611 -24

Boot RPC counts are identical across all pairs except history: chat.history 1 → 0, sessions.messages.subscribe 1 → 1, sessions.describe 2 → 2, models.list 1 → 1. The recorded lineage describe precedes the refill and belongs to sidebar lineage discovery. The extra live subscription was not reproduced; its owners are selected-session subscription and the shared subscription coordinator. Those paths remain outside this fix.

Validation: all 73 focused autofill/history/snapshot unit tests passed (3 files, 18.41 s command wall time); all 20 tests in warm-boot, claude-sessions, chat-history-stale-geometry, and chat-history-empty-tail passed on the lease (56.69 s command wall time). The native warm-boot cases cover released cache upgrade, native/imported backscroll, and the new short-tail reload. The regression fails before the fix with the offset-zero 1,000-row request, and passes after.

Local changed-test cost with --maxWorkers=1: autofill file 11.38 s wall / 13 tests; native short-tail case 30.26 s wall including production build, 3.76 s test time. Autoreview is clean through P2.

The full UI E2E suite ran on this exact head: 815 files passed, 4 failed, 1 skipped; 3,540 tests passed, 2 failed, 5 skipped (62m15s test duration). Failure classification and scoped follow-up on the same lease:

  • tooltip-first-activation and workboard-native-bundle: their suite setup required WebKit, which was absent. Installed repository Playwright WebKit and reran both; passed.
  • control-ui-stale-build-reload: plugin-settings preparation failed before browser launch with FsSafeError: file identity changed or could not be verified while standalone builds overlapped. The four-file standalone group passed on pinned main (26 tests). The candidate stale-build case passed with builds serialized. No source change was made for this transient build failure.
  • extensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.ts: one case failed with Private mutation boundary is writable by another POSIX principal. The identical case and error reproduce on pinned main; the sibling case passes on both. Left outside this history fix.

The two WebKit files plus candidate stale-build reload passed together: 3 files / 5 tests, 69.38 s test duration. The full suite was not rerun after fixing those prerequisites; its original result above remains the broad-run record.

check-changed passed changed-file formatting, lint, UI typecheck, all ten selected core-test typecheck graphs, i18n, and UI/declaration guards. It exited 1 for two inherited full-tree checks, both reproduced on pinned main: max-lines suppressions in untouched chat-message.test.tsx, config-page-state.ts, and sessions-page-state.ts; and the dead-export scan. Every candidate dead-export diagnostic also appears on baseline (baseline reports additional entries). No baseline exceptions were added.

Exact-head CI run 39008818658 is green: all 55 jobs successful, head e2f0296a88f916df930072f861ec17341f8a6e5f. The ready PR remains unmerged for campaign-lead review.

Before: synthetic dashboard after automatic history refill
After: synthetic dashboard retains its cached tail

@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: S 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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. 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
@steipete steipete changed the title experiment(control-ui): keep bounded history refill for reader intent [do not merge] fix(control-ui): stop history refill during warm reload Oct 17, 2026
@steipete
steipete marked this pull request as ready for review October 17, 2026 06:08
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR prevents automatic viewport filling from consuming a bounded transcript cache’s refill marker while preserving reader-triggered history loading.

Example: A warm reload restores 80 cached messages that collapse into one visible row.

  • Before: Automatic viewport filling requests offset 0 with a 1,000-message limit.
  • After: The cached tail remains visible until upward reader input or Show earlier requests the refill.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported fix with useful production-UI captures and regression coverage; supplied runtime evidence is strongest for the visible retained-tail result.
Proof confidence 🐚 platinum hermit (4/6) Maintainer-authored PR outside the ordinary contributor proof gate; inspected production-UI screenshots support retained-tail behavior, while request counts and reader-triggered refill are reported in prose and tests rather than a supplied runtime trace.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Reloading a dashboard can expand its restored transcript and download older history before the reader asks for it.
Reason: The maintainer-authored direction restores the documented reader-triggered refill contract with a focused change in the existing owner.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a source-confirmed reload overfetch in the existing history owner, with no actionable introduced defect found; the maintainer-authored draft remains explicitly on hold.

Priority: P2
Reviewed head: e2f0296a88f916df930072f861ec17341f8a6e5f

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI history owner receives transcript geometry, reader input, and cached pagination, then requests Gateway history and reconciles returned messages into the transcript.

flowchart TD
  A[Browser snapshot cache] --> B[Restored transcript]
  B --> C[History owner]
  D[Viewport observation] --> C
  E[Reader navigation] --> C
  C --> F[Gateway history request]
  F --> G[Transcript reconciliation]
Loading

Technical review

Best possible solution:

Keep refill admission in the existing history owner, preserving the cached tail until reader navigation while retaining ordinary short-window filling.

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

The snapshot producer, settled short-window observer, and current-main loader establish the reported path; the author supplies production-bundle before/after screenshots, but this read-only review executed no target code.

Is this the best way to solve the issue?

The narrow check uses the existing refill marker and intent argument, preserving positive-offset automatic filling, catalog loading, explicit pagination, and reader prefetch without new state.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Automatic history filling and prefetch keeps the original intent (b410516: Fill genuinely short settled conversations with a three-page budget while reserving staged prefetch for upward reader input.)
  • Bounded snapshot refill, warm-boot fixtures, and documentation keeps the original intent (c9b110b: Persist a recent transcript window and refill from authoritative offset zero when the reader requests older history.)
  • Native scalar-offset pagination keeps the original intent (54e50ba: Use the Gateway’s monotonic scalar-offset contract while preserving explicit Show earlier and automatic stable-anchor loading.)

Testing

Proof path: shipped entry point.

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)

PR surface

Source +2, Tests +32, Docs +1. Total +35 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 7 5 +2
Tests 2 35 3 +32
Docs 1 3 2 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 45 10 +35

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A bounded warm reload can unnecessarily fetch a large history window and change the visible transcript, while explicit in-product pagination remains available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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, 2:07 AM ET / 06:07 UTC.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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-17T06:11:35.157985Z e2f0296 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

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. labels Oct 17, 2026
@steipete
steipete merged commit 3a539a9 into main Oct 17, 2026
189 of 191 checks passed
@steipete
steipete deleted the steipete/coldload-bounded-snapshot-boot-refill branch October 17, 2026 07:37
steipete added a commit that referenced this pull request Oct 17, 2026
…175437)

The pane's boot viewport-fill autoload paged older history until the transcript was taller than the viewport plus the 1,200 px prefetch edge, up to three pages. Tool-heavy agent sessions collapse hundreds of raw messages into a few short rows, so that target can be unreachable: on Team, an 820-message session whose whole history renders ~2,126 px on a 1,403 px-tall window downloaded every page on every warm reload (1.05 MB + 1.05 MB + 265 KB). chat.history is about half of all Gateway response bytes at peak.

Without reader intent the autoload now fills at most once, and only while the transcript is shorter than the viewport itself; further paging and the prefetch margin belong to reader intent (an upward scroll), which still pages through to the beginning. The offset-0 refill rule from #175171 is unchanged.

Eleven interleaved AWS c7a.4xlarge pairs, tool-heavy warm reload: older-history RPCs 3 -> 1; response bytes 2,520,253 -> 1,107,704 (-56%); visible growth steps 7 -> 4; LoAF blocking 765 -> 645 ms (11/11 pairs better). Normal sessions: the changed path issues no requests; normal-large-warm 848 -> 896 ms with overlapping IQR and mixed pair signs (noise), normal-small-warm 649 -> 622 ms. Runtime -1 LOC. New autofill unit test and history-loading/empty-tail e2es assert one automatic boot page and full backscroll. 62 focused tests pass; exact-head CI green; full-UI failures reproduce on main.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…nclaw#175171)

openclaw#174593 bounded cached chat snapshots and marked trimmed windows with an offset-0 refill for the first upward scroll. The pane's viewport-fill autoload also treats that marker as older history, so every warm reload of a session whose cached tail fits the viewport (tool-heavy agent sessions collapse 80 raw messages into one visible row) paged through the whole history at boot. On Team r149 one 820-message session downloaded 1.05 MB + 1.05 MB + 498 KB in three sequential chat.history requests and grew the transcript in five visible steps; chat.history is already ~50% of Gateway response bytes.

The offset-0 refill is now reserved for reader intent: automatic viewport fill no longer consumes it, while ordinary older pages and backscroll through all messages are unchanged.

Eleven interleaved AWS c7a.4xlarge pairs, warm reload of a trimmed cache: boot chat.history 1 -> 0; LoAF blocking 880 -> 350 ms (-60%, every pair, non-overlapping IQR); message-delivery work 781 -> 225 ms; delivery forced layout 184 -> 2 ms. Runtime +2 LOC. New autofill regression test and warm-boot e2e assert no boot chat.history on a warm trimmed cache and a single offset-0 refill on reader intent. 73 unit + 20 native e2e tests pass; all 55 exact-head CI jobs green.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…penclaw#175437)

The pane's boot viewport-fill autoload paged older history until the transcript was taller than the viewport plus the 1,200 px prefetch edge, up to three pages. Tool-heavy agent sessions collapse hundreds of raw messages into a few short rows, so that target can be unreachable: on Team, an 820-message session whose whole history renders ~2,126 px on a 1,403 px-tall window downloaded every page on every warm reload (1.05 MB + 1.05 MB + 265 KB). chat.history is about half of all Gateway response bytes at peak.

Without reader intent the autoload now fills at most once, and only while the transcript is shorter than the viewport itself; further paging and the prefetch margin belong to reader intent (an upward scroll), which still pages through to the beginning. The offset-0 refill rule from openclaw#175171 is unchanged.

Eleven interleaved AWS c7a.4xlarge pairs, tool-heavy warm reload: older-history RPCs 3 -> 1; response bytes 2,520,253 -> 1,107,704 (-56%); visible growth steps 7 -> 4; LoAF blocking 765 -> 645 ms (11/11 pairs better). Normal sessions: the changed path issues no requests; normal-large-warm 848 -> 896 ms with overlapping IQR and mixed pair signs (noise), normal-small-warm 649 -> 622 ms. Runtime -1 LOC. New autofill unit test and history-loading/empty-tail e2es assert one automatic boot page and full backscroll. 62 focused tests pass; exact-head CI green; full-UI failures reproduce on main.
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 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. docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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