Repository navigation
fix(ui): keep Canvas previews stable after history hydration - #138155
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 7:03 AM ET / 11:03 UTC. ClawSweeper reviewWhat this changesThe PR keeps persisted Canvas and MCP App previews at their producing tool positions, removes the matching assistant-message copy, and preserves preview identity across history hydration. Merge readiness⛔ Blocked before merge - 2 items remain The updated head addresses the prior Canvas-equivalence finding and remains a focused, useful fix for the linked Control UI bug. No blocking correctness or security finding was identified; the PR should remain open for normal exact-head CI and maintainer flow. Priority: P2 Review scores
Verification
How this fits togetherControl UI converts Gateway history and live tool results into ordered chat transcript rows. Canvas previews can be represented by a tool-result row and by a Gateway-added assistant-message block, so the UI builder must deduplicate them without changing their causal position. flowchart LR
A[Gateway chat history] --> B[Chat item builder]
C[Live tool results] --> B
B --> D[Canvas identity and deduplication]
D --> E[Assistant row grouping]
E --> F[Control UI transcript]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +85, Tests +239. Total +324 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Canvas equivalence, transcript-row identity, and synthetic-row grouping together in the Control UI projection path, with the existing focused regressions protecting the Gateway-produced history shape. Do we have a high-confidence way to reproduce the issue? Yes—source and focused regression fixtures reconstruct the multi-preview persisted-history shape that creates duplicated and regrouped Canvas rows; this external contributor branch was not executed locally. Is this the best way to solve the issue? Yes—the patch repairs the Control UI projection and grouping owners while preserving Gateway history projection, protocol, persistence, and ordinary assistant-authored Canvas grouping. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 98b1a1fcb5e4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Keep tool-result Canvas previews at their causal transcript positions, remove only matching Gateway-embedded copies, and preserve row identity across live-to-history hydration. Add unit and browser reload regressions for multiple previews.\n\nRefs openclaw#138102
Treat matching Canvas view IDs or URLs as the same artifact when removing the Gateway's assistant-message history copy. Keep identifier namespaces distinct and cover the URL-only history shape reported in review.\n\nRefs openclaw#138102
7f8dd45 to
ea4adf4
Compare
|
Addressed the P2 Canvas equivalence finding in ea4adf4:
Real behavior proof used the actual built Control UI and an isolated real Gateway on localhost; only the model provider was deterministic. The same persisted session was checked before reload and after history hydration. Both captures have exactly two Canvas previews in Canvas → Canvas → final reply order. The stored-data-model warning is a false positive: this PR changes only ephemeral Control UI projection helpers and does not add or modify a persisted schema or migration. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks @JosephNatsu — I kept both contributor commits and completed the real-agent restoration proof on The real flow also exposed an assistant embed-text copy and a pending iframe retaining an expired capability. The repair now normalizes those view representations and refreshes uninitialized frames, without adding a grouping policy or changing authentication, grants, or stored data.
The PR body now contains the inspected, cropped before/after images, exact commands, and the baseline/head evidence. This also addresses the unavailable-image concern and the stored-data-model warning: there is no schema or migration change. Exact-head LandPR review passed. CI run 33870926434 failed only @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
The deduplication is at the right identity boundary. Keeping the structured Canvas block while suppressing matching shortcode/tool previews avoids losing sandbox metadata.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks @JosephNatsu! Landed in 6b25e1840775 from verified head 622510952497. Contributor authorship and Ayaan's co-author credit are preserved. Proof: A real configured agent called built-in
Validation: 354 unit tests, 3 browser tests, exact build, selected checks, and exact-head LandPR review passed. LandPR used its verified-unrelated-CI exception for this unchanged agent-runner failure: The same three Code Mode cases and errors also fail on main run 33871141796. No unrelated test or authorization behavior was changed. |
…138155) Restore one inline Canvas preview per view after history hydration, reload, and Gateway restart. Prefer the structured assistant preview over equivalent tool-result and embed-text representations. Refresh a pending or failed iframe when its capability renews, while preserving an initialized widget's document and interactive state. Keep authentication, grants, persistence, protocol, configuration, and ordinary assistant grouping unchanged. Closes openclaw#138102. Co-authored-by: Ayaan Zaidi <[email protected]>


Closes #138102
Related: #27085
What Problem This Solves
One inline Canvas view could appear more than once when Control UI hydrated history. A separate startup race could leave restored cards showing an HTTP 401 document instead of the widget.
The shipped show_widget contract promises direct inline rendering and restoration after reload.
Why This Change Was Made
The same view can reach the UI through its tool result, an assistant embed shortcode, and a structured Canvas block added by Gateway history projection. Message normalization now keeps the structured representation, including its sandbox and dashboard metadata. The chat-item builder does not lift another tool-result preview when that turn already contains the matching assistant preview. ID and URL comparisons remain separate.
The iframe owner also follows renewed URLs while a frame is pending or failed. Once the trusted widget bridge initializes, it preserves that loaded document and its interactive state. An HTTP error page firing
loadis not treated as a working widget.Gateway history projection remains intact for other clients. The repair does not impose a separate assistant-group layout, change persistence or schemas, change the protocol or product configuration, or alter authentication, capability expiry, or MCP App grants. Bridge-disabled frames remain refreshable; no sandbox permission is added to detect initialization.
User Impact
Each intended inline view renders once after hydration, reload, and Gateway restart. Restored HTML remains visible and usable. Existing persisted widgets reopen without a migration.
This builds on @JosephNatsu's report, identity matching, and regression coverage. Contributor commits remain in the branch history. The additional repair and verification are AI-assisted.
Evidence
Real configured agent, built-in
show_widget, harmless inline HTML,pin:false, andpresentation.target:"assistant_message". Runs finished normally. No mock Gateway, mock provider, synthetic transcript, or direct tool invocation supplied this product proof.e4bba0813e7a12bc23294c60193002750df4c792.62251095249732eac1807694e82ebef2a9cfa6a0.Counts are rendered widget frames, not raw tool disclosures. Actual tool arguments, returned view identities, and history responses were retained privately. A baseline-created widget was also reopened successfully on the candidate.
Before: one view produced two cards.
After reload: one working card, with its detail control open.
After an isolated Gateway restart and reload: two working cards, with the second detail control open.
The access policy remains enforced: a loaded document can retain an expired URL, while new document loads use the current capability. Refetching an expired URL is not used as a test of an already loaded widget.
Validation:
pnpm build: passed, including Control UI and bundle limits.checks-node-compact-large-2. Its three unchanged Code Mode denial tests also fail on main run 33871141796. The same cases report the same missingmanager.getAppendParentIdandagentserrors. These agent-runner files are outside this UI diff; no unrelated test or authorization behavior was changed.Production: +149/-97 (net +52). Tests: +377/-4. One shrink-only assertion-baseline entry is separate test-tool accounting. The added production code owns normalization of the three observed representations and pending-versus-initialized frame lifetime; duplicate identity helpers and special grouping paths were removed.
The stored-data-model warning does not describe this diff: stored data, schemas, and migrations are unchanged, and the existing persisted-session reopen was exercised. The MCP App host and grants were not changed; no external MCP server was needed for the built-in HTML proof.
Commands run on the isolated proof worker