Skip to content

feat: complete remote gateway support — iOS + Android (fixes #35)#45

Open
juliosuas wants to merge 1 commit intoIntent-Lab:mainfrom
juliosuas:fix/remote-gateway-complete
Open

feat: complete remote gateway support — iOS + Android (fixes #35)#45
juliosuas wants to merge 1 commit intoIntent-Lab:mainfrom
juliosuas:fix/remote-gateway-complete

Conversation

@juliosuas
Copy link
Copy Markdown

@juliosuas juliosuas commented Apr 6, 2026

Problem

VisionClaw hardcodes OpenClaw gateway as a .local mDNS hostname that only resolves on the same LAN. On mobile data or different Wi-Fi, all tool calls silently fail.

This supersedes PR #38 with a more complete implementation.

Solution

New: Remote URL setting

Both iOS and Android now have a Remote URL field in Settings (e.g. http://100.64.x.x:18789 for Tailscale). When set:

  1. checkConnection() tries Remote URL first, then falls back to local Host
  2. First reachable endpoint wins — URL is cached for the session
  3. Both OpenClawBridge (HTTP) and OpenClawEventClient (WebSocket) use the resolved URL
  4. On network error mid-session, cache auto-invalidates and next call re-resolves

Improvements over PR #38

PR #38 This PR
Platforms iOS only iOS + Android
URL resolution Every tool call Once, then cached
Health check 200-499 (masks errors) Two-step: /health + /v1/chat/completions
EventClient Still uses local Uses resolved URL
Error messages Generic Specific (auth, disabled, unreachable)
Scopes header Missing Included (operator.write)

Files Changed (10 files, both platforms)

  • OpenClawBridge.swift / .kt — cached URL resolution + proper health check
  • OpenClawEventClient.swift / .kt — uses resolved URL + ws/wss upgrade
  • SettingsManager.swift / .kt — new openClawRemoteURL property
  • SettingsView.swift / SettingsScreen.kt — Remote URL UI field
  • GeminiSessionViewModel.swift / .kt — wires resolved URL to EventClient

Demo Setup (Talent Land)

1. Install Tailscale on your Mac and phone
2. In VisionClaw Settings → Remote URL: http://100.x.x.x:18789
3. That's it — works on any network

Test plan

  • Home Wi-Fi, no remote URL → works via local (no change)
  • Mobile data, Tailscale URL set → connects via remote
  • Both unreachable → clear error message with URLs tried
  • Tool calls work on remote connection
  • EventClient notifications work on remote connection
  • Switch from Wi-Fi to mobile mid-session → auto-recovers on next tool call

…-Lab#35)

Enables VisionClaw to work outside the local network — critical for
Talent Land demos and any use case where phone is on mobile data.

## How it works

1. New "Remote URL" field in Settings (e.g. Tailscale IP or public URL)
2. On session start, checkConnection() tries Remote URL first, then
   falls back to local Host — first reachable wins
3. Resolved URL is cached for the session (no re-probing per tool call)
4. Both OpenClawBridge AND OpenClawEventClient use the resolved URL
5. If the remote fails mid-session, cache is invalidated and next call
   re-resolves

## Changes (both platforms)

### OpenClawBridge
- New resolveGatewayBaseURL with proper 2-step health check
  (/health + /v1/chat/completions) and specific error messages
- Cached resolved URL — no latency penalty per tool call
- Auto-invalidation on network errors (triggers re-resolve)
- x-openclaw-scopes: operator.write header added

### OpenClawEventClient
- New overrideBaseURL property — uses resolved gateway URL
- Proper ws:// → wss:// upgrade when host uses https://

### SettingsManager + SettingsView/SettingsScreen
- New openClawRemoteURL setting with UI field on both platforms
- Clear caption: "For use outside your home Wi-Fi"

### GeminiSessionViewModel
- Passes resolved gateway URL to EventClient on connect

## Demo setup (Talent Land)
1. Install Tailscale on Mac + phone
2. In Settings → Remote URL: http://100.x.x.x:18789
3. Works on any network — mobile data, venue Wi-Fi, anything

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant