Skip to content

fix: remote gateway fallback — try Tailscale/public URL before .local#38

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

fix: remote gateway fallback — try Tailscale/public URL before .local#38
juliosuas wants to merge 1 commit intoIntent-Lab:mainfrom
juliosuas:fix/remote-gateway-fallback

Conversation

@juliosuas
Copy link
Copy Markdown

Problem

When the phone is on mobile data (or any network other than home Wi-Fi), all OpenClaw tool calls silently fail. The gateway URL is constructed from a Bonjour .local mDNS hostname that only resolves on the same LAN — on mobile data it simply times out with no user-visible error.

This is issue #35.

Changes

OpenClawBridge.swift

Added resolveGatewayBaseURL() — pings /health on each candidate URL in priority order and returns the first reachable one:

  1. Remote URL (Tailscale / public) if configured
  2. Local network URL (current behavior, preserved as fallback)

Both checkConnection() and delegateTask() now call this instead of hardcoding the local host:port.

SettingsManager.swift

Added openClawRemoteURL property persisted to UserDefaults. Empty string = disabled (no regression for existing users).

SettingsView.swift

Added Remote URL (Tailscale / Public) text field under the existing Host field, with a caption explaining its purpose. Wired to loadCurrentValues() and save().

Behaviour

Scenario Before After
Home Wi-Fi, no remote URL ✅ Works ✅ Works (no change)
Mobile data, Tailscale URL set ❌ Silent fail ✅ Uses Tailscale
All gateways unreachable ❌ Silent fail ✅ Clear error message

Demo use case

For Talent Land demos — set the Tailscale IP in Remote URL once, the app works anywhere without being on the same Wi-Fi.

OpenClaw tool calls silently fail when the phone is on mobile data because
the gateway hostname resolves to a Bonjour .local mDNS address that only
works on the same LAN.

Changes:
- SettingsManager: add openClawRemoteURL (Optional<String>) persisted to
  UserDefaults; empty string means disabled (local-only mode preserved)
- OpenClawBridge: add resolveGatewayBaseURL() that pings /health on each
  candidate in order — remote URL first, local URL second — and returns
  the first reachable base URL. Both checkConnection() and delegateTask()
  use this instead of hardcoding the local host:port.
- SettingsView: add 'Remote URL (Tailscale / Public)' field with
  explanatory caption; wired to load/save in loadCurrentValues()/save()

Behaviour:
- On home Wi-Fi with no remote URL set → falls through to .local (no
  regression for existing users)
- On mobile data with Tailscale URL set → resolves to Tailscale IP
- All gateways unreachable → returns a descriptive error instead of
  a silent no-op

Closes Intent-Lab#35
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