Repository navigation
perf(control-ui): keep cached transcripts steady on reload - #170052
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 changes before merge. What this changesThis PR preserves cached transcript rows, widget heights, and reading position while history and connection recovery settle. Example: Reload a cached 50-message conversation containing a widget previously measured at 700 px.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this PR repairs an evidenced cached-reload defect still present on main, with no actionable introduced bug found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI reconciles account-scoped browser snapshots with Gateway history, then supplies retained messages and measured geometry to the transcript virtualizer. flowchart TD
A[Conversation reload] --> B[Scoped browser snapshot]
A --> C[Gateway history]
B --> D[Bounded publication join]
C --> D
D --> E[Retained message rows]
E --> F[Measured reading position]
F --> G[Visible transcript]
Technical reviewBest possible solution: Land the repair through the existing history and transcript owners after completing the explicitly retained validation hold. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the cache/history ordering path, and the supplied browser comparison demonstrates its visual result; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs publication ordering and row identity at their existing owners, preserves saved-reader intent, and bounds stalled cache reads without adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 83598e99a136. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -30, Tests -50, Docs +4. Total -76 across 21 files. Added test files: 0. View PR surface stats
Review metrics
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 HistoryReview history (7 earlier review cycles)
Reviewed October 12, 2026, 5:04 PM ET / 21:04 UTC (Revision 8). |
88598a1 to
aa98916
Compare
aa98916 to
22cc763
Compare
…170052) * perf(control-ui): keep cached transcripts steady on reload * test(control-ui): settle cached reader frame before checking offsets * fix(control-ui): bound cached transcript hydration wait
After a cloud startup failure, a disconnected chat no longer said that the initial message was unresolved or what to do next. 7661ce5 (#170052) dropped the composer band's pending-send fallback so that connection recovery is explained only on the busy Send button. That is right while connected, where Send is held. Offline, Send stays enabled so later turns can enter the outbox, so the unresolved-initial-turn guidance had no remaining surface. Restore the band for the disconnected state only. Connection-recovery notices stay on Send, as #170052 intended. The cloud startup failure e2e assertion returns to the unresolved-initial-message copy. #170436, #170352 and #170477 had retargeted it at the outbox band and then at band absence. A jsdom regression beside the recovery test covers the offline band without the e2e shard.
After a cloud startup failure, a disconnected chat no longer said that the initial message was unresolved or what to do next. 7661ce5 (#170052) dropped the composer band's pending-send fallback so that connection recovery is explained only on the busy Send button. That is right while connected, where Send is held. Offline, Send stays enabled so later turns can enter the outbox, so the unresolved-initial-turn guidance had no remaining surface. Restore the band for the disconnected state only. Connection-recovery notices stay on Send, as #170052 intended. The cloud startup failure e2e assertion returns to the unresolved-initial-message copy. #170436, #170352 and #170477 had retargeted it at the outbox band and then at band absence. A jsdom regression beside the recovery test covers the offline band without the e2e shard.
…aw#170515) After a cloud startup failure, a disconnected chat no longer said that the initial message was unresolved or what to do next. 90ecb48 (openclaw#170052) dropped the composer band's pending-send fallback so that connection recovery is explained only on the busy Send button. That is right while connected, where Send is held. Offline, Send stays enabled so later turns can enter the outbox, so the unresolved-initial-turn guidance had no remaining surface. Restore the band for the disconnected state only. Connection-recovery notices stay on Send, as openclaw#170052 intended. The cloud startup failure e2e assertion returns to the unresolved-initial-message copy. openclaw#170436, openclaw#170352 and openclaw#170477 had retargeted it at the outbox band and then at band absence. A jsdom regression beside the recovery test covers the offline band without the e2e shard.
What Problem This Solves
Fixes transcript movement after reloading a cached conversation when fresh history wins the browser-cache race or connection recovery changes the composer height. The cold-load campaign recorded 14 visible states over roughly 15 seconds for a signed-in reload of a dashboard deep link, with about 80 ms attributed to transcript geometry in a later profile.
User Impact
Cached conversations retain their message rows and learned widget heights as history refreshes. Initial transcript rows become visible at the restored reading position or the end. Send retains its recovery state without briefly expanding the composer with a duplicate notice.
Why This Change Was Made
History dispatch now runs alongside IndexedDB and joins the scoped cache read only before publishing. Identical native history messages keep their object identity. This removes the 300 ms startup budget and its prewarm-readiness plumbing. Initial positioning includes saved readers, and deferred row measurements use the shared layout frame's read/write phases.
The cache join remains cancellable on session/connection changes; cache failure or a missing record releases fresh history. The join now has a 2,000 ms safety bound starting only when history is ready to publish. Expiry retires cache hydration and publishes history, so a stalled IndexedDB read cannot block the authoritative transcript indefinitely and a late cache result cannot overwrite it. Changed content and changed viewport widths can still resize rows.
The focused regression covers a never-settling read and a late-settling read, each after a simulated five-second network delay. It verifies that the full two-second grace period begins at publication, not connection. Completion and cancellation clear the timer. Independent review of this follow-up is clean through P2.
Current head:
22cc763fe9506801c662066f8ea4fe429f7cac8c, rebased onea7604ac5f307a5513cef69cae2cc0edbac717a5.pnpm install --frozen-lockfilecompleted after the rebase. CI on this exact head passed: 40 successful checks, 38 skipped, with the repository watcher reporting green. All 19 warm-startup cases passed, including the never-settling and late-settling regressions (9 ms and 10 ms; whole-file test execution 0.306 s in CI). The three scheduled selected UI E2E shards also passed. Previous-head results below are historical evidence, not a full-suite acceptance of the current head.Evidence
Synthetic reload fixture: 50 messages, a real sandboxed inline widget with a persisted 700 px height, real IndexedDB, 1280×900 viewport, and three seconds of per-frame samples. The comparison was captured on base
927c8b25d016f4fb54ff55c9d6fa3fc004c23716and that base plus this production patch. Subsequent rebases preserved that patch. These measurements predate the safety-bound follow-up and have not been repeated on the current head; current-head CI and the remaining E2E gap are reported separately below.Absolute paint timings are not a speed claim: host load and source-mode asset delivery varied substantially. The stable findings are zero scroll changes across 176/182 frames, preserved mounted-row DOM identities, and the full widget height on every visible frame. Full replacements count DOM identity, not every renderer function invocation. Saved-reader route reentry has separate browser regression coverage; its in-memory offset does not survive document reload.
The attached before/after strip is synthetic-only and was inspected in full. Its upper-right frame deliberately shows history available while the controlled cache result is still held; every subsequent visible transcript frame has the final geometry.
tbx_01m4rfdcn74gqep7azek2vya0x: 212 focused tests across 11 cache/history, snapshot, controller, geometry, and browser-follow files passed. Subsequent changed composer/cache/custody coverage passed (53 tests); the final fixture typing correction passed its 17-test file.node scripts/check-changed.mjs: passed all checks, including typechecks, unused exports, lint, formatting, i18n, and line caps (remote command 15m55s).aa98916e3494f8e73ce84cf1bf6f9e0d9e768958: CI is green (43 passed checks, 36 skipped).tbx_01m4rpqv0ryz0wvcdc47w17ea3, covering cached cold-load, scroll/follow, history hydration/prepend, retained panes, disclosure anchoring, and widgets. This proves current-head behavior; it does not establish which historical failures were fixed by this patch without a baseline comparison.tbx_01m4rk2kj3yg6vyjb8zvkhyhxj; the scroll-cache fixture correction ran ontbx_01m4rm0snvptz8d7vmg0qbnk97after CI exposed its missing animation-frame delivery.Native E2E failure classification
All six previously failing files were replayed locally, one file at a time with one worker, first on current head
22cc763fe9506801c662066f8ea4fe429f7cac8c, then on its exact baseea7604ac5f307a5513cef69cae2cc0edbac717a5. The base used a temporary detached worktree with its own frozen-lockfile install. Runtime: macOS, Node 26.11.1, pnpm 12.9.0.Command for every invocation:
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts <file> --maxWorkers=1.The only initial head-fail/base-pass file was Stop. The slash failure occurred in
pairControlUiPagewhile awaitingdashboard --json, beforepage.goto. The CLI's unchangedwaitForControlUiDocumentuses a two-second loopback HTTP HEAD probe. CLI, pairing, and test sources are identical between revisions, and transcript JavaScript had not executed. The entire file passed both cases on the unchanged-head replay; no timeout override or source fix was introduced. The original button failure did not reproduce on either revision.The original automation permission-sensitive case passed on both revisions without shared-directory permission changes. A separate restart-recovery case failed on both during Doctor/package cleanup. Inspector's head failure was at initial CLI setup; its base reproduced the original 90-second timeout, so neither replay establishes that file's later pairing/reload assertions.
No production change was needed for this classification, and the head remains
22cc763fe9506801c662066f8ea4fe429f7cac8c. Diagnostic artifacts are retained outside the temporary base checkout. One preliminary base automation attempt used an invalid artifact path outside that checkout; it is excluded, and the complete valid rerun is reported above.Native replay wall times
These include native preparation and cleanup and are not performance comparisons.
Stop unchanged-head whole-file replay: 2 passed, 209.01 s.
The broader full-suite run remains partial: shards 1–2 on previous head
aa98916e3494f8e73ce84cf1bf6f9e0d9e768958covered 499 files (493 passed, six failed), with 2,234 tests passed and six failed after the missing-WebKit prerequisite replay. Shard 3 was not run. Those partial results are not a complete full-suite acceptance of the current head. The six failed files are now classified by the exact-head/base comparisons above. All earlier leases are stopped.Changed-test cost
The measurements below are from the previously validated head and exclude the new stalled-cache cases. Standalone wall time uses
pnpm test <file> --maxWorkers=1. CI seconds sum reported case execution durations; they exclude process startup and import time. The new stalled-cache cases were verified in CI; their standalone wall time was not measured. The six permitted real-Gateway file replays and their wall times are reported above.chat-history-warm-startup.test.tschat-page-snapshot-custody.test.tschat-composer-subagent.test.tschat-transcript-controller.test.tschat-transcript-geometry.test.tschat-transcript-end-follow.browser.test.tschat-pane-scroll-cache.test.tsProduction LOC: −30 (128 additions, 158 deletions across 13 production files), from
git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*'. Total scope: 21 files, including seven test files and the Control UI docs.Release-note context: cached chat reloads preserve transcript/widget geometry and avoid a transient composer-height jump during connection recovery.