Repository navigation
fix(control-ui): stop history refill during warm reload - #175171
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 maintainer review before merge. What this changesThe 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +32, Docs +1. Total +35 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 17, 2026, 2:07 AM ET / 06:07 UTC. |
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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…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.
…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.
…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.
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. Baseline5b5a59508a81; candidatee2f0296a88f916df930072f861ec17341f8a6e5f. 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 requestschat.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) tosyncHistoryObserver, with the refill driving transcript reconciliation and geometry work.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.
Boot RPC counts are identical across all pairs except history:
chat.history1 → 0,sessions.messages.subscribe1 → 1,sessions.describe2 → 2,models.list1 → 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, andchat-history-empty-tailpassed 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-activationandworkboard-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 withFsSafeError: file identity changed or could not be verifiedwhile 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 withPrivate 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-changedpassed 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 untouchedchat-message.test.tsx,config-page-state.ts, andsessions-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.