Repository navigation
fix(control-ui): keep inline widgets steady on chat reload - #169304
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 maintainer review before merge. What this changesThis PR saves inline widget heights in scoped chat snapshots and reserves that space while reloaded content arrives. Example: Reload a cached conversation containing a 700 px Canvas widget.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a remaining widget reload layout bug, with inspected visual evidence and successful CI on the reviewed head; no actionable defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI receives widget size reports from sandboxed content, stores bounded measurements with the conversation snapshot, and supplies them to Canvas and MCP App loading views. flowchart LR
A[Sandboxed widget] --> B[Widget host]
B --> C[Scoped chat snapshot]
C --> D[Browser snapshot storage]
D --> E[Cached conversation reload]
E --> B
B --> F[Stable transcript layout]
Technical reviewBest possible solution: Retain measured sizing under the existing scoped snapshot owner and use it consistently through widget loading. Do we have a high-confidence way to reproduce the issue? Current-main source lacks persisted widget sizing, and the supplied baseline browser capture demonstrates the resulting loading-height change. Is this the best way to solve the issue? The change fixes the sizing owner directly, preserves existing bounds and invalidation, and removes the competing page-wide cache. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dafb31c14dfa. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +103, Tests +270, Docs +2. Total +375 across 20 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 HistoryReview history (9 earlier review cycles; latest 8 shown)
Reviewed October 11, 2026, 11:57 PM ET / October 12, 2026, 03:57 UTC (Revision 10). |
bdde74d to
0619074
Compare
efc041f to
2041b3f
Compare
## What Problem This Solves Fixes `check-test-types-core-2` failures inherited by PRs after the MCP App tests switched from Lit to Solid. ## User Impact No user-visible change. This restores typechecking for the existing MCP App lifecycle and context-update regressions without weakening their assertions. ## Why This Change Was Made The fixture migration in #169387 left a raw Solid memo accessor as a component return value and awaited Lit's `updateComplete` on a plain Solid-rendered context-strip element. Render the memo through a JSX fragment in a `.test.tsx` fixture, and wait for the context strip's observable item/empty state with the existing `waitForSolid` helper. All teardown, retained-node, and context assertions remain intact. Checked existing work first: #169247 does not change these tests and its `check-test-types-core-2` job is red; #169304 changes different parts of the MCP App tests and does not repair these errors. ## Evidence Baseline: current `origin/main` at `5889e62f4902b8f3fa4b6eb2cecbbd26f5b8ceb0`, installed with `pnpm install --frozen-lockfile`. Before, `pnpm run tsgo:test:ui` exited 2: ```text ui/src/components/mcp-app-unmount.test.ts(40,5): error TS2345: Argument of type '() => SourceAccessor<Node[]>' is not assignable to parameter of type '() => Element'. ui/src/components/mcp-app-view.test.ts(801,19): error TS2339: Property 'updateComplete' does not exist on type 'Element'. ui/src/components/mcp-app-view.test.ts(804,19): error TS2339: Property 'updateComplete' does not exist on type 'Element'. ui/src/components/mcp-app-view.test.ts(815,19): error TS2339: Property 'updateComplete' does not exist on type 'Element'. [tsgo:ui-components] failed (exit 2) ``` After: - `pnpm run tsgo:test:ui`: all eight graphs passed, including `ui-components`. - `node scripts/run-vitest.mjs ui/src/components/mcp-app-unmount.test.tsx ui/src/components/mcp-app-view.test.ts --maxWorkers=1`: 31 tests passed across the regular and isolated UI projects. Test time: 71 ms for unmount and approximately 5.9 s for view (4.6 s is the existing embedded Apps page scenario). - Changed-file `oxfmt --write` and `oxlint`: passed. - `node --import ./scripts/tsx.mjs scripts/check-line-cap-ratchet.mts --base origin/main`: passed, no new violations or over-cap growth. The existing embedded Apps page scenario emits Lit/reactivity and jsdom CSS warnings; it passes without suppressions or retry changes. - Independent autoreview: scoped clean through P2; no actionable findings. Co-authored-by: Ayaan Zaidi <[email protected]>
Persist measured Canvas and MCP App heights in the scoped chat snapshot and reserve them before lazy widget content loads. Keep transcript end anchoring stable while delayed content fills in place; retire the separate page-wide iframe height map.
2041b3f to
56c5303
Compare
## What Problem This Solves Fixes `check-test-types-core-2` failures inherited by PRs after the MCP App tests switched from Lit to Solid. ## User Impact No user-visible change. This restores typechecking for the existing MCP App lifecycle and context-update regressions without weakening their assertions. ## Why This Change Was Made The fixture migration in openclaw#169387 left a raw Solid memo accessor as a component return value and awaited Lit's `updateComplete` on a plain Solid-rendered context-strip element. Render the memo through a JSX fragment in a `.test.tsx` fixture, and wait for the context strip's observable item/empty state with the existing `waitForSolid` helper. All teardown, retained-node, and context assertions remain intact. Checked existing work first: openclaw#169247 does not change these tests and its `check-test-types-core-2` job is red; openclaw#169304 changes different parts of the MCP App tests and does not repair these errors. ## Evidence Baseline: current `origin/main` at `11f576b23cf70615ca4504eb12fdba93591b9c8f`, installed with `pnpm install --frozen-lockfile`. Before, `pnpm run tsgo:test:ui` exited 2: ```text ui/src/components/mcp-app-unmount.test.ts(40,5): error TS2345: Argument of type '() => SourceAccessor<Node[]>' is not assignable to parameter of type '() => Element'. ui/src/components/mcp-app-view.test.ts(801,19): error TS2339: Property 'updateComplete' does not exist on type 'Element'. ui/src/components/mcp-app-view.test.ts(804,19): error TS2339: Property 'updateComplete' does not exist on type 'Element'. ui/src/components/mcp-app-view.test.ts(815,19): error TS2339: Property 'updateComplete' does not exist on type 'Element'. [tsgo:ui-components] failed (exit 2) ``` After: - `pnpm run tsgo:test:ui`: all eight graphs passed, including `ui-components`. - `node scripts/run-vitest.mjs ui/src/components/mcp-app-unmount.test.tsx ui/src/components/mcp-app-view.test.ts --maxWorkers=1`: 31 tests passed across the regular and isolated UI projects. Test time: 71 ms for unmount and approximately 5.9 s for view (4.6 s is the existing embedded Apps page scenario). - Changed-file `oxfmt --write` and `oxlint`: passed. - `node --import ./scripts/tsx.mjs scripts/check-line-cap-ratchet.mts --base origin/main`: passed, no new violations or over-cap growth. The existing embedded Apps page scenario emits Lit/reactivity and jsdom CSS warnings; it passes without suppressions or retry changes. - Independent autoreview: scoped clean through P2; no actionable findings. Co-authored-by: Ayaan Zaidi <[email protected]>
…169304) * perf(control-ui): reserve inline widget height on reload Persist measured Canvas and MCP App heights in the scoped chat snapshot and reserve them before lazy widget content loads. Keep transcript end anchoring stable while delayed content fills in place; retire the separate page-wide iframe height map. * fix(control-ui): release temporary widget size reservation * style(control-ui): resolve widget reload lint violations * test(control-ui): isolate delayed widget anchor stability * fix(control-ui): bind widget sizes after the first snapshot arrives * test(control-ui): prove cached widget reload before fresh history * test(control-ui): hold reconnect until cached widget paint
What Problem This Solves
Inline widgets shift surrounding transcript messages when a signed-in operator reloads a dashboard deep link. The campaign observed the transcript at about 2.56 seconds, followed by inline-card growth around 2.7–3.6 seconds.
User Impact
Previously rendered Canvas widgets and MCP Apps reserve their measured height before lazy registration, their view response, and sandbox content arrive. Content fills the existing box. New widgets use their declared/default size; changed content or viewport widths can still resize normally.
Why This Change Was Made
Measured heights live in the existing scoped chat snapshot, bounded to 100 widgets per session and cleared with its existing session/account invalidation. Both widget hosts use that size throughout loading. The raw iframe path's separate page-wide height map is removed. The writer can bind when its first snapshot arrives and rejects a replaced backing session.
Production LOC: +103 (148 added, 45 removed across 14 production files), using
git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*'. Growth implements the persisted sizing contract and its propagation to both hosts; obsolete iframe-cache machinery is deleted. This stays within the existing client cache owner.Evidence
The synthetic mock-Gateway flow renders a real 700 px widget, verifies its persisted height, reloads with reconnect held until the cached preview appears, then connects and holds the widget response. It samples every animation frame through content arrival.
The baseline fails the regression; the final cache-hit fixture passes locally, inside the full suite, and in Linux PR CI. All screenshots use synthetic data and were inspected before upload.
The existing snapshot startup budget can still discard a cache read when fresh history wins. The newer Solid transcript renderer also has an initial scroll-settling delay. Those are separate follow-ups: this lane checks height from the first cached frame and anchor stability across delayed widget content after initial transcript settlement.
Focused proof
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts ui/src/e2e/chat-widget-autosize.e2e.test.ts --maxWorkers=1.pnpm test ui/src/pages/chat/session-message-cache.test.ts --maxWorkers=1: 17 passed, 2.94 s. Early writer ordering fails before its fix and passes afterward.pnpm test ui/src/components/mcp-app-view.test.ts --maxWorkers=1: 27 passed, 7.40 s after shared-fixture extraction.pnpm test ui/src/components/mcp-app-view-sizing.test.ts --maxWorkers=1: 1 passed, 4.97 s.pnpm test ui/src/components/canvas-widget-view.test.ts --maxWorkers=1: 33 passed, 6.10 s.tbx_01m4p2narat2z7qcyj2xz76qpt(13.26 s wrapper). Allocation. Lease stopped. Two subsequent sync timeouts triggered the authorized local fallback.Final-head full UI E2E
The full-suite results below are historical evidence from the previously reviewed head. This refresh used the lead-requested focused tests and complete PR CI; it does not relabel the old full run as proof of the rebased head.
Head
2041b3fb63cf0a5b8c2d6b8ebea37404d9275588, commandnode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --maxWorkers=2:730 files passed, 13 failed, 1 skipped; 3,329 tests passed, 45 failed, 1 skipped. Vitest duration: 6,176.67 s. All widget cases passed.
Baseline replays used main source
3be41182be9b09709f3e6c038c46aeb7d633841d, individually with one worker. Multi-case files have representative-case coverage rather than a complete second suite.claude-sessions.e2e.test.tslazy-custom-element-recovery.e2e.test.tsdebug-overlay.tsbuilt-chunk failureboard-mcp-app.e2e.test.tschat-subagent-waiting.e2e.test.tsmeetings.e2e.test.tssettings-prefs-reconnect.e2e.test.tstheme-muted-contrast.e2e.test.tschat-scroll.e2e.test.tschat-history-prepend-anchor.e2e.test.tssession-owner-filter-keyboard.e2e.test.tschat-follow-maintenance.e2e.test.tschat-history-loading.e2e.test.tschat-collaborator-scroll.real-gateway.e2e.test.tsCI state
Refreshed CI run 38199740772 completed SUCCESS on head
56c53038c4551eb809eaf0d63833662eb063c48b, rebased onto main00809bf2c2a0with Solid 2.0.0-rc.14. GitHub reports MERGEABLE.openclaw/ci-gateAfter the rebase and frozen-lockfile install, all ten focused widget/snapshot/transcript test files passed individually with one worker. The cached-widget E2E file also passed all three tests (49.71 s including setup). No red CI jobs remain, so no new main comparison or retry was needed. Platform/release lanes outside this PR's selection were skipped normally.
The lead owns landing. This ready PR remains open and is not configured to merge automatically.