Repository navigation
perf(ui): avoid speculative history reads on connect - #167906
Conversation
Warm unopened conversations only after pointer or keyboard navigation intent. Share pending MCP discovery across surfaces, invalidating reads on config changes, explicit retries, and session creation while keeping view ownership. Synthetic cold connect: 52 to 48 RPCs and 29% fewer RPC response bytes. Preserve existing history budgets and lossless lazy pagination.
|
🦞👀 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 maintainer review before merge. What this changesThe Control UI warms unopened conversations only after hover or keyboard focus and shares pending Model Context Protocol (MCP) app-discovery requests across UI surfaces. Example: A user opens the synthetic 900-message conversation.
Review scores
ProductKind: Performance · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains useful: current main still performs the redundant work, the direction is supported by prior area ownership, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI requests conversation history and available plugin apps from the Gateway. Its prefetch and discovery controllers prepare data for navigation, the composer, and the resource picker. flowchart TD
A[Connect or navigate] --> B[Selected conversation history]
C[Hover or keyboard focus] --> D[Visible transcript ready]
D --> E[Intended conversation prefetch]
F[Sidebar composer and resource picker] --> G[Shared pending app discovery]
E --> H[Gateway responses and scoped UI caches]
G --> H
Technical reviewBest possible solution: Keep intent-driven warming and pending discovery sharing in their existing controllers. Do we have a high-confidence way to reproduce the issue? Not applicable as a correctness-bug reproduction; the supplied paired Chromium runs demonstrate the performance problem through the built UI and a real isolated Gateway. Is this the best way to solve the issue? Yes. Removing speculative selection at the existing prefetch owner and sharing only pending discovery avoids another cache or policy owner while preserving foreground loading and pagination. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a799f4a42891. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -62, Tests +166, Docs +4. Total +108 across 8 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 9, 2026, 2:24 PM ET / 18:24 UTC. |
Follow the intent-only prefetch contract from b0fb3ac (#167906): hover or focus the unopened session before expecting its warm history read. Preserve foreground-load gating, roster-refresh cache reuse, and mixed-history recovery assertions without changing production behavior or timeouts. The three failures reproduce on current main and pass at the producer parent. All eight cases pass with the fixture update; removing only the navigation intent reproduces all three failures. P2 review is clean.
Warm unopened conversations only after pointer or keyboard navigation intent. Share pending MCP discovery across surfaces, invalidating reads on config changes, explicit retries, and session creation while keeping view ownership. Synthetic cold connect: 52 to 48 RPCs and 29% fewer RPC response bytes. Preserve existing history budgets and lossless lazy pagination.
Follow the intent-only prefetch contract from 75e0819 (openclaw#167906): hover or focus the unopened session before expecting its warm history read. Preserve foreground-load gating, roster-refresh cache reuse, and mixed-history recovery assertions without changing production behavior or timeouts. The three failures reproduce on current main and pass at the producer parent. All eight cases pass with the fixture update; removing only the navigation intent reproduces all three failures. P2 review is clean.
What Problem This Solves
Opening a conversation automatically warmed two unopened histories; the sidebar, composer apps, and resource picker also issued overlapping discovery requests for the same session.
User Impact
Connecting no longer reads unopened conversations. Hovering or keyboard-focusing another conversation still warms it after visible history is ready. Concurrent UI surfaces share MCP discovery while keeping their own presentation state.
Why This Change Was Made
The navigation prefetch owner now serves explicit intent, removing automatic recent-session warming, browser-idle scheduling, sorting, and multi-candidate selection. Pending MCP discovery is shared by connection scope and target. Config events, explicit retries, and successful session creation invalidate pending work; settled results leave the registry. Existing history limits and lazy older-page behavior are preserved. Production delta: −62 lines.
Evidence
Headless Chromium against a built Control UI and real isolated Gateway, with 900 synthetic messages in the selected conversation, 900 in Home, and three unopened 150-message conversations. The fixture configures no live provider; “Models unavailable” is intentional. Before/after captures used the same AWS Crabbox lease,
cbx_42d0efd1de6c.These are paired samples, not a latency distribution. The repeat on Blacksmith also reduced RPC bytes by 29%, while its timing was approximately flat. Each capture continues for three seconds after a draft edit. All HTTP requests are counted; byte totals exclude two fixture error responses (session-entry 401 and missing workspace-icon 404) whose sizes Chromium did not report. No fetch/abort churn was reproduced.
The served entry changed from
index-8m44svMD.jstoindex-C9xNAMYp.js. Both versions loaded the same initial 59 messages and reached all 900 through eight older-page commits. Older-page rendering was 2,556 → 2,439 ms. The flow also verifies restored Home ordering, narrow layouts, identity reconciliation, and avatar caching.Validation:
cbx_42d0efd1de6c: 55 focused tests across four prefetch/MCP files passed with--maxWorkers=1in 3.76s. Both rebuilt real-Gateway runs passed; final Vitest wall time was 63.40s, including the temporary measurement instrumentation. The committed E2E test adds no case or timer; it records all RPCs in its existing report.cbx_42d0efd1de6c:node scripts/check-changed.mjs --stagedpassed, including all nine selected core-test graphs, UI typechecking, i18n, dead exports, core lint, UI style lint, and other selected guards. Source hashes and the eight staged paths were verified before execution.tbx_01m4grcjmv4p1crvemc2k5avtb(lease workflow): 313 history/pagination/prefetch/MCP sibling tests passed during development. Its later lease ended at its one-hour limit during a gate, so final validation moved to AWS; the interrupted gate is not counted as passing.af123d11e45c. Full UI shard wall times were 339s / 329s / 248s; the UI E2E job took 163s and the Control UI performance job 115s.Remote command details
All heavy commands ran remotely through the installed Crabbox CLI, one at a time per lease. No local test suites, builds, or typechecks ran.
The gate's initial development failure was one shadowed callback name, now fixed. An early browser attempt reused the old bundle; explicit UI builds and served asset hashes corrected that before measurement. Raw Testbox sync does not copy the local index, so gates explicitly stage the hash-verified candidate paths.