Repository navigation
Mobile: recover from wedged Tailscale tunnels + Tailscale-aware connection diagnostics - #7980
Conversation
…e' when it's the likely culprit A wedged Tailscale tunnel (known iOS failure mode) produces no AppState or network-type transition, so no revival nudge ever fires and the reconnect loop parked permanently at its give-up cap — users had to toggle Tailscale off/on just to force a transition (#7824). - rpc-client: past the give-up cap, drop to a 90s trickle dial instead of parking so the session self-heals once the tunnel recovers. - host screen: nudge the shared client on focus so opening the host retries immediately instead of waiting out a backoff/trickle timer. - connection-health: warning/unreachable verdicts on 100.64/10 or *.ts.net endpoints now carry a 'check Tailscale' hint, shown on the home host list and the in-session status line after ~3 failed attempts. - troubleshoot: 'Cannot reach <tailnet-ip>' now says to check Tailscale, adds a dedicated Tailscale section, and stops telling Tailscale users to disable their VPN (that advice killed their only route to the host); sections extracted to troubleshoot-common-issues.tsx to stay under the max-lines cap. Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughThe mobile app now detects Tailscale endpoints when classifying connection health and displays contextual hints in host and session screens. Troubleshooting content moved into a shared module, while unreachable-host diagnostics provide Tailscale-specific guidance. RPC reconnects continue at a slower cadence after the retry cap, pending waiters fail fast, and foreground focus restarts reconnect handling. Tests cover endpoint classification, display labels, diagnostic details, and reconnect behavior. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mobile/src/diagnostics/host-reachability.ts (1)
62-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider sharing the "check Tailscale" hint text with
connection-health.ts.This hardcodes
"— check Tailscale"whileconnection-health.tsdefinesTAILSCALE_HINT = 'check Tailscale'for the same concept. Extracting a shared constant (e.g. alongsideisTailscaleEndpointinsrc/shared/remote-runtime-tailscale-hint.ts) would prevent the two messages drifting apart later.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c207f02e-c5da-41bc-887b-835a2c89dc4d
📒 Files selected for processing (11)
mobile/app/h/[hostId]/index.tsxmobile/app/h/[hostId]/session/[worktreeId].tsxmobile/app/index.tsxmobile/app/troubleshoot.tsxmobile/src/diagnostics/host-reachability.test.tsmobile/src/diagnostics/host-reachability.tsmobile/src/diagnostics/troubleshoot-common-issues.tsxmobile/src/transport/connection-health.test.tsmobile/src/transport/connection-health.tsmobile/src/transport/rpc-client.test.tsmobile/src/transport/rpc-client.ts
Clean auto-merge, no conflicts (109 files, +7490 from main). Brought in: - Codex WSL runtime status hooks (#7969); WSL/SSH agent path resolution past shell aliases (#7867); WSL source-control path separators (#7966); WSL GitLab-auth wake fix (#7967); WSL Codex usage RPC refresh (#7567/#7658) - Improve workspace cleanup list (#7053) + background removal - mobile: per-host connection log + Tailscale wedge recovery (#7984/#7980), wake slept agents on mobile worktree open (#7906) - Harden layout validation, watcher lifecycle, connection robustness (#7924) - Disable experimental worktree card style by default (#7977) Perf-branch structure preserved (clean auto-merge). typecheck 0 errors; lint 0 errors. CI is the release gate (local runs skipped per env lag). Co-authored-by: Orca <[email protected]>
…e' when it's the likely culprit (stablyai#7980) A wedged Tailscale tunnel (known iOS failure mode) produces no AppState or network-type transition, so no revival nudge ever fires and the reconnect loop parked permanently at its give-up cap — users had to toggle Tailscale off/on just to force a transition (stablyai#7824). - rpc-client: past the give-up cap, drop to a 90s trickle dial instead of parking so the session self-heals once the tunnel recovers. - host screen: nudge the shared client on focus so opening the host retries immediately instead of waiting out a backoff/trickle timer. - connection-health: warning/unreachable verdicts on 100.64/10 or *.ts.net endpoints now carry a 'check Tailscale' hint, shown on the home host list and the in-session status line after ~3 failed attempts. - troubleshoot: 'Cannot reach <tailnet-ip>' now says to check Tailscale, adds a dedicated Tailscale section, and stops telling Tailscale users to disable their VPN (that advice killed their only route to the host); sections extracted to troubleshoot-common-issues.tsx to stay under the max-lines cap. Co-authored-by: Orca <[email protected]>
Problem
Users on Tailscale report two flavors of the same failure (#7824 + Discord reports):
Cannot reach 100.x.x.x:6768.The root network fault is a known iOS Tailscale failure mode: the VPN tunnel silently stops passing traffic and only a manual toggle restarts it. But the app made it much worse:
Changes
Never park the reconnect loop (
rpc-client.ts): past the give-up cap, the loop now drops to a 90s trickle dial instead of stopping. One TCP attempt per 90s, foreground-only (JS timers are suspended in background), so battery cost is negligible. A session on a wedged-then-healed tunnel now recovers by itself within ≤90s, no toggle required. RPC callers past the cap still fail fast ("Connection retry limit reached").Nudge on host focus (
h/[hostId]/index.tsx): opening a host resets a backed-off/trickling loop and probes a possibly half-open socket immediately, instead of waiting out the timer. Empty deps so it fires per focus transition, not per connection-state flip (which would defeat backoff).Say "check Tailscale" when it's the likely culprit (
connection-health.ts):classifyConnectionnow accepts the host endpoint; warning/unreachable verdicts on100.64/10or*.ts.netendpoints carry acheck Tailscalehint, rendered on the home host list and the in-session status line ("Can't connect — check Tailscale — tap to retry") after ~3 failed attempts (~15s). ReusesisTailscaleEndpointfromsrc/shared(#6637).Tailscale-aware Troubleshooting (
troubleshoot.tsx): unreachable tailnet hosts readCannot reach 100.x.x.x:6768 — check Tailscale; new "Tailscale Host Unreachable" section documents the toggle workaround and desktop-awake check; the VPN section now scopes "disable it" advice to non-Tailscale VPNs. Static sections extracted totroubleshoot-common-issues.tsx(max-lines ratchet, no bump).Testing
connection-healthhint tests,unreachableHostDetailtests (incl. non-CGNAT100.xnegative case).runAllTimersAsyncuses replaced with bounded advances (an endless trickle timer would spin them forever).tsc --noEmit,oxlint,oxfmt, and the max-lines ratchet all clean.Fixes #7824
Made with Orca 🐋