Skip to content

feat: load CDN libraries and fonts in widgets - #147265

Merged
steipete merged 2 commits into
mainfrom
codex/visualizer-skill
Sep 13, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/visualizer-skill

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #147261

What Problem This Solves

Widgets fail to render charts or custom typography when their HTML loads external libraries, stylesheets, or fonts.

User Impact

Agents can use public CDN assets for interactive code explanations and dashboard widgets. The new bundled visualize skill covers inline visuals, native reports, stable-name dashboard updates, and live data access. Existing inline widgets must be recreated to receive the new document policy.

Why This Change Was Made

One shared allowlist now feeds the document, browser sandbox, direct HTTP, and Discord policies. Direct Canvas responses also preserve local renderer scripts already permitted by registered documents; ordinary HTML retains its stricter document policy. Native clients admit HTTPS assets only after receiving an enforcing Gateway document policy; Gateway certificate pins and legacy document restrictions remain intact. The public SDK budget increases by one for the shared policy constant.

CDN assets load without a dashboard grant. Their code can see widget content and use granted widget capabilities, while API connections and host actions remain separately controlled. No unsafe-eval, arbitrary resource origins, or parent-origin access is added. PNG exports may not retain externally loaded styles or fonts.

Evidence

  • Full build, core/extension typechecks, core lint, and documentation link audit passed.
  • 117 focused TypeScript tests and 19 Swift widget tests passed; the new policy tests fail under the original implementation.
  • Existing Control UI sandbox E2E and real CDN browser checks passed, including D3 interaction and Google Fonts rendering.
  • Android lint passed. Android unit tests could not run locally because the Android SDK is absent; native device rendering is not claimed.
  • Independent review found no actionable findings after repairing the direct-host A2UI compatibility issue identified in review. Live tool/Gateway/browser proof passed with a real isolated Gateway and actual CDN requests (no model turn): D3 7.9.0 and Google Fonts returned HTTP 200, inline and pinned interactions worked, stable-name updates kept one widget, and arbitrary API fetches and parent-document access were blocked. The live Gateway snapshot precedes the final rebase; the exercised widget-authoring and skill code is unchanged, and the direct HTTP correction is tested separately below.
Inspected synthetic live screenshots

Inline CDN chart

Pinned CDN chart

Stable-name dashboard update

Direct-host compatibility proof

The exact source Canvas HTTP handler and actual bundled A2UI renderer were exercised in Chromium. The same persisted pre-CDN document bytes and a newly created show_widget(kind: "a2ui") document were tested before and after the correction.

Document Before correction After correction HTML bytes changed
Persisted registered widget Renderer blocked by script-src-elem Rendered No
Newly created registered widget Renderer blocked by script-src-elem Rendered No
Ordinary HTML negative control Local renderer blocked Still blocked by document CSP No

After correction, both registered cases retained opaque origin (null), rejected storage access, and blocked API fetches; the test server received zero API requests. The two new regression cases fail before the correction and pass afterward. This was direct source-HTTP/browser proof; no native-device rendering claim is made.

A separate actual OpenAI GPT-5.5 model turn also read the bundled skill and authored a working inline CDN widget on its first turn: model proof.

Stored A2UI direct-host before/after

Before correction (renderer blocked):

Stored A2UI before correction

After correction (same document bytes):

Stored A2UI after correction

@clawsweeper

clawsweeper Bot commented Sep 13, 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 docs Improvements or additions to documentation channel: discord Channel integration: discord app: android App: android gateway Gateway runtime scripts Repository scripts size: M maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 18:21
@steipete

Copy link
Copy Markdown
Contributor Author

Additional live model proof passed on the first turn: OpenAI GPT-5.5 read the bundled visualize skill and called show_widget with pin: false through the real isolated Gateway. Its D3 chart and Google font loaded from actual CDNs, clicking updated the chart to 55/35/20 ms, and the dashboard remained empty. The Gateway, browser, and credential-bearing test process were cleaned up.

Actual model-generated widget and interaction

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 13, 2026, 3:35 PM ET / 19:35 UTC (Revision 2).

ClawSweeper review

What this changes

Allows widgets to load libraries and fonts from seven shared CDN origins across browser, native, and Discord hosts, and adds visualization guidance.

Merge readiness

⛔ Blocked before merge - 3 items remain

The prior registered-renderer defect is addressed, and no new blocking correctness finding was established. This remains useful, maintainer-sponsored work that is absent from fetched main and the latest release.

