Skip to content

fix(ui): actionable diagnostics for missing widget sandbox origin behind proxies#111909

Merged
steipete merged 3 commits into
mainfrom
fix/widget-sandbox-origin-diagnostics
Jul 20, 2026
Merged

fix(ui): actionable diagnostics for missing widget sandbox origin behind proxies#111909
steipete merged 3 commits into
mainfrom
fix/widget-sandbox-origin-diagnostics

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

On reverse-proxied or tunneled deployments (Control UI on a public origin, gateway on localhost), pinned dashboard widgets fail to render when mcp.apps.sandboxOrigin is not configured: the browser derives the sandbox URL by substituting the sandbox port onto the gateway origin, which such proxies typically do not route. The only surfaced error is "Widget authorization failed after repeated refresh attempts" — operators chase authorization config while the actual gap is a missing sandbox origin route. Hit in production on team.openclaw.ai behind a Cloudflare Tunnel after #111687 moved HTML widgets onto the shared sandbox host; all pinned widgets showed the misleading error until widgets.openclaw.ai was routed to the sandbox listener and mcp.apps.sandboxOrigin was set.

Why This Change Was Made

The browser cannot distinguish an unroutable derived sandbox origin from a genuine authorization failure, so the terminal error keeps the authorization fact but adds the deployment hint exactly when it is plausible (origin was derived by port substitution and its host is non-loopback). Server-side, gateway.auth.mode: "trusted-proxy" is a crisp signal the Control UI sits behind a proxy, so doctor now surfaces a conditional check for the same gap. Both diagnostics are phrased as conditional guidance, not diagnosed failures — a proxy can legitimately route the derived port. The fail-closed sandbox posture is untouched; no legacy same-origin iframe path is resurrected.

User Impact

Operators of proxied/tunneled gateways get an actionable pointer (mcp.apps.sandboxOrigin + route the sandbox listener, documented in docs/cli/mcp.md) instead of a dead-end authorization error, both in the widget card and in openclaw doctor. Local and explicitly configured deployments keep the existing message.

Evidence

  • New tests: ui/src/components/board/board-widget-frame.test.ts (derived remote origin → hint; explicit origin / loopback / unresolved → unchanged message) and noteSandboxOriginProxyWarning cases in src/commands/doctor-config-analysis.test.ts (warns for trusted-proxy without origin; silent with origin or other auth modes). All pass with node scripts/run-vitest.mjs.
  • Sibling suite board-view.test.ts passes; ui:i18n:verify clean.
  • Autoreview (codex gpt-5.6-sol, xhigh): first pass flagged both diagnostics as too categorical; reworded to conditional guidance; final pass clean ("patch is correct 0.91").

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui commands Command implementations size: S maintainer Maintainer-authored PR labels Jul 20, 2026
@steipete
steipete marked this pull request as ready for review July 20, 2026 16:39
@steipete
steipete merged commit bf6961d into main Jul 20, 2026
185 of 187 checks passed
@steipete
steipete deleted the fix/widget-sandbox-origin-diagnostics branch July 20, 2026 17:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 21, 2026
…ind proxies (openclaw#111909)

* fix(ui): actionable error and doctor warning for missing widget sandbox origin

* fix(ui): phrase sandbox-origin diagnostics as conditional guidance

* test(ui): satisfy deadcode and mock-factory gates for sandbox diagnostics
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 commands Command implementations maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants