Skip to content

perf(control-ui): settle cached transcripts before reconnect - #168154

Merged
steipete merged 4 commits into
mainfrom
steipete/coldload-transcript-settle
Oct 10, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/coldload-transcript-settle

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes a cached conversation moving after it appears when a signed-in operator reloads a dashboard deep link. The campaign trace showed cached messages at 3.728 seconds, scrolling until 3.902 seconds, metadata arriving at 10.260 seconds, and task progress at 12.980 seconds.

User Impact

Warm reloads open at the transcript's final end anchor with reply context, completed-work timing, and saved task progress already available. Identical live history reconciles without moving the transcript or replacing the progress-card element.

The disposable browser snapshot projection advances to version 2. Older projections are skipped and a connected visit repopulates them. There is no server schema change or new configuration option.

Why This Change Was Made

The empty shell consumed the virtualizer's initial end offset before cached rows arrived. A second startup phase then expanded overscan from two rows to six, changing measured heights after paint. This removes both paths and settles the complete bounded initial window before the next animation frame. Saved-reader restoration and explicit scroll commands retain ownership.

Participant and timing facts and the last progress card now travel through the existing account-scoped transcript cache. They remain display data: live session/progress owners reconcile them, including authoritative clearing, account changes, and cache invalidation.

Product LOC is +174 across 22 files: cache serialization/validation, display projection, and scoped reconciliation force the growth; the scroll simplification deletes 93 lines of superseded startup machinery. A separate +9-line browser-test configuration fix preoptimizes imports observed causing Vite to reload a cold mounted-pane test. The requested diff filter therefore totals +183, including that test harness.

Evidence

One synthetic Playwright flow warms the real snapshot owner, reloads with hello held, samples the first 20 transcript frames, and continuously samples through live reconciliation. Baseline production code fails the assertion; the candidate passes.

Measurement Before After
Largest cached-frame distance from end 4,185 px 0 px
Sampled cached scrollTop values 0, 4,636, 4,982 5,104 only
Completed-work duration present 0/20 frames 20/20 frames
Task progress present 0/20 frames 20/20 frames
Reply attribution present 20/20 frames 20/20 frames

All 29 sampled live-reconciliation frames remained at scrollTop 5,104 with zero end gap. Transcript/card position and height stayed unchanged, and the existing progress-card DOM element was retained. Screenshots below are inspected synthetic fixtures; no private campaign captures are included.

The rebase includes the session PR host CI repair and dashboard first-paint changes. Reload, duration, reply-attribution, and frame-coalescing checks were repeated after incorporating the later steering/subagent changes.

All authorized local files ran serially with --maxWorkers=1, waiting whenever host load exceeded 40. 424 distinct tests passed: the reload E2E, 38 browser siblings, 195 originally changed unit cases, and 190 cases in the four fixtures corrected after CI. The baseline E2E failed as intended (27.22 seconds). After the latest product rebase, candidate wall time was 29.77 seconds; browser siblings took 8.33 seconds (end-follow), 6.64 seconds (geometry-updates), and 3.92 seconds (frame updates).

Changed unit file Single-worker wall time
session-progress-cards.test.ts 11.75 s
chat-history-warm-startup.test.ts 22.55 s
session-snapshot-write.test.ts 6.11 s
chat-transcript-duration.test.ts 8.11 s
chat-transcript-replies.test.ts 9.69 s
session-snapshot-store.test.ts 5.53 s
session-snapshot-prewarm.test.ts 9.77 s
chat-transcript-controller.test.ts 13.59 s
chat-transcript-geometry.test.ts 7.05 s
session-prefetch.test.ts 7.98 s
chat-view.test.ts 10.30 s
chat-pane-history-maintenance.test.ts 8.61 s
chat-pane-snapshot-hydration.test.ts 5.41 s

An initial geometry browser invocation failed before collection when Vite discovered dependencies and reloaded the test page. Its existing preoptimization list now includes those observed imports; the cold rerun passed without a reload. Fresh detached review of that delta was clean, as was review of the product change.

Earlier remote evidence: AWS lease cbx_dec5fadd66a5 passed 214 focused tests on the intermediate candidate. Testbox tbx_01m4h9ahe165qvx9728fdpc4fd remained queued, and subsequent remote sync was blocked by the saturated uplink. The final local runs use the explicitly approved single-file exception. All issued remote leases were released. GitHub CI supplied the final changed-file gate and passed on the final head.