Priority: P2
Reviewed head: b3dc74bbbb1f352ff4ae2ac20a881c77122635e7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful browser proof and the prior compatibility defect repaired.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied real Gateway/CDN observations and direct source-HTTP Chromium results cover the wrapper and response-policy changes, including successful rendering and blocked API/storage/parent access. Screenshots supplement those observations; native rendering is unclaimed, and two unavailable images are a reviewer limitation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Supplied real Gateway/CDN observations and direct source-HTTP Chromium results cover the wrapper and response-policy changes, including successful rendering and blocked API/storage/parent access. Screenshots supplement those observations; native rendering is unclaimed, and two unavailable images are a reviewer limitation.
Evidence reviewed 10 items Prior renderer finding resolved: The direct HTTP response now retains same-origin renderer permission while document CSP continues to intersect with the response policy. Stored and newly wrapped registered documents have focused regression coverage.
Shared policy and separate connection grants: The shared allowlist feeds static resources; connection origins still depend on granted state. File previews retain their previous sandbox policy, and document-view responses retain live caller checks.
Current main still lacks the requested policy: Fetched main permits inline scripts and registered resource origins but does not include the new shared CDN defaults.
Findings None None.
Security None None.

How this fits together

The widget tool turns agent-authored markup into isolated interactive content in chat and dashboards. Document policies and host adapters control resource loading while separate grants govern API connections and host actions.

flowchart TD
  A[Agent markup] --> B[Widget document wrapper]
  C[Shared CDN allowlist] --> B
  C --> D[Host resource policies]
  B --> D
  D --> E[Browser native or Discord renderer]
  E --> F[CDN libraries and fonts]
  E --> G[Separately granted API and host actions]
Loading

Before merge

  • Resolve merge risk (P1) - CDN libraries execute with widget content and existing granted capabilities; version-pinned URLs still rely on upstream asset integrity.
  • Resolve merge risk (P1) - Native WebView rendering and Discord proxy behavior lack real platform coverage in the supplied proof.
  • Resolve merge risk (P1) - Two later images could not be inspected, and unavailable historical objects prevented a complete comparison with the earlier reviewed head.
Agent review details

Security

None.

PR surface

Source +39, Tests +106, Docs +222, Other +71. Total +438 across 24 files.

View PR surface stats
Area Files Added Removed Net
Source 7 54 15 +39
Tests 7 122 16 +106
Docs 6 229 7 +222
Config 0 0 0 0
Generated 0 0 0 0
Other 4 101 30 +71
Total 24 506 68 +438

Review metrics

Metric Value Why it matters
Public resource policy 7 CDN origins; 1 additive SDK constant; 0 new settings The default resource policy becomes shared across core and channel presenters through a documented public export.
Implementation and regression growth Production net +90 lines; tests net +125; tooling net +1 Production growth implements native policy admission and shared resource handling; tests cover policy separation and stored renderer compatibility.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #147261
Summary: This PR is the implementation candidate for the explicitly paired open request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Retain the documented CDN trust model (recommended)
    Accept the explicitly proposed third-party execution model while retaining separate connection grants, opaque origins, and version-pinning guidance.

Technical review

Best possible solution:

Keep one shared static-resource policy, preserve document-specific restrictions and existing grant owners, and retain the explicit guidance about third-party code and stored widgets.

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

Not applicable as a new capability request: current main intentionally lacks these CDN permissions, and the supplied browser observations exercise the proposed behavior.

Is this the best way to solve the issue?

Yes. Sharing the allowlist through the existing widget policy owners avoids competing implementations, and the revised direct-response policy preserves registered renderers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ac59d5e09eb4.

Labels

Label changes:

  • add P2: This is a bounded widget capability improvement with no established urgent production outage.
  • add merge-risk: 🚨 security-boundary: Merging permits externally supplied CDN code to execute inside widgets with their content and granted capabilities.
  • add proof: sufficient: Contributor real behavior proof is sufficient. Supplied real Gateway/CDN observations and direct source-HTTP Chromium results cover the wrapper and response-policy changes, including successful rendering and blocked API/storage/parent access. Screenshots supplement those observations; native rendering is unclaimed, and two unavailable images are a reviewer limitation.
  • 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 (live_output): Supplied real Gateway/CDN observations and direct source-HTTP Chromium results cover the wrapper and response-policy changes, including successful rendering and blocked API/storage/parent access. Screenshots supplement those observations; native rendering is unclaimed, and two unavailable images are a reviewer limitation.

Label justifications:

  • P2: This is a bounded widget capability improvement with no established urgent production outage.
  • merge-risk: 🚨 security-boundary: Merging permits externally supplied CDN code to execute inside widgets with their content and granted capabilities.
  • 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 (live_output): Supplied real Gateway/CDN observations and direct source-HTTP Chromium results cover the wrapper and response-policy changes, including successful rendering and blocked API/storage/parent access. Screenshots supplement those observations; native rendering is unclaimed, and two unavailable images are a reviewer limitation.
  • proof: sufficient: Contributor real behavior proof is sufficient. Supplied real Gateway/CDN observations and direct source-HTTP Chromium results cover the wrapper and response-policy changes, including successful rendering and blocked API/storage/parent access. Screenshots supplement those observations; native rendering is unclaimed, and two unavailable images are a reviewer limitation.

Evidence

What I checked:

  • Prior renderer finding resolved: The direct HTTP response now retains same-origin renderer permission while document CSP continues to intersect with the response policy. Stored and newly wrapped registered documents have focused regression coverage. (src/canvas/serve.runtime.ts:94, b3dc74bbbb1f)
  • Shared policy and separate connection grants: The shared allowlist feeds static resources; connection origins still depend on granted state. File previews retain their previous sandbox policy, and document-view responses retain live caller checks. (src/gateway/board-sandbox.ts:17, b3dc74bbbb1f)
  • Current main still lacks the requested policy: Fetched main permits inline scripts and registered resource origins but does not include the new shared CDN defaults. (src/gateway/board-sandbox.ts:29, ac59d5e09eb4)
  • Latest release check: The same policy in v2026.9.4 also lacks the CDN defaults; this is not an already-shipped implementation. (src/gateway/board-sandbox.ts:29, 3a9d69db306c)
  • Captured real browser observations: The supplied body records real Gateway/CDN requests returning HTTP 200, working chart interactions, stable-name updates, and blocked API and parent access. Its direct-host table records stored and new A2UI rendering after correction with unchanged HTML, opaque origin, rejected storage, and zero API requests. The live body matched the supplied snapshot; these observations support the changed wrapper and HTTP policy rather than generic startup. (b3dc74bbbb1f)
  • Media inspection and coverage limits: Inspected all four prepared images: inline chart, pinned chart, stable-name update, and the blank A2UI before state. The later A2UI after image and model-turn image were absent from the manifest; browser fallback returned Cache miss for both. The images establish visible results only; runtime conclusions rely on the separately supplied observations.

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Native WebView rendering with a pinned Gateway and CDN resources would materially strengthen platform confidence.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-13T18:39:05.370Z sha 1725974 :: blocked before merge. :: [P1] Preserve registered renderer sources in the direct-response CSP

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Fixed the direct-host registered-renderer regression in bef6215. The response policy now preserves the local scripts already approved by a document CSP; it does not override ordinary HTML restrictions. The PR body includes actual before/after A2UI rendering, unchanged document hashes, negative controls, and new failing-before/passing-after regressions.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Share public static-resource origins across document, sandbox, and channel policies while keeping API access and native Gateway pins separate. Add visualization guidance for inline code explanations and persistent dashboards.
Keep document-approved same-origin renderer scripts available in the intersecting HTTP CSP. Cover stored and newly wrapped registered documents without granting API connections.
@steipete
steipete force-pushed the codex/visualizer-skill branch from bef6215 to b3dc74b Compare September 13, 2026 19:20
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer disposition for the current-head review: the A2UI compatibility finding is fixed, and the re-review reports no actionable correctness or security findings. The requested CDN execution model is approved: library code can access its widget content and granted capabilities, with separate API grants and opaque-origin isolation retained.

Native WebView and Discord live-platform coverage remain explicit limitations; the current CI, including Apple and Android jobs, and the focused boundary tests passed. The two images unavailable to the reviewer were inspected locally before upload; the after-render and model-turn evidence is recorded above. Both feature patches are unchanged by the rebase, verified with git range-diff against the prior head.

All current checks are green, including the required openclaw/ci-gate in run 34777401788. Proceeding with the native landing workflow under the approved scope.

@steipete
steipete merged commit cd1ff2a into main Sep 13, 2026
203 of 204 checks passed
@steipete
steipete deleted the codex/visualizer-skill branch September 13, 2026 19:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

threely-lab pushed a commit to threely-lab/openclaw that referenced this pull request Sep 14, 2026
Ports the android-relevant upstream commits since the last sync:
- openclaw#147265 widget CDN library/font loading (ChatInlineWidgetView.kt)
- openclaw#147275 control Gateway desktops without paired nodes (GatewayProtocol.kt)
- openclaw#144387 settle remote wear chat outcomes / replace stale streamed text
  (WearProxyController.kt: empty canonical content is a replacement, not absence)
- openclaw#147441 rolling session recaps in Activity (GatewayProtocol.kt)

ChatInlineWidgetView.kt and WearProxyController.kt are byte-identical to
upstream; GatewayProtocol.kt gains the session-scoped computer/activity
method and event enum entries. No i18n changes. Dropped wear/ app and test
files (not compiled in the phone build).

Co-authored-by: openclaw <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
* feat: load CDN libraries and fonts in widgets

Share public static-resource origins across document, sandbox, and channel policies while keeping API access and native Gateway pins separate. Add visualization guidance for inline code explanations and persistent dashboards.

* fix: preserve local widget renderers in direct hosting

Keep document-approved same-origin renderer scripts available in the intersecting HTTP CSP. Cover stored and newly wrapped registered documents without granting API connections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android channel: discord Channel integration: discord docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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.

Allow visualizer widgets to load CDN libraries and fonts

1 participant