Skip to content

fix(control-ui): retain warm reload cursors through subscription admission - #175393

Merged
steipete merged 2 commits into
mainfrom
steipete/perf-micro-r151-warm-reload-cursor-describe-20260919
Oct 17, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/perf-micro-r151-warm-reload-cursor-describe-20260919

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes warm Control UI reloads fetching a full transcript page when the saved transcript and delta cursor finish restoring while the message subscription is connecting.

User Impact

Warm reloads reuse the saved cursor when it is ready before the first chat request, avoiding retransmission of unchanged messages. Cold loads still start without waiting for IndexedDB, and cursor-reset fallback remains unchanged.

Why This Change Was Made

The history loader captured the cursor before awaiting subscription admission. Hydration could then populate the cache, but the request still used the earlier missing cursor. Read the existing scoped cursor at request issuance and remove the stale argument. Keep the existing pane and transport request keys aligned with that cursor so another caller shares the issued request. This ordering predates the recently reported regression; no specific recent commit is established as its trigger.

The simplification pass leaves one existing cursor owner and no additional cache, timer, or configuration. Production TypeScript delta: +14/-7 (net +7); regression coverage: +33 lines. The small production growth keeps the existing in-flight key aligned with the actual cursor, preserving the same-request sharing contract after late hydration. Documentation now describes the current parallel restoration contract.

Evidence

  • The added mounted-pane regression fails on the original implementation: cached messages are visible, but chat.startup omits the cursor. It passes after the fix and asserts the saved cursor, one RPC across two overlapping callers, and preserved messages after an empty delta. The overlapping-caller extension also reproduced the stale in-flight key identified in PR review (two RPCs before that correction, one afterward).
  • Focused warm-startup, cursor, and subscription-admission tests: 42 passed.
  • Existing snapshot-store and session-describe owner tests: 46 passed.
  • Changed-file formatting, scoped lint, and git diff --check passed.
  • Independent Codex review: scoped-clean, no actionable findings. Broad validation runs in PR CI; no Testbox resources used.

Real source-Gateway + headless Chromium proof of the cursor fix at 942f86378df6 used an isolated 820-message synthetic session, the existing warm-reload probe, and the same live Gateway/session for both source variants. Each variant had a cold visit followed by two verified full reloads (navigationType=reload, distinct time origins).

Warm reload result Before (both runs) After (both runs)
chat.startup cursor omitted saved cursor included
Startup response, UTF-8 bytes 103,004 1,836
Retransmitted messages 80 0
Startup RPC count 1 1
Describe calls per distinct key 1 1

The saved transcript rendered before startup in the failing runs. After the change, the request cursor matches the persisted cursor and the empty delta preserves all 80 cached messages. Savings: 101,168 bytes per warm reload (98.22%). Cold startup remains 103,004 bytes/80 messages. The follow-up changes only in-flight key bookkeeping; its additional concurrent-caller behavior is covered by the focused regression.

This is payload and request-count evidence, not a latency benchmark. The minimal synthetic Gateway records unrelated catalog/metadata warmup errors; those do not fail the measured startup or describe requests. No real accounts, production state, or remote validation resources were used. The reported same-key describe burst was not reproduced: each warm reload described the selected session once and the distinct default session once. A separate three-child ancestry fixture reproduced five describe calls on cold and warm loads, one for each distinct key (selected child, parent, two ancestors, and default session). No describe-owner change is justified by these results.

@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 09:40
@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-17T09:50:45.650089Z 924f6cd New commits
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: XS labels Oct 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 942f86378d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reads the saved transcript cursor after subscription admission and keeps request coalescing aligned with the cursor actually sent.

Example: A cached transcript finishes restoring while the live message subscription connects.

  • Before: The reported Chromium reload fetched 80 unchanged messages in a 103,004-byte startup response.
  • After: The reported reload sent the saved cursor and received a 1,836-byte delta without retransmitting messages.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with reported real-browser evidence and meaningful regression coverage; the final follow-up is supported by the mounted-pane harness and broad CI remains pending.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR reports source-Gateway/headless-Chromium cold visits and two full warm reloads per variant at 942f863, showing saved-cursor transmission, zero retransmitted messages, and preserved cached rows; the final bookkeeping-only follow-up has focused overlapping-caller regression evidence.
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 can download unchanged messages even though its saved cursor is ready before the first request.
Reason: The maintainer-authored change restores the existing cursor-reuse contract with a small owner-local repair and measured payload savings.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a current warm-reload inefficiency, and the final diff has no actionable findings; exact-head CI remains pending.

Priority: P2
Reviewed head: 924f6cd96e037aa09956d0d8e43601c86b96f6a2

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI history loader combines account-scoped browser snapshots with Gateway history responses and live message subscriptions to populate the selected conversation.

flowchart TD
  A[Browser reload] --> B[Restore scoped snapshot]
  A --> C[Admit live subscription]
  B --> D[Read current saved cursor]
  C --> D
  D --> E[Coalesced Gateway history request]
  E --> F[Reconcile transcript]
Loading

Technical review

Best possible solution:

Retain this focused fix in the existing history owner while preserving cold-load parallelism and cursor-reset fallback.

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

Current main captures the cursor before awaiting admission, so snapshot restoration during that wait leaves the first request cursor-less; the PR also reports a real-browser reproduction, but this read-only review ran no target code.

Is this the best way to solve the issue?

Reading the existing scoped cursor at issuance fixes the ordering at its owner, and updating the existing in-flight key preserves request sharing without another cache or coordinator.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced change: The pinned introduced diff removes the early cursor argument, reads the existing scoped cursor after admission, and updates the pane request key alongside the transport key. (ui/src/pages/chat/chat-history-hydration.ts:104, 924f6cd96e03)
  • Current main still has the reported path: Fetched main awaits subscription admission and then issues history using the cursor captured earlier by its caller. (ui/src/pages/chat/chat-history-hydration.ts:154, e1a18bdc6335)
  • Focused regression: The added mounted-pane case restores cached messages during deferred admission, verifies the saved cursor, overlaps another caller, and checks one RPC with messages preserved after an empty delta. (ui/src/pages/chat/chat-history-warm-startup.test.ts:324, 924f6cd96e03)
  • Runtime evidence and resolved discussion: The full PR body reports two real source-Gateway/Chromium reloads per variant at the first head, with saved-cursor reuse and preserved cached messages; the follow-up addresses the existing review's coalescing concern with a reported failing-before/passing-after regression. (924f6cd96e03)
  • Existing cursor contract: Cursor reads retain snapshot-scope and session-ID checks, and rejected cursors still clear before a cursor-less tail request; existing reset coverage exercises that fallback. (ui/src/pages/chat/session-message-cache.ts:175, 924f6cd96e03)
  • Feature history: Prior merged history identifies Peter Steinberger across cursor catch-up, the history load state machine, module extraction, and parallel snapshot restoration; the original cursor feature explicitly retained reset fallback. (ui/src/pages/chat/chat-history.ts, e1a18bdc6335)

Likely related people:

  • Peter Steinberger: Raw commit 7661ce5 adds ui/src/pages/chat/chat-history-hydration.ts:198 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7661ce58751e; files: ui/src/pages/chat/chat-history-hydration.ts)

PR surface

Source +7, Tests +33, Docs +1. Total +41 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 14 7 +7
Tests 1 33 0 +33
Docs 1 4 3 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 51 10 +41

Review metrics

Metric Value Why it matters
Production versus regression coverage Production TypeScript +14/-7; tests +33/-0 The small production increase aligns existing request identities; the regression covers late hydration and overlapping callers.

Labels

Label changes:

  • add P2: Warm reloads unnecessarily retransmit unchanged transcript messages, with limited performance and bandwidth impact.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Warm reloads unnecessarily retransmit unchanged transcript messages, with limited performance and bandwidth impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

Reviewed October 17, 2026, 5:52 AM ET / 09:52 UTC.

@steipete
steipete merged commit 47b99c6 into main Oct 17, 2026
96 of 99 checks passed
@steipete
steipete deleted the steipete/perf-micro-r151-warm-reload-cursor-describe-20260919 branch October 17, 2026 09:59
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…ssion (openclaw#175393)

* fix(control-ui): retain warm reload cursors through subscription admission

* fix(control-ui): align warm startup request coalescing with issued cursor
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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant