Repository navigation
fix(ui): distinguish Mermaid renderer failures from invalid diagrams - #138465
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. |
Preserve transient renderer failures in Control UI status, report image failures separately, and document SameSite proxy requirements. Related: #138419. Reported by @thomastraum on X.
6f2587c to
9c84aab
Compare
|
Codex review: blocked before merge. Reviewed September 4, 2026, 2:44 PM ET / 18:44 UTC. ClawSweeper reviewWhat this changesThe PR gives Control UI users distinct recovery guidance for invalid Mermaid source, unavailable renderer assets, and browser image-display failures. Merge readiness⛔ Blocked before merge - 1 item remains Keep open for normal maintainer handling: this is a MEMBER-authored, Priority: P2 Review scores
Verification
How this fits togetherControl UI turns fenced Mermaid Markdown into a sandboxed renderer request and then either shows a passive SVG image or preserves readable source. Renderer and image outcomes feed back into the Markdown block so the user receives the appropriate recovery message. flowchart LR
A[Chat Markdown] --> B[Mermaid block]
B --> C[Sandboxed renderer]
C --> D{Render outcome}
D -->|SVG| E[Diagram image]
D -->|Diagram error| F[Source guidance]
D -->|Renderer failure| G[Proxy guidance]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +58, Docs +10. Total +66 across 6 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. Technical reviewBest possible solution: Keep the single closed render-status owner, preserve the renderer’s typed transient-error boundary, and land after ordinary maintainer review and the exact-head merge gate complete. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: aborting either isolated renderer script reaches MermaidTransientError, and the added browser test exercises that path before verifying successful reload recovery. Is this the best way to solve the issue? Yes. The renderer already distinguishes transient failures, so propagating that typed result into one closed presentation state is narrower and safer than adding retries or changing sandbox and CSP behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 26f87a37009b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…penclaw#138465) Preserve transient renderer failures in Control UI status, report image failures separately, and document SameSite proxy requirements. Related: openclaw#138419. Reported by @thomastraum on X.
Related: #138419. Reporter credit: @thomastraum on X; report and original diagram supplied by @steipete.
What Problem This Solves
Fixes an issue where Control UI users are told to correct valid Mermaid source when the renderer cannot load. This happens behind cookie-authenticated reverse proxies: the opaque rendering frame requests its scripts without SameSite=Lax/Strict cookies, so authentication can reject those assets even though the dashboard itself is logged in. Lazy component download failures and SVG image display failures also used the same misleading syntax message.
Why This Change Was Made
The component now preserves
MermaidTransientErrorand represents rendering, diagram errors, renderer failures, and image failures with one status value. This removes the separate pending/failed flags and duplicated completion cleanup. The lazy-module failure path uses the same renderer guidance. Invalid diagrams keep their existing text and all failures retain readable, copyable source.The Mermaid documentation describes the required proxy access to the two static renderer assets, including path-prefixed deployments. No automatic retry was added: repeating the same cookie-blocked requests would delay actionable guidance by another renderer timeout.
Credentialed parent fetching was evaluated. Inline srcdoc scripts must be authorized by both the inherited dashboard CSP and the native renderer CSP. The current asset manifest does not expose that authorization to either document. Implementing it correctly requires coordinated build, server-policy, native-host, and fetch-lifecycle changes beyond the agreed approximately net-neutral robustness scope. The sandbox, CSP, renderer, and SVG sanitizer remain unchanged.
User Impact
Renderer failures now suggest reloading and checking proxy/authentication rules for renderer asset URLs. Image-display failures suggest reloading without blaming source syntax. Cookie-gated deployments still need their static renderer assets reachable without SameSite cookies; the documentation limits any proxy exception to those assets and preserves dashboard/API authentication.
Evidence
Commands:
git diff --numstatclassification:No config/env options, SQLite/schema changes, protocol bumps, dependency overrides, or changelog edits.
Crabbox cookie-proxy reproduction
Baseline source
832ce3c68b761e90f8b9087a1b65629cbbdfffaf, Blacksmith Testbox leasetbx_01m1pr660npa59vgn6gs84vgnk, Actions run. Real CLI Gateway, isolated temporary state and free ports, persistedsessions.create/chat.injectmessage, token-authenticated dashboard handoff, Chromium 144.0.7559.0, and a synthetic SameSite=Lax cookie-gated Node reverse proxy. No provider call or operator state was used.The verbatim reported flowchart failed at both
/and/openclaw/. Both engine and frame requests hadcookie:false,sec-fetch-site:cross-site, and HTTP 401, followed by the old source/simplify message. Prefix requests correctly targeted/openclaw/assets/…. Exempting only the two static renderer scripts returned HTTP 200 with cookies still absent, and the diagram SVG decoded in both deployments. This reproduces the reported valid-source failure class and rules out path-prefix URL resolution for that class. The reporter's actual proxy/browser setup remains unconfirmed.Baseline successful command inside the lease (temporary proof harness):
The preserved baseline index SHA-256 was
c7ca073cb57083fb2b4e4014206f48fda8cc4ad92945dacdee0d2411eb231db7. Baseline proof setup first needed the repository's installed Chromium resolver and token/dashboard handoff fixture; those setup failures occurred before diagram rendering and are not presented as product failures.Candidate
6f2587c1f0ff7d6646fdef9e6dd39c977e781857passed the same real Gateway/Chromium flow on fresh Blacksmith Testbox leasetbx_01m1pstxze8p22119xq26gshzh(Actions run). The tracked tree was8b133ba4294dba1e7fa9f31694ff3c3d7b78044c; served index SHA-256f99997ee0ae6e5018b5a53e90ae6ff6803c5a6af51fc3c7997f779decf091189and componentmarkdown-mermaid-Bc4ORrDk.jsconfirm the new build.All four baseline and four candidate screenshots were inspected; they contain synthetic data only. Mandatory local and branch review through P2 found no accepted/actionable findings.
Initial CI found a pre-existing startup-budget overage: candidate 350,479 B versus unchanged limit 350,141 B; baseline proof 350,386 B. All other checks passed. Main subsequently acquired the Model Providers copy deferral in
f804e08cba8(#137342), so this branch was mechanically rebased to9c84aab615eeaab9ad2392fab3c60eebcfa389fdon main0062f2b127bbbdc9fd7db65c679066a11101b6c3. The same-toolchain comparison now passes at 349,103 B, with no budget/baseline edits. The 13 unit and two production-bundle browser regressions pass again, and fresh branch review through P2 is clean. Exact-head CI is green, and the fresh Crabbox proof passed for the rebased commit.Final-head proof: Blacksmith Testbox lease
tbx_01m1pv5mf3mqgnaf00g8wrns9n(Actions run), exact source9c84aab615eeaab9ad2392fab3c60eebcfa389fd, treef8a1122d4d5e5a0cae2d151cf036d5a0ef84f56e. Rebuilt index SHA-256cd7cb202b373372f273bb1340866b66eb65e8eef3f21abe7491cc7fb5ffca3e0, componentmarkdown-mermaid-7bXoHXde.js. Both root and/openclawagain recorded cookie-less cross-site HTTP 401 for both renderer scripts, displayed the new guidance, and recovered a decoded SVG after only those assets returned HTTP 200. The sameaftercommand shown above exited 0 in 276.504 seconds. Testbox startup size was 349,088 B against the unchanged 350,141 B limit. All final captures were inspected; every proof lease is confirmed stopped.ClawSweeper's final-head review found no correctness or security defect. Its requested data-model compatibility check is not applicable:
renderStatusatui/src/components/markdown-mermaid.ts:58is private in-memory Lit state replacing private booleans. Only render callbacks write it; no serialized record, database schema, migration, config, or protocol changes. The real Gateway proof reloads the original persisted chat message unchanged. Maintainer review confirms that no migration is needed.NO-FOLLOW-UP: the useful render-state owner simplification is integral to this repair; no separate rent-paying refactor was found in the touched paths.