Skip to content

fix: dark-theme visualizations sit on an opaque box with no padding - #160940

Merged
steipete merged 1 commit into
mainfrom
steipete/agent-browser-visualization-padding-25cbb0
Sep 29, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/agent-browser-visualization-padding-25cbb0

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: inline visualizations in the Control UI dark theme sit on a flat dark box whose edges touch the content, so they look like cards with no padding. The same happens in every host that embeds widgets (chat, sidebar, dashboards). Light mode was unaffected.

It also stops agents from opening the Control UI in their own browser to "verify" a widget, which lands on a sign-in page and posts that screenshot into the chat.

User Impact

User impact: dark-theme widgets now render on the normal chat or dashboard background, matching light mode. Agents no longer produce stray sign-in-page screenshots after drawing a visualization.

Why This Change Was Made

Widget documents run inside a sandbox proxy page, nested between the Control UI and the widget. The proxy declared no color scheme, so it counted as light while both the Control UI and the widget were dark. Browsers paint an opaque backdrop behind a frame whose color scheme differs from its embedder, which produced the slab. The proxy already receives and forwards the host's widget theme messages; it now adopts their light/dark mode for its own page, so every layer matches and stays transparent.

The browser part came from the visualize skill, which told agents to inspect the rendered result with any available browser tool. Agent browsers run in a separate profile without the viewer's Control UI session, so for inline widgets that check can only reach sign-in. The guidance now says not to use it there and notes that script errors after rendering are already reported back to the session.

Scope and behavior notes
  • The proxy page URL is versioned by a hash of its contents, so updated installs load the new proxy without cache issues.
  • HTML file previews and MCP Apps share the proxy but do not receive widget theme messages, so they keep today's behavior. MCP Apps get their theme through the MCP host context instead; a dark MCP App may still show the backdrop and is not covered here.
  • Chromium does not pass the embedder's color scheme into an iframe's prefers-color-scheme, so a static color-scheme: light dark on the proxy would follow the OS setting rather than the Control UI theme. That is why the proxy follows the theme message.

Evidence

Dark theme, a synthetic widget rendered through the real widget document shell and sandbox proxy (mock Gateway):

Before After
Before: opaque slab behind the widget After: chat background shows around the widget

Light-theme captures are byte-identical before and after.

  • Per-frame getComputedStyle probes: before, Control UI dark → proxy normal → widget dark; after, all three dark (and all light in light mode). Forcing only the proxy to dark removed the slab; forcing only the widget to normal exposed a white proxy slab instead, which confirms both boundaries.
  • ui/src/e2e/chat-widget-sandbox.e2e.test.ts now asserts that the proxy page follows the widget into dark mode. It fails on the old proxy with expected 'normal' to be 'dark' and passes with the fix. Cost: the added assertion is a single poll that resolves immediately; the file ran 134 s wall locally, most of it the bundle build, with the test case at about 12 s.
  • src/gateway/mcp-app-sandbox-http.test.ts, src/gateway/board-sandbox.test.ts, src/agents/mcp-ui-resource.test.ts, src/gateway/server-methods/canvas.test.ts: 70 tests pass. tsgo:core, oxlint and oxfmt are clean.
  • The skill wording comes from a live Team session. The agent rendered the widget, opened the chat URL in its managed browser, hit OpenClaw ID sign-in, and reported that as a verification gap.

@clawsweeper

clawsweeper Bot commented Sep 29, 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.

@steipete
steipete marked this pull request as ready for review September 29, 2026 03:56
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 88ad128ea80b1272a5ae7ac374171da062b49ef2
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox-host.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui docker Docker and sandbox tooling agents Agent runtime and tooling size: XS labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 12:40 AM ET / 04:40 UTC (Revision 3).

ClawSweeper review

What this changes

This PR makes the isolated widget proxy follow Control UI theme messages, updates visualization guidance about agent-browser checks, and adds a dark-theme browser assertion.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main still leaves the sandbox proxy without the host’s dark color scheme; the branch addresses that visible defect with credible browser proof. I found no introduced correctness or security defect.

Priority: P2
Reviewed head: 88ad128ea80b1272a5ae7ac374171da062b49ef2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Direct visual proof and a focused owner-boundary change support a solid review rating.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after Chromium images show the dark slab disappearing for a synthetic widget rendered through the production widget shell and sandbox proxy with a mock Gateway; the added browser assertion checks the proxy frame itself. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after Chromium images show the dark slab disappearing for a synthetic widget rendered through the production widget shell and sandbox proxy with a mock Gateway; the added browser assertion checks the proxy frame itself. No stored-data contract changes.
Evidence reviewed 7 items Current-main gap: The fetched main proxy checks its parent and forwards messages but does not set its own color scheme. The later local main revision likewise has no proxy color-scheme update.
Introduced proxy behavior: After the existing parent-source and origin checks, the new branch accepts only light or dark widget-theme messages and changes the proxy document’s color scheme. It does not change the sandbox or CSP grants.
Existing theme contract: The Control UI already constructs and posts light/dark widget-theme messages to registered frames.
Findings None None.
Security None None.

How this fits together

The Control UI sends theme messages through a Gateway-served sandbox proxy to an isolated widget document. Those nested frames display widgets in chat and dashboards while separating widget HTML from the Control UI.

flowchart LR
  A[Control UI theme] --> B[Theme message]
  B --> C[Parent origin check]
  C --> D[Sandbox proxy color scheme]
  D --> E[Isolated widget document]
  E --> F[Chat and dashboard display]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +7, Tests +9, Docs +4. Total +20 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 0 +7
Tests 1 9 0 +9
Docs 1 8 4 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 24 4 +20

Review metrics

None.

Technical review

Best possible solution:

Inline and dashboard widgets should inherit the viewer’s light or dark theme through the isolated proxy while retaining its origin checks and sandbox constraints.

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

Yes. Current-main source leaves the middle proxy without a theme, and the inspected before/after Chromium captures plus the existing browser flow provide a high-confidence reproduction path; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Applying the already forwarded, origin-checked theme message to the proxy fixes the mismatch at the frame that causes it without changing widget permissions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Dark-theme widget presentation and misleading agent-browser verification affect users, but the observed impact is limited to this visual workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after Chromium images show the dark slab disappearing for a synthetic widget rendered through the production widget shell and sandbox proxy with a mock Gateway; the added browser assertion checks the proxy frame itself. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after Chromium images show the dark slab disappearing for a synthetic widget rendered through the production widget shell and sandbox proxy with a mock Gateway; the added browser assertion checks the proxy frame itself. No stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after Chromium images show the dark slab disappearing for a synthetic widget rendered through the production widget shell and sandbox proxy with a mock Gateway; the added browser assertion checks the proxy frame itself. No stored-data contract changes.

Evidence

What I checked:

  • Current-main gap: The fetched main proxy checks its parent and forwards messages but does not set its own color scheme. The later local main revision likewise has no proxy color-scheme update. (src/agents/sandbox-host.ts:294, ed82c2c25ba1)
  • Introduced proxy behavior: After the existing parent-source and origin checks, the new branch accepts only light or dark widget-theme messages and changes the proxy document’s color scheme. It does not change the sandbox or CSP grants. (src/agents/sandbox-host.ts:323, 88ad128ea80b)
  • Existing theme contract: The Control UI already constructs and posts light/dark widget-theme messages to registered frames. (ui/src/lib/widget-theme.ts:45, 88ad128ea80b)
  • Browser regression boundary: The added assertion reads the computed color scheme of the middle proxy frame after switching the Control UI to dark mode. (ui/src/e2e/chat-widget-sandbox.e2e.test.ts:445, 88ad128ea80b)
  • Inspected visual proof: The PR body links before/after captures of a synthetic widget rendered through the real widget shell and sandbox proxy with a mock Gateway. I inspected the downloaded images: the opaque dark rectangle around the widget is present before and absent after. The contributor also reports per-frame computed-style probes and a failing-before, passing-after browser assertion. (88ad128ea80b)
  • Agent guidance matches runtime: The skill now warns that an agent browser usually lacks the viewer’s Control UI session. The existing widget view reports bounded post-render script errors back to the session. (skills/visualize/SKILL.md:145, 88ad128ea80b)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Hannes Rudolph: 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-29T04:04:15.754Z sha aa0d7d85adc1ca43210e35279ef80ca6d74de8aa :: needs maintainer review before merge. :: none
  • reviewed 2026-09-29T04:22:48.867Z sha a41dc570950d9e757ebc824953c6b303cf619f3d :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/agent-browser-visualization-padding-25cbb0 branch from aa0d7d8 to a41dc57 Compare September 29, 2026 04:16
@steipete steipete self-assigned this Sep 29, 2026
@steipete
steipete enabled auto-merge (squash) September 29, 2026 04:23
@steipete
steipete disabled auto-merge September 29, 2026 04:30
In the dark theme every inline show_widget frame showed an opaque slab
behind the widget, so its content looked flush against a box with no
padding. The sandbox proxy page between the Control UI and the widget
document declared no color-scheme, so Chromium painted an opaque canvas
wherever the light proxy sat between dark documents. The proxy now
adopts the host theme mode from the widget theme messages it already
forwards.

The visualize skill also told agents to inspect rendered widgets with
their own browser tools, which reach a sign-in page instead of the
viewer's Control UI. It now says so and points at the existing
post-render script error reports.
@steipete
steipete force-pushed the steipete/agent-browser-visualization-padding-25cbb0 branch from a41dc57 to 88ad128 Compare September 29, 2026 04:34
@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 29, 2026
@steipete
steipete merged commit 06120a1 into main Sep 29, 2026
235 checks passed
@steipete
steipete deleted the steipete/agent-browser-visualization-padding-25cbb0 branch September 29, 2026 04:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
In the dark theme every inline show_widget frame showed an opaque slab
behind the widget, so its content looked flush against a box with no
padding. The sandbox proxy page between the Control UI and the widget
document declared no color-scheme, so Chromium painted an opaque canvas
wherever the light proxy sat between dark documents. The proxy now
adopts the host theme mode from the widget theme messages it already
forwards.

The visualize skill also told agents to inspect rendered widgets with
their own browser tools, which reach a sign-in page instead of the
viewer's Control UI. It now says so and points at the existing
post-render script error reports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docker Docker and sandbox tooling 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. security-sensitive-changed size: XS 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