Skip to content

fix(ios): refused Gateway connections name the address and stop suggesting Tailscale setup - #198945

Merged
obviyus merged 1 commit into
mainfrom
ios-direct-reachable
Nov 14, 2026
Merged

obviyus merged 1 commit into
mainfrom
ios-direct-reachable

Conversation

@obviyus

@obviyus obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: when the iPhone app dials a Gateway on a port where nothing listens (for example a Gateway behind Tailscale Serve, dialed on its own loopback port), it says the host refused or could not be reached, without the address on reconnect, and tells a user whose Tailscale works to install or open Tailscale.

User Impact

User impact: a refused connection says ": refused the connection: nothing accepts connections on that port", both when reconnecting a saved Gateway and when entering an address by hand. On a Tailscale address it says Tailscale is working and to connect to the Gateway's .ts.net name without a port, links the Tailscale Serve docs, and offers openclaw qr to copy. Timeouts and unreachable errors on reconnect now name the address too.

Why This Change Was Made

  • Reconnect path. The mapped transport problem had no route context. The endpoint guidance step now receives the dialed port and names the address.
  • Manual-entry path. The pre-connect TCP check returned only reachable or not, and Network reports a refusal as .waiting(ECONNREFUSED), which the check ignored until its 3-second timeout. It now returns reachable, refused or unreachable; a refusal ends the check at once and becomes a refused problem instead of "not reachable". The TLS probe maps cannotConnectToHost the same way.
  • One helper owns the refused message, docs link and command, so both paths say the same thing.
  • Setup-code route selection still picks only routes that connect.
  • The iOS docs state that a .ts.net name without a port uses 443 and what the refused error means.

Not changed: discovered Gateways still need advertised TLS or a saved pin before the app dials them, which already keeps a loopback-only Gateway's LAN advert from being dialed.

Evidence

  • Real setup: a Gateway behind Tailscale Serve; its tailnet address on port 18809 returns Connection refused while Serve's port 443 connects. The iPhone (App Store 2026.11.3) showed the generic refused message and connected after scanning openclaw qr.

  • iOS simulator, manual entry of 100.77.74.91 port 18809, before → after:

    Before: Gateway is not reachable, with Tailscale install advice
    After: 100.77.74.91:18809 refused the connection, with Tailscale Serve guidance

  • New tests, red on main and green here: the reconnect path (mapNodeGatewayConnectionError with a wss://100.77.74.91:18809 route: 4 failed checks on main) and the manual-entry path (a refused TCP probe yields a refused problem naming the address, with no TLS probe).

  • GatewayConnectionIssueTests, GatewayConnectionSecurityTests, GatewayConnectionControllerTests, GatewayIngressControllerTests: all pass. SwiftUIRenderSmokeTests "managed assistant media … playback route" (audio transcode) times out the same way on main.

No overlap with Pash/Sarah changes.

Merge danger: two-way door; no state, config or protocol change. Blast radius: iOS connection problem text and help links for refused, timed-out and unreachable Gateways, and how fast the pre-connect check gives up on a refused port (immediately instead of after 3 s).

… users to setup

A Gateway behind Tailscale Serve listens on loopback only; dialing its tailnet address on the Gateway port is refused. The reconnect error named no address, and manual entry reported "not reachable" because the TCP check could not tell a refusal from a dead network. Both now name the address and point to the Serve name or a new setup code.
@clawsweeper

clawsweeper Bot commented Nov 14, 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: ios App: ios size: M labels Nov 14, 2026
@obviyus
obviyus marked this pull request as ready for review November 14, 2026 15:08
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR distinguishes refused connections from unreachable hosts and adds the dialed address and appropriate recovery guidance to iOS Gateway errors.

Example: Manually connect to 100.77.74.91 on port 18809 when the Gateway is available through Tailscale Serve instead.

  • Before: The app reports that the Gateway is unreachable and suggests setting up Tailscale.
  • After: The app identifies 100.77.74.91:18809 as refusing connections and suggests the Serve HTTPS name or a new setup code.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with direct simulator proof, distinct regression coverage, and no identified correctness or security defect.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected simulator screenshots exercise manual entry of 100.77.74.91:18809 through the app and show the production probe result reaching the corrected refusal banner; the contributor reports red/green regressions for reconnect mapping and manual preflight.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A refused Gateway port is presented as an unreachable network, sending users with working Tailscale toward irrelevant installation advice and omitting the reconnect address.
Reason: The reported refusal has direct visual evidence, and the maintainer-authored change provides specific recovery guidance through existing UI.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes misleading iOS connection recovery guidance that remains on main, and I found no actionable patch defect.

Priority: P2
Reviewed head: 29b50ee114222e4381fe4ed1441a49ddbe262136

Before merge

None.

Findings

None.

Provenance

  • Historical TCP helper: original intent not found (unknown: Path history reaches the helper deduplication commit 778959b; inspecting that historical change failed because a required promisor object was unavailable, so its earlier introduction remains unknown.)
Agent review details

How this fits together

The iOS connection controller probes candidate endpoints before TLS verification, while NodeAppModel maps reconnect errors; both feed typed problems into the existing connection banners and details sheet.

flowchart TD
  A[Manual Gateway entry] --> B[TCP and TLS probes]
  B --> D[Gateway connection problem]
  C[Saved Gateway reconnect] --> E[Transport error mapper]
  E --> D
  D --> F[Endpoint guidance]
  F --> G[Connection banner and details]
Loading

Technical review

Best possible solution:

Keep refusal classification in the existing probes and share endpoint-specific recovery text across preflight and reconnect paths, as this PR does.

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

The current-main probe and guidance paths explain the reported behavior, and the contributor supplies matching simulator before/after screenshots plus an affected App Store 2026.11.3 report; I did not execute a reproduction.

Is this the best way to solve the issue?

The change repairs the existing owners with a three-state probe result and shared refusal presentation, preserving route eligibility, TLS verification, and retry semantics without unnecessary machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 9426950 adds apps/ios/Sources/Model/NodeAppModel.swift:4900 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9426950e80d0; files: apps/ios/Sources/Model/NodeAppModel.swift)
  • Vincent Koc: Raw commit 51b1c86 adds apps/ios/Sources/Gateway/GatewayConnectionIssue.swift:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 51b1c861280a; files: apps/ios/Sources/Gateway/GatewayConnectionIssue.swift)
  • Josh Avant: Raw commit 0c7bac3 adds apps/ios/Sources/Gateway/GatewayConnectionController.swift:880 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0c7bac34ae68; files: apps/ios/Sources/Gateway/GatewayConnectionController.swift)
  • Peter Steinberger: Raw commit 778959b adds apps/ios/Sources/Gateway/TCPProbe.swift:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 778959b3dc27; files: apps/ios/Sources/Gateway/TCPProbe.swift)

PR surface

Source +94, Tests +83, Docs +6. Total +183 across 14 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 123 29 +94
Tests 5 120 37 +83
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 249 66 +183

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Misleading recovery advice makes a refused iOS Gateway connection harder to diagnose, with a limited connection-error blast radius.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Misleading recovery advice makes a refused iOS Gateway connection harder to diagnose, with a limited connection-error blast radius.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 14, 2026, 10:25 AM ET / 15:25 UTC.

@obviyus

obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer note: the one red job, macOS Periphery Dead Code [report] → "Intersect shared OpenClawKit dead code", flags struct OpenClawIDDiscoveryAccountError (added by #197630; this PR does not touch it). The same error fails the unrelated test-only PR #198793 (run 43606059019), and it failed again on a rerun here. The check is not required; all required checks are green and the review is ready on 29b50ee. Ayaan approved landing past it.

@obviyus
obviyus merged commit 72f7f8e into main Nov 14, 2026
152 of 154 checks passed
@obviyus
obviyus deleted the ios-direct-reachable branch November 14, 2026 15:38
@obviyus

obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 72f7f8e. A refused Gateway connection on iOS now names the address it dialed, on both reconnect and manual entry, and on a Tailscale address says Tailscale works and points to the Serve name or openclaw qr instead of Tailscale setup. Proof: regression tests for both paths (red on main, green here), four gateway suites green, and before/after simulator screenshots above; found on a real iPhone dialing a Serve-only Gateway on its loopback port.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
…sting Tailscale setup (openclaw#198945)

## What Problem This Solves

Fixes: when the iPhone app dials a Gateway on a port where nothing listens (for example a Gateway behind Tailscale Serve, dialed on its own loopback port), it says the host refused or could not be reached, without the address on reconnect, and tells a user whose Tailscale works to install or open Tailscale.

## User Impact

User impact: a refused connection says "<host>:<port> refused the connection: nothing accepts connections on that port", both when reconnecting a saved Gateway and when entering an address by hand. On a Tailscale address it says Tailscale is working and to connect to the Gateway's `.ts.net` name without a port, links the Tailscale Serve docs, and offers `openclaw qr` to copy. Timeouts and unreachable errors on reconnect now name the address too.

## Why This Change Was Made

- **Reconnect path.** The mapped transport problem had no route context. The endpoint guidance step now receives the dialed port and names the address.
- **Manual-entry path.** The pre-connect TCP check returned only reachable or not, and `Network` reports a refusal as `.waiting(ECONNREFUSED)`, which the check ignored until its 3-second timeout. It now returns `reachable`, `refused` or `unreachable`; a refusal ends the check at once and becomes a refused problem instead of "not reachable". The TLS probe maps `cannotConnectToHost` the same way.
- One helper owns the refused message, docs link and command, so both paths say the same thing.
- Setup-code route selection still picks only routes that connect.
- The iOS docs state that a `.ts.net` name without a port uses 443 and what the refused error means.

Not changed: discovered Gateways still need advertised TLS or a saved pin before the app dials them, which already keeps a loopback-only Gateway's LAN advert from being dialed.

## Evidence

- Real setup: a Gateway behind Tailscale Serve; its tailnet address on port 18809 returns `Connection refused` while Serve's port 443 connects. The iPhone (App Store 2026.11.3) showed the generic refused message and connected after scanning `openclaw qr`.
- iOS simulator, manual entry of `100.77.74.91` port `18809`, before → after:

  ![Before: Gateway is not reachable, with Tailscale install advice](https://github.com/user-attachments/assets/600711a3-adcf-4543-be61-09bb38616b80)
  ![After: 100.77.74.91:18809 refused the connection, with Tailscale Serve guidance](https://github.com/user-attachments/assets/217c9f81-ea9a-4d1e-826c-ff5d57a5efbc)

- New tests, red on `main` and green here: the reconnect path (`mapNodeGatewayConnectionError` with a `wss://100.77.74.91:18809` route: 4 failed checks on `main`) and the manual-entry path (a refused TCP probe yields a refused problem naming the address, with no TLS probe).
- `GatewayConnectionIssueTests`, `GatewayConnectionSecurityTests`, `GatewayConnectionControllerTests`, `GatewayIngressControllerTests`: all pass. `SwiftUIRenderSmokeTests` "managed assistant media … playback route" (audio transcode) times out the same way on `main`.

No overlap with Pash/Sarah changes.

**Merge danger:** two-way door; no state, config or protocol change. Blast radius: iOS connection problem text and help links for refused, timed-out and unreachable Gateways, and how fast the pre-connect check gives up on a refused port (immediately instead of after 3 s).

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios docs Improvements or additions to documentation 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. size: M 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