Skip to content

perf(control-ui): keep cached transcripts steady on reload - #170052

Merged
steipete merged 3 commits into
mainfrom
steipete/coldload-transcript-cache-settle
Oct 12, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/coldload-transcript-cache-settle

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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 on ea7604ac5f307a5513cef69cae2cc0edbac717a5. pnpm install --frozen-lockfile completed 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 927c8b25d016f4fb54ff55c9d6fa3fc004c23716 and 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.

Order First visible transcript, before → after Post-paint scroll changes Full mounted-row replacements Widget first → final Transcript forced layouts
Cache first 3651.1 → 2584.5 ms 2 (+46/−46 px) → 0 0 → 0 700→700 px in both 18 / 10.572 ms → 6 / 4.205 ms
History first 3749.0 → 1926.1 ms 1 (+280 px) → 0 0 → 0 420→700 px → 700 throughout 13 / 8.321 ms → 6 / 1.431 ms

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.

  • Blacksmith Testbox 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).
  • Independent Codex review: scoped-clean through P2. Rebases were conflict-free and patch-identical.
  • Previously validated head aa98916e3494f8e73ce84cf1bf6f9e0d9e768958: CI is green (43 passed checks, 36 skipped).
  • Previous-head focused E2E: 12 files / 34 tests passed in 101.53 s on Blacksmith Testbox 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.
  • Seven changed test files passed individually (118 tests). The first six ran on Blacksmith Testbox tbx_01m4rk2kj3yg6vyjb8zvkhyhxj; the scroll-cache fixture correction ran on tbx_01m4rm0snvptz8d7vmg0qbnk97 after 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 base ea7604ac5f307a5513cef69cae2cc0edbac717a5. 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.

File Head Base Verdict
extensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.ts 1 pass, 1 fail 1 pass, 1 fail Original configured-owner/admin permission case passes both. A separate restart-recovery case fails both during installed-package/update Doctor cleanup before a page opens. Inherited setup failure.
extensions/qa-lab/src/control-ui-openclaw-delegation.real-gateway.e2e.test.ts 3 pass 1 fail, 2 skipped Original approval setup failure reproduced on base: installed-package/update Doctor cleanup. The remaining base cases were retired after the fixture failure. No head regression.
extensions/qa-lab/src/session-host-command-state.real-gateway.e2e.test.ts 1 fail 1 fail Original 180-second timeout reproduced on both.
ui/src/e2e/activity-run-inspector.real-gateway.e2e.test.ts 1 fail 1 fail Head: initial CLI sessions.create exits 1 before opening a page. Base: original 90-second timeout. Different failure modes; neither run proves the pairing/reload assertions. Original timeout confirmed on base; the head failure is also before transcript execution.
ui/src/e2e/background-work.real-gateway.e2e.test.ts 1 pass 1 fail Original UNAVAILABLE / Agent schema admission changed before publication reproduced on base.
ui/src/e2e/chat-stop-owned-exec.real-gateway.e2e.test.ts Initial: 1 pass, 1 fail. Unchanged-head replay: 2 pass 2 pass Original button case passes both. Initial head slash case hit an unchanged CLI 2-second loopback HEAD probe before page navigation. Entire file passes unchanged on replay: transient setup timeout.

The only initial head-fail/base-pass file was Stop. The slash failure occurred in pairControlUiPage while awaiting dashboard --json, before page.goto. The CLI's unchanged waitForControlUiDocument uses 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.

File Head Base
automation management 486.65 s 271.34 s
OpenClaw delegation 360.07 s 408.25 s
session-host command state 309.06 s 300.15 s
activity Run Inspector 163.68 s 233.48 s
background work 178.36 s 118.26 s
Stop owned exec 119.06 s 193.47 s

Stop unchanged-head whole-file replay: 2 passed, 209.01 s.

The broader full-suite run remains partial: shards 1–2 on previous head aa98916e3494f8e73ce84cf1bf6f9e0d9e768958 covered 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.

File Standalone wall CI case execution
chat-history-warm-startup.test.ts 11.32 s 0.176 s
chat-page-snapshot-custody.test.ts 6.64 s 1.183 s
chat-composer-subagent.test.ts 6.15 s 2.072 s
chat-transcript-controller.test.ts 6.82 s 2.075 s
chat-transcript-geometry.test.ts 3.78 s 0.963 s
chat-transcript-end-follow.browser.test.ts 11.34 s 6.416 s
chat-pane-scroll-cache.test.ts 13.73 s 2.883 s