Before: cached history has no completed-work duration or progress card

After: cached transcript is anchored with duration and task progress before hello

CI follow-up

CI exposed four fixtures that needed to follow the new lifecycle: prefetch now expects the cached display projection, Reply exercises an actual rendered message, stored hydration supplies a valid typed session row, and maintenance scrolling finishes initial anchoring before changing the scroll range. Their behavioral assertions remain intact. The latest two fixture repairs pass all 10 cases locally. Fresh detached review is clean. CI run 38028816500 passed on 80b78733d75fdeda4fa9a5ff049488c6d61e05a3: 33 successful jobs, 24 intentionally skipped. All three UI shards, all selected browser E2E shards, production/test types, guards, and changed-node checks passed. The UI shards took 306–348 seconds and browser E2E shards 200–221 seconds (whole-shard wall times, not incremental test cost). Earlier fail-fast cancellations are not counted as independent defects. No jobs were rerun.

@clawsweeper

clawsweeper Bot commented Oct 10, 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 10, 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR anchors cached conversations before reconnect and restores cached participant, duration, and task-progress display data.

Example: Reload agent:main:dashboard:cold-load while the Gateway handshake is held.

  • Before: Reported cached frames move through scrollTop 0, 4636, and 4982, without completed-work duration or task progress.
  • After: Reported cached frames remain at scrollTop 5104 with “Worked for 3 minutes” and the saved progress card.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Strong browser evidence supports the central repair, but the repeated progress-invalidation defect blocks merge and stored-state compatibility is unverified.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots and supplied Playwright frame measurements exercise Control UI reload through the real snapshot owner with a held mock-Gateway handshake, showing cached duration, task progress, and stable live reconciliation; existing-profile upgrade evidence remains outstanding.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A cached conversation moves after appearing and waits for live reads to show completed-work duration and task progress.
Reason: The before/after browser evidence demonstrates a visible defect, and the repair extends existing owners without adding an operator setting.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open for its useful cached-transcript repair; the previously reported progress-invalidation defect still blocks merge.

Priority: P2
Reviewed head: 80b78733d75fdeda4fa9a5ff049488c6d61e05a3

Before merge

  • Restart admitted progress reads after invalidating a watched entry (P2) - The prior finding remains: clearing history in a connected, presented conversation invokes the new snapshot-invalidation callback after sessions.reset and deletes its progress entry. The controller retains the same session-key target, client, and hello, so synchronize returns without reacquiring the watch. Later progressCard.changed events search only existing entries and cannot restore it, leaving new task progress invisible until a session switch or reconnect. Restart the admitted read through the store while preserving hidden/offline gating and stale-result rejection.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Restart admitted progress reads after invalidating a watched entry — ui/src/lib/session-progress-cards.ts:524-532

Tests

  • Missing end-to-end proof: Provide a v2026.9.9-to-candidate browser-profile upgrade showing snapshot repopulation with settings, drafts, and queued input intact.
Agent review details

How this fits together

The Control UI restores account-scoped browser snapshots into the chat pane, measures virtual transcript rows, and reconciles cached display data with live Gateway results.

flowchart TD
Browser[Browser reload] --> Cache[Account scoped snapshots]
Cache --> Pane[Chat pane]
Pane --> Transcript[Transcript virtualizer]
Pane --> Progress[Progress card store]
Gateway[Live Gateway results] --> Pane
Gateway --> Progress
Transcript --> Display[Visible conversation]
Progress --> Display
Loading

Technical review

Best possible solution:

Keep the anchoring repair and make progress invalidation resume admitted reads through the existing store.

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

Fetched main retains empty-shell attachment and delayed overscan expansion, matching the supplied failing browser comparison; this read-only review ran no target code.

Is this the best way to solve the issue?

The change repairs initial attachment and measurement ordering at their owners, but its new progress invalidation path loses subsequent updates.

Full review comments:

  • [P2] Restart admitted progress reads after invalidating a watched entry — ui/src/lib/session-progress-cards.ts:524-532
    The prior finding remains: clearing history in a connected, presented conversation invokes the new snapshot-invalidation callback after sessions.reset and deletes its progress entry. The controller retains the same session-key target, client, and hello, so synchronize returns without reacquiring the watch. Later progressCard.changed events search only existing entries and cannot restore it, leaving new task progress invisible until a session switch or reconnect. Restart the admitted read through the store while preserving hidden/offline gating and stale-result rejection.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Initial transcript overscan changes intended behavior with a stated reason (3a306a4: Reduce offscreen rendering on the first presented commit, then restore the normal scrolling buffer.)
  • Empty transcript shell attachment changes intended behavior with a stated reason (fa9473b: The blamed commit reorganized chat-thread rendering while replacing expensive ancestor selectors; its PR does not establish a separate requirement to attach the virtualizer to empty content.)
  • Snapshot projection retirement keeps the original intent (4525e1d: Rebuild older browser history projections so retained cursors cannot preserve incomplete reply data.)
  • Warm transcript restoration keeps the original intent (24ae0fc: Render account-scoped cached state before hello and reconcile it with authoritative live results.)
  • Progress ownership keeps the original intent (809206e: Preserve captured session ownership and connection-safe progress reconciliation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/lib/session-progress-cards.test.ts --maxWorkers=1
  • pnpm test ui/src/components/session-progress-card-controller.test.ts --maxWorkers=1
  • pnpm test ui/src/pages/chat/chat-pane-history-maintenance.test.ts --maxWorkers=1
  • Exercise clear history followed by new task progress in the same connected Control UI pane.
  • git diff --check

What I checked:

Likely related people:

  • Dallin Romney: Raw commit 51f772a adds ui/src/pages/chat/components/chat-transcript-virtualizer-host.ts:85 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 51f772aeefbc; files: ui/src/pages/chat/components/chat-transcript-virtualizer-host.ts)

PR surface

Source +183, Tests +382, Docs +4. Total +569 across 38 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 23 335 152 +183
Tests 14 429 47 +382
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 38 768 199 +569

Review metrics

Metric Value Why it matters
Production versus test growth Production net +174 LOC; tests net +382 LOC; browser-test configuration net +9 LOC Production growth carries bounded cached display facts and scoped reconciliation; browser coverage checks first-frame anchoring and live reconciliation.
Stored projection version 1 → 2 Existing derived transcript records are skipped until a connected visit repopulates them.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The change repairs visible warm-reload movement within Control UI conversation presentation.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • 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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-10T03:39:47.858Z sha f54114b :: blocked before merge. :: none
  • reviewed 2026-10-10T05:16:32.377Z sha ebb473aaccf06cb5e88cda54f06c2fe6d24a1bc0 :: blocked before merge. :: [P2] Restart admitted progress reads after invalidating a watched entry

Reviewed October 10, 2026, 1:56 AM ET / 05:56 UTC (Revision 3).

@steipete
steipete force-pushed the steipete/coldload-transcript-settle branch from f54114b to ebb473a Compare October 10, 2026 05:08
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 10, 2026
Keep the initial end anchor until the full bounded row buffer has been
measured, and remove the empty-shell attachment and delayed overscan expansion
that started reloads at the top or moved their first painted viewport.

Retain participant and completed-work display metadata and task progress in the
existing account-scoped transcript cache. Reconcile live results through their
existing owners, including authoritative clearing and cache invalidation.
@steipete
steipete force-pushed the steipete/coldload-transcript-settle branch from ebb473a to 80b7873 Compare October 10, 2026 05:49
@steipete
steipete merged commit cc7bd7b into main Oct 10, 2026
97 checks passed
@steipete
steipete deleted the steipete/coldload-transcript-settle branch October 10, 2026 06:02
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…w#168154)

* perf(control-ui): settle cached transcripts before reconnect

Keep the initial end anchor until the full bounded row buffer has been
measured, and remove the empty-shell attachment and delayed overscan expansion
that started reloads at the top or moved their first painted viewport.

Retain participant and completed-work display metadata and task progress in the
existing account-scoped transcript cache. Reconcile live results through their
existing owners, including authoritative clearing and cache invalidation.

* test(control-ui): stabilize cold browser dependency loading

* test(control-ui): exercise hydrated snapshot and reply ownership

* test(control-ui): settle transcript maintenance fixtures
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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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