Skip to content

fix(chat): retain warm startup receipts after deferred mount - #175883

Merged
steipete merged 1 commit into
mainfrom
perf/warm-startup-hydration-before-request
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/warm-startup-hydration-before-request

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes full-history downloads on warm reload when the chat pane mounts after the Gateway is ready. Follow-up to #175816: startup can no longer outrun retained cursor and metadata hydration.

User Impact

Warm reloads reuse the conversation and receipt hashes while retaining the earlier first paint. Missing, invalid, or unavailable caches still fall back to a full request. No configuration or migration is required.

Why This Change Was Made

The history owner previously joined snapshot hydration only before applying the response, after sending an empty knownState without a cursor. Move that existing bounded wait before request construction, after stream admission. The frame handoff is unchanged. The existing two-second cache timeout now bounds request issuance, so unavailable storage still fails open.

Production change: −1 line net, with no new owner, state, timer, or cache. Consolidated the now-impossible history-before-initial-cache test ordering while preserving cached row identity and widget-height assertions.

Evidence

All 12 unprofiled candidate warm reloads: retained cursor plus all three receipt hashes, 306 framed bytes / 224 payload bytes, zero messages and no chat.history. Failing baseline runs returned 154,318 framed bytes / 80 messages. The baseline reproduced the race in 4/4 fast-connection and 7/8 deferred-mount runs.

Concurrent pairs on an isolated Linux sandbox use separate 16-core CPU sets, state, and ports, swap core halves each pair, and hold an exclusive measurement lock. Actual warm starts differ by at most 2 ms; per-pair outside load was recorded. Values below are median candidate minus baseline within each pair:

Metric Fast connection, 4 pairs Deferred mount, 8 pairs
FCP 0 ms 0 ms
Final retained message visible +4.55 ms −0.05 ms
Sidebar final order stable +18.4 ms +0.4 ms

Deferred restore blocking remains 0 ms on both sides in all eight pairs. Final-message mean difference is +7.88 ms, range −39.4…+100.4 ms. The +100.4 ms outlier remains included; four extra pairs checked the distribution. Cold FCP medians are +4/0 ms and cold final-message medians +11.7/+2.75 ms respectively. Final row counts and ordered sidebar keys match, with no browser errors.

Two separate traced pairs confirm an actual Chrome Paint between sidebar restoration and pane mounting, with retained data still pending. Example candidate: sidebar task ends 223.977 ms, Paint 234.417–234.939 ms, pane starts 236.164 ms, retained-record delivery 336.4 ms. Traced timings are excluded from the comparison above.

The headless fixture uses 80 retained messages, 80 sidebar sessions, five pending inputs, session info, and 150 commands. Deferred mode releases hello after the sidebar frame boundary and adds 120 ms only to retained chat-record delivery; subscription is immediate. It proves avoided full-page resend and no candidate history fill, but does not model the reported larger-session pagination cascade. Synthetic data only. Chromium 155 actually paints, verified by trace Paint events and filmstrip. Identical measurement-only dependency deviations on both sides: Vite 8.3.2 versus 8.3.4, Playwright 1.63 versus 1.64, CodeMirror language 6.12.4 versus 6.13.1 and view 6.43.13 versus 6.43.14; Solid runtime/compiler match the pinned version. Owned sandbox and processes are removed.

The deferred-mount regression fails on the base with knownState: {} and no cursor, then passes with retained data. Focused checks: warm startup 26/26, persistent snapshot hydration 7/7, stream admission 7/7, changed-file lint/format and diff checks pass. Independent autoreview is clean through P2 after correcting a sibling test's obsolete immediate-request expectation. PR CI passed all required checks on 9b542203ba906c26137ccccb0803a082a6eed2ec, including UI tests, E2E, performance, types, lint, and the final CI/security gates; no Testbox lease or local broad gate was used.

Inspected synthetic before/after final-content screenshots are byte-identical:

Before: retained synthetic conversation

After: same conversation with compact warm startup

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

@steipete
steipete marked this pull request as ready for review October 17, 2026 22:21
@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-17T22:24:04.333830Z 9b54220 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

The final diff and proof are current. Twelve concurrent paired candidate warm reloads preserve all three receipt hashes and return 306 bytes with zero messages and no history fill. Median FCP difference is 0 ms; deferred-mount final-message visibility is neutral across eight pairs. Independent review and 40 focused tests pass; broader CI is running.

@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-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete
steipete merged commit 69eefd4 into main Oct 17, 2026
157 of 159 checks passed
@steipete
steipete deleted the perf/warm-startup-hydration-before-request branch October 17, 2026 22:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
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-repro Preliminary submission classification; full source review pending. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant