Skip to content

feat: connect UI development to a Gateway - #143052

Merged
shakkernerd merged 2 commits into
mainfrom
ui-dev-gateway-transport
Sep 9, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
ui-dev-gateway-transport

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

Keep Allow edits from maintainers enabled for this PR.

What Problem This Solves

Fixes an issue where developers could connect pnpm ui:dev to a real Gateway over WebSocket while its enabled capabilities, media, and native plugin UI remained unavailable.

Why This Change Was Made

Adds OPENCLAW_UI_DEV_GATEWAY_URL to route Gateway HTTP and WebSocket traffic through Vite. The browser retains the actual Gateway identity for credentials and settings, while an upstream-specific proxy path and scoped cookie paths prevent a stale page from forwarding credentials to a replacement target. Gateway authentication and browser Origin checks remain in place.

User Impact

OPENCLAW_UI_DEV_GATEWAY_URL=http://127.0.0.1:18789 pnpm ui:dev --host 127.0.0.1 --port 5173

Developers can use the selected Gateway's capabilities while retaining Vite's normal reload behavior and the Gateway's existing login and owner pairing flows. Selecting another upstream requires restarting the dev server. Unconfigured development and production builds retain their existing behavior.

Evidence

  • 148 focused owner tests passed, including HTTP/WebSocket proxying, Origin/auth forwarding, scoped cookies, stale proxy rejection, malformed grants, and root/mounted avatar and plugin paths.
  • UI typecheck, targeted lint, formatting, file-size and assertion checks passed remotely. Hosted CI passed on the final head, including all UI and real-Gateway E2E lanes.
  • Real source Gateways verified normal dashboard handoff and device pairing, capabilities, native plugin activation, protected iframe/media/avatar resources, Vite HMR, and paired reload at root and separate Gateway/UI mounts.
  • Reusing the same Vite URL for a replacement Gateway required separate pairing and sent no prior Gateway HTTP or WebSocket credentials. A saved foreign Gateway and a foreign handoff also produced no foreign credential requests or socket attempts.

Visual evidence

Before After
The Vite Control UI cannot activate the native plugin panel on the baseline The native plugin fixture activates through the configured Gateway transport

Native plugin stays connected through Vite HMR and reconnects after a paired reload

ui-dev-gateway-hmr-reload.webm

Visual verification

  • Baseline: 20e0ed5
  • Exact head: 82699a7c3fcb2462dcf4b4bb4b92e03aa0095a39
  • Scenario: Open the native plugin fixture through pnpm ui:dev, update an imported module through Vite HMR, then reload using the normally paired browser.
  • Runtime/build: OpenClaw 2026.9.3 source Gateway with qaRuntime and static assets rebuilt at 82699a7; Node 24.19.0; Chromium 144; pnpm 12.3.4
  • Gateway capabilities: terminalEnabled and cliAgentsEnabled: false on baseline; true with configured transport
  • Native plugin: Baseline panel unavailable; final plugin activated at root and mounted Gateway/UI paths
  • HMR and reload: Imported module 1 -> 2 retained the same document and Gateway client; paired reload reconnected
  • Protected HTTP resources: Native assets, plugin iframe, profile avatar, and media loaded; unauthenticated frame and plugin requests returned 401
  • Stored foreign target and handoff: Configured target selected; 0 foreign credential requests and 0 foreign socket attempts
  • Same UI URL, replacement Gateway: New Gateway required its own pairing; distinct credentials; 0 leaked HTTP/WS credentials across 38 second-Gateway frames; stale proxy prefix did not reach the replacement
  • Equivalent before/after fixture, route, viewport, light theme, scale, and scroll position; isolated loopback ports differ.
  • Final remote builds and proof were guarded by complete tracked-source fingerprints. The preserved baseline uses the pre-change source build.
  • Both screenshots and the complete recording were manually inspected; the focused clip retains real timing and factual HMR/reload cues.

@clawsweeper

clawsweeper Bot commented Sep 9, 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 app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Sep 9, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 8:47 AM ET / 12:47 UTC (Revision 2).

ClawSweeper review

What this changes

Adds an optional Vite development proxy that connects the Control UI’s WebSocket, capabilities, media, and plugin resources to a selected Gateway while preserving Gateway-scoped credentials.

Merge readiness

✅ Ready for maintainer review

The prior mounted-avatar finding is resolved, and no remaining blocking defect was found. Current main still lacks this development transport; the maintainer-authored PR remains useful for landing.

Priority: P2
Reviewed head: 82699a7c3fcb2462dcf4b4bb4b92e03aa0095a39

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful runtime evidence and regression coverage; the previous actionable finding is resolved.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The exact-head real-Gateway/Chromium observations cover the changed Vite transport, native plugin activation, mounted resources, pairing, unauthorized 401 responses, and replacement-target credential isolation. Inspected before/after screenshots corroborate activation; video playback could not be independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The exact-head real-Gateway/Chromium observations cover the changed Vite transport, native plugin activation, mounted resources, pairing, unauthorized 401 responses, and replacement-target credential isolation. Inspected before/after screenshots corroborate activation; video playback could not be independently inspected.
Evidence reviewed 9 items Verified review scope: The checkout is the pinned PR head. Reviewed the merge-base-to-head changes rather than attributing endpoint drift to the PR. The supplied test merge is stale and was not used to claim removal of current-main behavior.
Previous avatar finding resolved: User-avatar routes now receive the Gateway mount before proxy translation. Added cases cover typed profiles, explicit URLs, root and mounted Gateways, already-translated URLs, and foreign-origin rejection. This addresses the concrete finding retained from the previous review.
Transport identity and credential isolation: The proxy prefix contains the normalized upstream identity; only that prefix is forwarded. Cookie paths receive the same prefix. Browser connections to another configured target are rejected before credential adoption or client creation, and saved credentials retain their existing Gateway keys.
Findings None None.
Security None None.

How this fits together

Vite serves the developing Control UI, while the selected Gateway supplies authenticated connections and resources. The new transport translates browser requests without replacing the Gateway’s authentication or plugin authorization.

flowchart LR
  A[Developer selects Gateway] --> B[Vite development server]
  C[Control UI browser] --> D[Gateway identity and credentials]
  D --> B
  B --> E[Gateway authentication and route checks]
  E --> F[Capabilities and plugin resources]
  F --> C
  B --> G[UI hot reload]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +182, Tests +353, Docs +27. Total +562 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 15 227 45 +182
Tests 6 353 0 +353
Docs 1 27 0 +27
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 607 45 +562

Review metrics

Metric Value Why it matters
Development configuration 1 opt-in environment variable OPENCLAW_UI_DEV_GATEWAY_URL selects the upstream only for development serving; production builds and unconfigured development retain their existing paths.

Technical review

Best possible solution:

Keep one opt-in development transport that preserves upstream identity, existing authentication, mounted resource paths, and unchanged production behavior.

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

Not applicable as a new development mode; current-main source and the supplied baseline screenshot establish the existing cross-origin plugin limitation.

Is this the best way to solve the issue?

Yes. The opt-in transport reuses Gateway authentication and resource owners, and the avatar correction applies the canonical mount before translation without adding a competing plugin API.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This improves real-Gateway UI development with a bounded, explicitly enabled transport.
  • 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): The exact-head real-Gateway/Chromium observations cover the changed Vite transport, native plugin activation, mounted resources, pairing, unauthorized 401 responses, and replacement-target credential isolation. Inspected before/after screenshots corroborate activation; video playback could not be independently inspected.
  • proof: sufficient: Contributor real behavior proof is sufficient. The exact-head real-Gateway/Chromium observations cover the changed Vite transport, native plugin activation, mounted resources, pairing, unauthorized 401 responses, and replacement-target credential isolation. Inspected before/after screenshots corroborate activation; video playback could not be independently inspected.

Evidence

What I checked:

  • Verified review scope: The checkout is the pinned PR head. Reviewed the merge-base-to-head changes rather than attributing endpoint drift to the PR. The supplied test merge is stale and was not used to claim removal of current-main behavior. (82699a7c3fcb)
  • Previous avatar finding resolved: User-avatar routes now receive the Gateway mount before proxy translation. Added cases cover typed profiles, explicit URLs, root and mounted Gateways, already-translated URLs, and foreign-origin rejection. This addresses the concrete finding retained from the previous review. (ui/src/lib/identity-avatar.ts:35, 82699a7c3fcb)
  • Transport identity and credential isolation: The proxy prefix contains the normalized upstream identity; only that prefix is forwarded. Cookie paths receive the same prefix. Browser connections to another configured target are rejected before credential adoption or client creation, and saved credentials retain their existing Gateway keys. (ui/config/control-ui-dev-gateway.ts:33, 82699a7c3fcb)
  • Authorization remains at the Gateway: Plugin asset loading retains secure-context and scoped-grant checks. The Gateway validates cookie signatures, expiration, generation, route scope, and plugin read permission before serving assets; the proxy does not mint credentials or alter signed grant payloads. (src/gateway/control-ui-plugin-assets.ts:364, 82699a7c3fcb)
  • Current-main necessity and release check: The inspected fetched-main Vite configuration still serves synthetic bootstrap settings, and its native plugin runtime rejects a different browser origin. Neither fetched main nor the supplied latest-release commit contains the new development transport files. No merged replacement was established. (ui/vite.config.ts, 9bf06f7cc0f3)
  • Real browser results: The captured PR body identifies the exact reviewed head and real source Gateway/Chromium setup. It records native plugin activation, protected resource loading, unauthenticated 401 responses, retained HMR connection, paired reload, and zero prior-Gateway credential leakage across 38 replacement-Gateway frames. Both downloaded screenshots were inspected: the baseline panel is unavailable and the after image shows the activated fixture. These observations address the previous plugin-cookie/native-activation rank-up. (82699a7c3fcb)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vyctor H. Brzezowski: 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 (1 earlier review cycle)
  • reviewed 2026-09-09T11:01:47.861Z sha fb4f796 :: blocked before merge. :: [P2] Preserve the Gateway mount when translating user-avatar URLs

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 9, 2026
@shakkernerd shakkernerd self-assigned this Sep 9, 2026
@shakkernerd
shakkernerd merged commit 86ff55d into main Sep 9, 2026
136 checks passed
@shakkernerd
shakkernerd deleted the ui-dev-gateway-transport branch September 9, 2026 12:56
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Added: a configurable Gateway transport for the Vite Control UI with normal authentication and hot 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 docs Improvements or additions to documentation maintainer Maintainer-authored PR 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. size: L 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