Production 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.

Synthetic transcript reload before and after

@clawsweeper

clawsweeper Bot commented Oct 12, 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: L labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: History arriving first displays the widget at 420 px, then its growth shifts the transcript by 280 px.
  • After: The supplied browser comparison records 700 px throughout visible transcript frames and zero subsequent scroll changes.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful repair with inspected browser evidence, successful exact-head CI, and no actionable finding; the explicitly retained broader validation remains unfinished.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The inspected Control UI browser comparison exercises real IndexedDB and a sandboxed widget under both cache/history orderings, showing retained rows and stable visible geometry; it predates the safety-bound follow-up, whose stalled-read behavior has source and regression-test support.
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 cached conversation moves already-visible messages while widget heights and composer geometry settle.
Reason: The browser comparison establishes user value, the maintainer-authored direction is approved, and the repair stays within existing responsibilities.

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
Reviewed head: 22cc763fe9506801c662066f8ea4fe429f7cac8c

Before merge

  • Complete next step - Finish the explicitly retained full UI E2E validation on the reviewed head, compare the six recorded failures with baseline or current main, and fix failures attributable to this PR before landing.

Findings

None.

Tests

  • Missing end-to-end proof: Pre-fix failing runs are not supplied for the saved-reader and stalled-cache regressions.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Initial cache and history ordering changes intended behavior with a stated reason (24ae0fc: Warm startup bounded its cache wait before dispatch so the request could reuse the stored delta cursor.)
  • History-tail reconciliation keeps the original intent (701da05: This extraction carried forward same-session history-prefix retention; it does not establish the behavior's original introduction.)
  • Initial transcript positioning keeps the original intent (cc7bd7b: Settle measured initial rows before revealing them while preserving saved readers and explicit scroll commands.)
  • Geometry scheduling keeps the original intent (eb36d28: Batch geometry reads before layout-changing writes while retaining synchronous positioning corrections.)
  • Composer pending notice changes intended behavior with a stated reason (d099094: Pending-state presentation distinguished initial-history unavailability from other holds; this PR removes duplicate notice geometry while retaining Send's pending explanation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 701da05 adds ui/src/pages/chat/chat-history-snapshot.ts:125 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 701da051d6f9; files: ui/src/pages/chat/chat-history-snapshot.ts)
  • Dallin Romney: Raw commit 6a57fa4 adds ui/src/pages/chat/components/chat-transcript-session.ts:29 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 6a57fa4c5448; files: ui/src/pages/chat/components/chat-transcript-session.ts)

PR surface

Source -30, Tests -50, Docs +4. Total -76 across 21 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 13 128 158 -30
Tests 7 235 285 -50
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 21 367 443 -76

Review metrics

Metric Value Why it matters
Production versus test LOC Production +128/−158; tests +235/−285 The repair removes superseded readiness plumbing and replaces obsolete timing coverage with publication-ordering and positioning regressions.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Cached reloads visibly move messages and widgets, creating a bounded usability defect.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • 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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-12T17:45:27.996Z sha 88598a1103a0ab275da33accfa4281ee8a2758dc :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T18:05:23.148Z sha 88598a1103a0ab275da33accfa4281ee8a2758dc :: needs changes before merge. :: [P2] Deliver the deferred layout frame in the retained-session fixture
  • reviewed 2026-10-12T18:23:13.461Z sha aa98916 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T19:06:35.984Z sha aa98916 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T19:43:20.859Z sha aa98916 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T19:50:53.605Z sha aa98916 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T20:53:11.536Z sha 22cc763 :: needs changes before merge. :: none

Reviewed October 12, 2026, 5:04 PM ET / 21:04 UTC (Revision 8).

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 12, 2026
@steipete
steipete force-pushed the steipete/coldload-transcript-cache-settle branch from 88598a1 to aa98916 Compare October 12, 2026 18:07
@clawsweeper clawsweeper Bot added 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@steipete
steipete force-pushed the steipete/coldload-transcript-cache-settle branch from aa98916 to 22cc763 Compare October 12, 2026 20:45
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 12, 2026
@steipete
steipete merged commit 7661ce5 into main Oct 12, 2026
116 of 118 checks passed
@steipete
steipete deleted the steipete/coldload-transcript-cache-settle branch October 12, 2026 22:09
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…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
steipete added a commit that referenced this pull request Oct 13, 2026
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.
steipete added a commit that referenced this pull request Oct 13, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…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.
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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant