Repository navigation
perf(control-ui): warm-start dashboard widgets from scoped snapshots - #178113
Conversation
|
🦞👀 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 real behavior proof before merge. What this changesThis PR restores cached dashboard metadata before connection completion so widget sandboxes can start earlier. Example: Reload the cached Mission control dashboard while Gateway hello and board.get are delayed.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open as the owner's explicitly paused experiment; the new persistence path can save mutation-only fields that invalidate the shared warm cache. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI board provider receives Gateway snapshots, publishes widget state to dashboard panes, and now saves that state through the account-scoped conversation snapshot store. flowchart TD
A[Dashboard route] --> B[Conversation snapshot store]
B --> C[Board provider]
D[Gateway board responses] --> C
C --> B
C --> E[Widget sandbox]
E --> F[Authorized document and action requests]
Technical reviewBest possible solution: Persist canonical board fields through the existing snapshot owner, then qualify the warm-start experiment without weakening live authority checks. Do we have a high-confidence way to reproduce the issue? Source establishes both the existing board-data dependency and the introduced pin-response validation failure; no target code or tests were executed. Is this the best way to solve the issue? Reusing the scoped conversation store and existing board provider is a focused approach, but persisted snapshots must project the canonical board shape rather than retain complete mutation responses. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 765a5f2f4c44. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: unit tests only. SecurityNeeds attention: Persisted view tickets need final-effect revocation proof before this experiment can merge. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +421, Tests +404, Docs +3, Generated +26, Other +130. Total +984 across 22 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 20, 2026, 1:58 AM ET / 05:58 UTC. |
4f43da4 to
beef7f2
Compare
06910b8 to
7e93326
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
67f041f to
db4ac4b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db4ac4b7e5
ℹ️ 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".
| // Boards belong to the scoped conversation key, independently of transcript resets. | ||
| const snapshot = | ||
| withWidgetHeights.board === undefined && existing?.snapshot.board !== undefined | ||
| ? { ...withWidgetHeights, board: existing.snapshot.board } | ||
| : withWidgetHeights; |
There was a problem hiding this comment.
Preserve board snapshots during transcript invalidation
Storing the board only inside the transcript cache record means transcript-only operations also erase the board: both rewindChatHistory and switchChatHistoryBranch call clearChatMessagesFromCache, which unconditionally deletes the whole in-memory and IndexedDB snapshot. Those operations do not change the dashboard or trigger board.changed, so the board is not persisted again until a later board mutation; a reload in between loses the warm dashboard and waits for board.get. Preserve the board when invalidating transcript fields, or give it an independent invalidation lifecycle.
AGENTS.md reference: ui/AGENTS.md:L16-L19
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed the cache-miss case. Rewind and branch switching intentionally evict the entire existing conversation snapshot through clearChatMessagesFromCache and SessionSnapshotStore.delete; the next dashboard reload therefore takes the live board.get path until the board is cached again. The board is not lost on the server, stale content is not shown, and authority checks are unchanged.
I am retaining that shared-record invalidation contract in this bounded warm-start change rather than adding a separate board-retention lifecycle. Ordinary transcript replacement already preserves the board; explicit snapshot eviction, expiration, and pruning remain allowed to discard it. I will document this limitation in the PR. Preserving warm dashboards across explicit history eviction is a follow-up optimization, not a correctness blocker for this cache.
|
@clawsweeper re-review Final head: db4ac4b. The body now contains the final 11-pair dashboard/chat comparison, stage table, accepted tradeoff, source-mapped attribution, and exact-head validation. Startup is 325,075 B gzip, 91 B below the unchanged cap. CI is green. The final full UI run passed 834 files; its two failures reproduce on the pinned main baseline. Focused UI tests pass (316), as do the existing board HTTP and runtime-authority tests (24), including expired/stale ticket rejection and current authority at effects. The raw changed-check failures and matching baseline evidence are listed in the body. Independent review is clean through P2. The retired-lease persistence finding is fixed. The newer advisory about explicit history-cache eviction is documented as a safe cold-load limitation, with the existing shared-record invalidation lifecycle retained. No merge action is requested. |
|
🦞👀 Re-review progress:
|
…rator Main's #178113 regenerated board.js with the previous generator after this branch's base. Regenerating with this branch's generator drops the physical dependency-path banner like the other validators; executable output is unchanged.
…rktrees (#177934) * fix(update): make validator generation path-independent and allow linked worktrees Generated control UI validators embedded physical dependency paths, so a hoisted or global install failed the freshness check. esbuild now minifies whitespace, dropping those path banners; the TypeBox license is kept and executable output is unchanged. The reference-source snapshot rejected a registered linked worktree nested in the checkout. It now excludes only a positively identified registered worktree (reciprocal .git, gitdir and commondir identity) and rechecks it before stopping the Gateway. Unknown nested repositories still refuse. * chore(ui): regenerate board validators with the path-independent generator Main's #178113 regenerated board.js with the previous generator after this branch's base. Regenerating with this branch's generator drops the physical dependency-path banner like the other validators; executable output is unchanged.
…ript validation (#178658) L158 (#178113) restores a cached dashboard before hello, but the restore waited on the lazily loaded transcript validator, so on Team the sandbox iframe often attached only after board.get returned (live r173: 776-797 ms in one batch, 505-633 ms in another). Restore the board snapshot independently of transcript validation, after the WebSocket connect request has been sent (a new initialConnectSent signal) so the early dashboard render never lands in the hello-handling window; re-read the cache after that wait and keep every #178113 safety rule (shape validation, session match, pending/rejected grant filter, ticket TTL aging, board.get authority). Evidence (AWS c7a.4xlarge, 11 pairs, synthetic dashboard fixture with the transcript validator held): sandbox iframe insertion 808.8 -> 359.3 ms (-450.7 paired, 11/11); hello handling +8.1 ms paired with overlapping IQRs (within the no-regression rule); FCP, LoAF, chat catch-up and chat-route controls unchanged. Runtime +35 LOC. Full UI 837 files / 3,617 tests (4 opt-in skips); focused tests incl. a held-validator negative control that fails on the original restore; exact-head CI green.
…trip (openclaw#178113) Reloading a dashboard-face session started its MCP app only at the end of a serial chain: WebSocket connect -> hello -> board.get -> mcp.app.discover -> board chunk mount -> sandbox iframe -> sandbox document -> board HTML -> srcdoc -> app. Live on Team (Peter's dashboard session) the sandbox iframe was inserted at ~0.72-1.16 s and the app painted last, after the sidebar, chat pane and a shimmering dashboard skeleton. Persist the last board snapshot with the session's existing scoped conversation snapshot (same account/host/agent scope, written after the transcript's initial hydration so it never invalidates that read). On warm reload the board provider restores it before hello: the cached snapshot is shape-validated (generated board validator) and must match the session; MCP apps whose grant is pending or rejected are not restored; view-ticket TTLs are aged from their original receipt so expired tickets are not reused. board.get remains authoritative: a fresh snapshot replaces the restored one, FORBIDDEN or definitive unavailability clears the board and the cached copy. Board UI strings move to a board-owned English catalog and the plugin settings-view loader becomes lazy, keeping startup JS under its unchanged cap (325,075 B gzip, 91 B headroom). Evidence (AWS c7a.4xlarge, 11 interleaved pairs, synthetic dashboard/MCP-app fixture with live-like handshake timing): dashboard app-ready -417.5 ms paired (11/11 faster); hello handling and FCP steady; LoAF median 191 -> 192 ms. Accepted tradeoff: dashboard-page chat catch-up +29 ms paired. Runtime +255 handwritten LOC plus a 259-line generated board validator. 316 focused + 24 authority tests; full UI 834 files (2 failures reproduce on baseline); exact-head CI green.
…rktrees (openclaw#177934) * fix(update): make validator generation path-independent and allow linked worktrees Generated control UI validators embedded physical dependency paths, so a hoisted or global install failed the freshness check. esbuild now minifies whitespace, dropping those path banners; the TypeBox license is kept and executable output is unchanged. The reference-source snapshot rejected a registered linked worktree nested in the checkout. It now excludes only a positively identified registered worktree (reciprocal .git, gitdir and commondir identity) and rechecks it before stopping the Gateway. Unknown nested repositories still refuse. * chore(ui): regenerate board validators with the path-independent generator Main's openclaw#178113 regenerated board.js with the previous generator after this branch's base. Regenerating with this branch's generator drops the physical dependency-path banner like the other validators; executable output is unchanged.
…ript validation (openclaw#178658) L158 (openclaw#178113) restores a cached dashboard before hello, but the restore waited on the lazily loaded transcript validator, so on Team the sandbox iframe often attached only after board.get returned (live r173: 776-797 ms in one batch, 505-633 ms in another). Restore the board snapshot independently of transcript validation, after the WebSocket connect request has been sent (a new initialConnectSent signal) so the early dashboard render never lands in the hello-handling window; re-read the cache after that wait and keep every openclaw#178113 safety rule (shape validation, session match, pending/rejected grant filter, ticket TTL aging, board.get authority). Evidence (AWS c7a.4xlarge, 11 pairs, synthetic dashboard fixture with the transcript validator held): sandbox iframe insertion 808.8 -> 359.3 ms (-450.7 paired, 11/11); hello handling +8.1 ms paired with overlapping IQRs (within the no-regression rule); FCP, LoAF, chat catch-up and chat-route controls unchanged. Runtime +35 LOC. Full UI 837 files / 3,617 tests (4 opt-in skips); focused tests incl. a held-validator negative control that fails on the original restore; exact-head CI green.
What Problem This Solves
A signed-in reload of a dashboard deep link waits through connect → hello → board.get → discover before its primary content appears. The reported live reload inserted the sandbox iframe only after 1,016–1,161 ms. This change restores the dashboard from the last scoped conversation snapshot while live authority catches up.
The existing account/host/agent/session-scoped conversation cache retains board metadata and its original ticket receipt. Unchanged content keeps its iframe; changed, removed, expired, or forbidden content replaces or clears it. Unconfirmed apps cannot auto-start from cache. No new store, Gateway schema, configuration option, or sandbox security-model change.
Board restoration and validation remain outside startup. Packaged Settings loading and widget-only English copy load with their consumers. The final AWS build measures 325,075 B gzip, down from 325,890 B on baseline, with seven startup requests unchanged. The cap stays 325,166 B, leaving 91 B headroom. Source-map inspection confirms the board restore helper, generated board validator, Settings loader, and widget catalog are absent from startup.
Evidence
Head:
db4ac4b7e54436fffdfe4f22b627e596a3e56b24. Baseline:8fe652f7cef3ea1901eb6b916ec002bef90d9598. AWS Crabboxcbx_f35cc07b0ab5, fixed c7a.4xlarge, 16 vCPUs / approximately 32 GiB, repository Playwright Chromium. Eleven interleaved baseline/candidate pairs for each route, separate from the six CPU-profile captures. Connect floor 400 ms, connect response delay 230 ms, board.get 150 ms, discover 100 ms. Dashboard connect sends were 442.8–486.2 ms on baseline and 439.6–468.8 ms on candidate, within the declared live-like range.The measured fixture is a synthetic HTML-backed dashboard widget through the cross-origin sandbox/board-HTTP path, with its own font. Native MCP app-view mode has a separate passing smoke check; the timing claim is for the HTML-backed path. App-ready is the host receiving the synthetic app's readiness message after its font and two animation frames, not a compositor-paint timestamp. Hello-handled is the microtask after connected-state publication. Request timestamps are main-thread dispatch observations, not network arrival times.
Dashboard-ready improves 1,497.2 → 1,033.9 ms, paired median −417.5 ms, 11/11 faster, with separated IQRs. Every dashboard ends with the same five chat rows, one iframe, and one board HTML fetch; chat-route controls retain six rows. The fixture does not reproduce the reported duplicate HTML fetch, so this PR does not claim a duplicate-fetch fix.
All gates pass under the declared rule: the primary needs separated lower IQRs or at least 9/11 faster pairs with negative median delta. A secondary regresses only with separated higher IQRs, or at least 9/11 slower pairs plus a median rise greater than max(10 ms, 3%).
Dashboard
Chat
Accepted tradeoff
The maintainer accepted extra dashboard-page blocking and later secondary-pane chat catch-up for the primary dashboard-ready gain. The originally accepted run had +12 ms median LoAF blocking and +45.1 ms paired chat catch-up.
On the final head, dashboard LoAF blocking is 191 → 192 ms median, with overlapping IQRs and a −8 ms paired median. Dashboard chat catch-up is 1,115.7 → 1,153.0 ms, paired +29.0 ms. Catch-up is later in 8/11 pairs; its IQRs overlap, so it passes the declared regression rule. The remaining secondary-pane delay is retained under the accepted tradeoff.
Hello-handled is 715.4 → 715.1 ms, paired −2.3 ms. FCP is 236 → 240 ms, paired 0 ms; one pair has a +232 ms FCP outlier, while the IQRs overlap. All chat-route controls pass. A live regression in hello-handled time or final chat rows means revert.
Source-mapped attribution
Three profiles per build reveal no supported ≤20-line product fix. The candidate frame with extra blocking spends 13.9 ms in the benchmark's own visibility probe, including 13 ms forced style/layout. The exact source is
warmReloadProbe.sample, which callsgetComputedStylebefore recording catch-up readiness. This explains that profiled frame, not every unprofiled blocking difference; no probe cost is subtracted from the gate above.A roughly 16 ms theme-token read appears in both builds. Whole-reload sidebar geometry samples rise from roughly 15 to 30 ms, but do not establish duplicate reads or a safe way to omit the width measurement. Cache serialization, cached-board validation/restoration, and board rendering show no concentrated extra cost. Exact-window application self median is 30.2 → 25.0 ms; whole-reload application self is 671.0 → 658.4 ms. No speculative theme, cache, or scheduling change is included.
Profiling changes scheduling: only one candidate capture mounts before hello, and its connect send is 631 ms, outside the requested range. The unprofiled pairs above reproduce the requested handshake range and decide the gate. Profiles cover host execution, not sandbox subprocess CPU; inclusive samples overlap and cannot be added.
Correctness and validation
All proof below uses head
db4ac4b7e54436fffdfe4f22b627e596a3e56b24on AWS Crabboxcbx_f35cc07b0ab5(runrun_501abf5c7c696cd668d3f05c717f0425, fixed c7a.4xlarge). Baseline reproductions use8fe652f7cef3ea1901eb6b916ec002bef90d9598and its matching Gateway/UI build on the same lease.--maxWorkers=1--maxWorkers=1node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --maxWorkers=4node scripts/check-changed.mjsThe full suite passes the new dashboard cold-load E2E (2 cases, 8.629 s), native MCP board flows, widget sandbox, dashboard presentation/retention, lazy plugin Settings, and locale-loading coverage. The four skipped cases retain their existing suite conditions; no skip or expected-failure exception was added.
Regression coverage includes changed/removed/forbidden boards, unconfirmed apps, foreign scope, reconnect, expired ticket lifetimes, malformed cached boards preserving the transcript, Settings disposal during lazy loading, and cancellation of deferred cache writes after a board lease retires. The retired-lease regression failed before the fix and passes afterward.
chat-pane-board.loading.test.tsxtook 19.66 s locally with one worker; the final English-catalog test fix took 2.19 s locally. These are test runtimes, not performance measurements. The existing HTTP/runtime tests cover allowed document delivery, expired/stale ticket rejection, and live authority at board effects.Inherited failures
extensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.tsui/src/pages/workboard/workboard-distribution.e2e.test.ts.workboard-page-titlecontaining the synthetic titlechat-message.test.tsx,config-page-state.ts,sessions-page-state.tsalreadyCurrentConvergenceCasesinsrc/cli/update-cli/update-command-runtime-recovery.test-support.tsThe two failing E2E files were rerun together on baseline with one worker: 2 failed, 1 passed, 168.01 s. The baseline lint reproduction took 44.7 s. Raw failing results remain recorded; no cap, lint rule, test, or permission check was weakened.
Identical baseline/head max-lines findings
src/agents/code-mode-execution.ts: 701 counted linessrc/agents/embedded-agent-runner/run/terminal-preparation.test.ts: 1007 counted linessrc/agents/harness/execution-environment.ts: 723 counted linessrc/cron/isolated-agent/run-prompt-executor.ts: 701 counted linessrc/gateway/methods/core-descriptors.ts: 701 counted linessrc/gateway/node-registry-private.ts: 710 counted linessrc/gateway/server/ws-connection/message-handler.ts: 707 counted linessrc/gateway/session-worktree-preparation.ts: 725 counted linessrc/state/openclaw-agent-db.postgres.test.ts: 1142 counted linessrc/state/openclaw-database-preflight.ts: 704 counted linesui/src/app/app-shell-gateway.test.ts: 1063 counted linesui/src/app/bootstrap.ts: 733 counted linesui/src/pages/activity/activity-page.test.ts: 1287 counted linesui/src/pages/chat/chat-thread-build.ts: 745 counted linesui/src/pages/chat/components/chat-transcript-virtualizer-host.ts: 701 counted linesui/src/pages/model-providers/login-controller.ts: 704 counted linesui/src/pages/model-setup/model-setup-owner.ts: 714 counted linesui/src/pages/new-session/draft-place-state.ts: 707 counted linesKnown cache limit: explicit conversation-snapshot eviction, including rewind and branch switching, can discard the board alongside the transcript. The following reload safely uses live board loading until a board response repopulates the cache. Ordinary transcript replacement preserves board metadata. The existing bounded shared-record invalidation lifecycle is retained; review disposition.
Production size and release context
Handwritten UI runtime delta: +255 LOC (392 added, 137 removed). Generated board validator/types: +259 LOC. Growth implements the scoped board snapshot, original ticket lifetime, live reconciliation, and hydration/lease invalidation contracts. The superseded eager Settings loader body is removed; widget-only English copy leaves the eager catalog. No server durable-state change, new store, configuration option, or dependency.
Requested diff-stat command (
git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*'): 33 files, +1,183/−230, net +953. That literal pattern includes benchmark/probe fixtures and.test.tsxfiles; the runtime-only counts above exclude them. Release-note context: returning dashboard sessions can start embedded content from a scoped snapshot while live state reconciles.Synthetic visual diagnostic
These synthetic-only captures illustrate the warm-start behavior. They are earlier traced diagnostic runs (baseline frame 1,609 ms; candidate frame 1,691 ms), not timing proof. No private capture was uploaded.
Ready for maintainer review. Do not merge automatically. A live regression in hello-handled time or final chat rows means revert.