Skip to content

fix(ui): preserve rich preview metadata beside shortcodes - #138593

Merged
steipete merged 1 commit into
mainfrom
codex/watch-canvas-preview-final
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/watch-canvas-preview-final

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What this fixes

An assistant reply containing only an [embed] shortcode could discard the matching tool result’s rich preview metadata. An MCP App then rendered as a Canvas document instead of an interactive App; dashboard widget identity and the tool’s sandbox ceiling could also be lost. The regression affected live results and persisted history in either ordering.

The projection now deduplicates against actual structured Canvas blocks, not the lightweight preview synthesized from a shortcode. History enrichment updates the existing owned display row, so it preserves one card, stable row identity and transcript immutability. The existing canonical Canvas parser is reused by both paths. Raw structured-block deduplication, turn boundaries and search filtering remain unchanged.

Validation

  • Refreshed on pinned main b1164348d55ca3bc221544daa86a908b70c100c6. All four repair files remain byte-identical to the previously reviewed candidate; current renderer and test/build context are retained.
  • Before the production repair: all six metadata regressions fail and all 248 existing chat-thread controls pass. After: 410/410 tests pass, zero skipped, across chat-thread, message normalization and tool-card rendering.
  • Actual Chromium against freshly built Control UI, with synthetic Gateway data and the real sandbox HTTP owner: before, one Canvas-document card/request and no App request; after, one interactive MCP App/request and no Canvas-document request. Reload keeps exactly one App. The same scenario and exact final source bytes were used; all owned browser/context/server resources closed.
  • All 20 canonical staged changed-file checks passed (261.085s), including core-test/UI types, format, UI i18n, line/assertion ratchets, export scans and lint. Fresh current-base independent P0–P3 review was scoped-clean (93.589s). No hosted CI result is claimed yet.

Before / after

Both captures are synthetic-only and have been inspected for unrelated or sensitive content. The before error is an intentional mocked missing-document response, not a claim about provider availability.

Before: the App descriptor is lost and the Canvas-document renderer is selected

After: the canonical interactive MCP App renders once

Scope and release-note context

Restore rich Canvas/MCP App previews when an assistant emits a matching shortcode, including dashboard widget identity and sandbox metadata. No new protocol, configuration, database, dependency or compatibility surface. Production is +49/-23 lines (net +26), needed to retain the owning history row across both result orderings while avoiding duplicate cards; tests add 56 lines in the existing suite. No changelog edit is included under the repository’s release-time convention.

Final review disposition

Reviewed the latest ClawSweeper disposition. The +26 production lines retain the existing display-row owner so rich tool metadata can enrich either persisted ordering without another card; the canonical parser is shared rather than duplicated. All six metadata/order regressions, 410 owner tests, source-bound before/after Chromium proof and 20 local changed checks pass. Exact-head CI 33917323341 is now successful. No config, storage, protocol or sandbox policy change is introduced; proceed through the normal prepare/merge gates.

Keep canonical structured preview metadata when an assistant shortcode
matches a live or persisted tool result. Reuse the Canvas block parser and
enrich the owned display row without duplicating cards or mutating history.

Cover MCP App and dashboard metadata across live and both history orders.
The six regressions fail before the repair; 410 owner cases, 20 canonical
checks and an independent review pass. Source-bound Chromium reproduces
the wrong renderer before and the interactive App after, including reload.
@steipete steipete self-assigned this Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 4:45 PM ET / 20:45 UTC.

ClawSweeper review

What this changes

The PR preserves rich Canvas and MCP App preview metadata when an assistant shortcode references the same live or persisted tool result.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: current main does not contain the repair, and the introduced raw-structured-block dedupe correctly preserves the metadata that selects the interactive MCP App renderer without adding a second card.

Priority: P2
Reviewed head: 7d1bec73854213cc616bb17828203b0a5d177537

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-covered fix with supplied real browser evidence and no actionable correctness or security finding.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.
Evidence reviewed 5 items Introduced owner-boundary repair: The PR records each normalized assistant Canvas preview with its display row, then enriches that row when the same-turn persisted tool result matches; unmatched results still use the existing synthetic-row path.
Canonical parser and raw-block dedupe: The shared parser preserves validated sandbox, dashboard, and MCP App fields; the append helper now deduplicates only against an actual structured Canvas block, rather than a shortcode-derived normalized projection.
Renderer consumes preserved descriptor: The widget renderer selects the interactive MCP App branch when preview.mcpApp is present and otherwise renders the Canvas document branch, so retaining that descriptor is the relevant visible behavior.
Findings None None.
Security None None.

How this fits together

The Control UI converts Gateway history and live tool results into chat rows, then renders Canvas previews as either documents or interactive MCP Apps. The change keeps the structured preview attached to its owned display row so the renderer receives its sandbox and App descriptor.

flowchart LR
  A[Gateway history and live results] --> B[Message normalization]
  B --> C[Chat row builder]
  C --> D[Structured preview matching]
  D --> E[Canvas or interactive App renderer]
Loading

Before merge

  • Resolve merge risk (P1) - Production code grows by 26 net lines for this bug fix; the added stable display-row reference is justified by supporting both persisted orderings without a duplicate card, and the added table coverage exercises that boundary.
Agent review details

Security

None.

PR surface

Source +26, Tests +56. Total +82 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 49 23 +26
Tests 1 56 0 +56
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 105 23 +82

Review metrics

Metric Value Why it matters
Production vs test LOC production +49/-23 (net +26); tests +56/-0 The production growth is limited to retaining the owned display-row reference needed for both history orderings; the tests cover all six metadata/order combinations.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared structured-preview parser and enrich the existing assistant display row, preserving one card and the renderer-critical MCP App, widget, and sandbox fields across live and history paths.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared structured-preview parser and enrich the existing assistant display row, preserving one card and the renderer-critical MCP App, widget, and sandbox fields across live and history paths.

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

Yes, at source level: a tool result and matching assistant shortcode lose the MCP App descriptor under the former normalized-message dedupe; the added six owner-boundary cases cover live and both persisted orderings.

Is this the best way to solve the issue?

Yes. The repair changes the projection boundary where a shortcode-derived preview was incorrectly treated as equivalent to a structured preview, while the renderer continues to use its existing canonical descriptor.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against cbbe91d8f75a.

Labels

Label changes:

  • add P2: This is a bounded Control UI rendering regression that can select the wrong preview type while leaving the core runtime available.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.
  • 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. Sufficient (screenshot): The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.

Label justifications:

  • P2: This is a bounded Control UI rendering regression that can select the wrong preview type while leaving the core runtime available.
  • 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. Sufficient (screenshot): The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body supplies after-fix Chromium evidence against the built Control UI using synthetic Gateway data and the real sandbox HTTP owner: it reports one interactive MCP App request/card after the fix, no Canvas-document request, and the same result after reload. The linked captures could not be fetched in this review environment because GitHub DNS resolution failed, but that reviewer limitation does not negate the described source-bound evidence.

Evidence

What I checked:

  • Introduced owner-boundary repair: The PR records each normalized assistant Canvas preview with its display row, then enriches that row when the same-turn persisted tool result matches; unmatched results still use the existing synthetic-row path. (ui/src/pages/chat/chat-thread-build.ts:143, 7d1bec738542)
  • Canonical parser and raw-block dedupe: The shared parser preserves validated sandbox, dashboard, and MCP App fields; the append helper now deduplicates only against an actual structured Canvas block, rather than a shortcode-derived normalized projection. (ui/src/lib/chat/message-normalizer.ts:148, 7d1bec738542)
  • Renderer consumes preserved descriptor: The widget renderer selects the interactive MCP App branch when preview.mcpApp is present and otherwise renders the Canvas document branch, so retaining that descriptor is the relevant visible behavior. (ui/src/pages/chat/components/widget-card.ts:458, 7d1bec738542)
  • Behavior-bound regression coverage: Six table-driven cases cover live, persisted-before, and persisted-after orderings for both MCP Apps and dashboard widgets; they assert one preview, retained rich fields, residual text, and input immutability. (ui/src/pages/chat/chat-thread.test.ts:4569, 7d1bec738542)
  • Current-main and release provenance: The PR head is not an ancestor of fetched main, while its base is; fetched main has no diff from the base across the four PR paths. The latest stable tag is v2026.9.1 and predates the base, so this repair is neither on current main nor shipped. (ui/src/pages/chat/chat-thread-build.ts:143, cbbe91d8f75a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • JosephNatsu: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 711a4c8 into main Sep 4, 2026
147 checks passed
@steipete
steipete deleted the codex/watch-canvas-preview-final branch September 4, 2026 21:17
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
Keep canonical structured preview metadata when an assistant shortcode
matches a live or persisted tool result. Reuse the Canvas block parser and
enrich the owned display row without duplicating cards or mutating history.

Cover MCP App and dashboard metadata across live and both history orders.
The six regressions fail before the repair; 410 owner cases, 20 canonical
checks and an independent review pass. Source-bound Chromium reproduces
the wrong renderer before and the interactive App after, including reload.
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant