Repository navigation
Conversation
…ing hosts Every app foreground and network change reset the attempt counter of a reconnecting host, so a host that is offline on purpose got a fresh burst of 0.5 s dials each time, plus a retry every 90 s forever. A nudge now pulls the next attempt forward without resetting the backoff; only an authenticated connection resets it. A host that has not connected this session and used up its attempt limit goes dormant: nudges are ignored, the slow retry becomes 5 minutes and does not fire while the app is outside the foreground. A new client (manual retry, re-pairing) still dials immediately. Refs stablyai#13354 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5e1be61f-ddf9-41ea-900e-1951dc123048
Files selected for processing: 5-
mobile/src/transport/direct-rpc-client.tsmobile/src/transport/rpc-client-nudge-backoff.test.tsmobile/src/transport/rpc-client-reconnect-schedule.tsmobile/src/transport/rpc-client.test.tsmobile/src/transport/socket-deadline-clock.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
…the retry limit The attempt that reached the limit still armed the 60 s backoff step, which re-armed itself every 60 s while the app was backgrounded and dialed again as soon as it returned to the foreground. Move a never-connected host to its slow retry on that failure; hosts that connected before keep the existing 90 s timing. Refs stablyai#13354 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Addressed in 01f8c05: a never-connected host now moves to its slow retry on the failure that uses up the limit, so the 60 s step no longer re-arms in the background. Hosts that connected before keep the existing 90 s timing. Added a test that dials 13 times on the previous code and 12 on this one; |
Use the dormant retry approach from #36352 for cold Tailnet endpoints, while keeping a direct retry available when the user opens the host. Coalesce repeated native callbacks over the cadence observed on iOS. Co-authored-by: lucas persson <[email protected]>
…47217) * fix(mobile): preserve direct reconnect backoff across network hints * Preserve explicit retry from downloaded mobile pages * Preserve fast recovery after a separate network change * Retry once more when the network settles after a hint * Let unreachable Tailscale hosts go quiet after retry exhaustion Use the dormant retry approach from #36352 for cold Tailnet endpoints, while keeping a direct retry available when the user opens the host. Coalesce repeated native callbacks over the cadence observed on iOS. Co-authored-by: lucas persson <[email protected]> * Keep resume and manual recovery responsive under retry backoff * Give dormant hosts a bounded retry when the app returns --------- Co-authored-by: lucas persson <[email protected]>
ELI5
If a paired computer is switched off on purpose, the phone app kept redialing it every time you switched apps or changed network, starting again from the fastest retry speed. This makes the app remember how many times it already failed, so it stops hammering a host that is clearly off.
What Changed
RpcClientReconnectSchedule.redialOnNudge,direct-rpc-client.tsnotifyForeground).isAppOutsideForegroundinsocket-deadline-clock.ts).Before: every foreground or network change gave each reconnecting host a fresh burst of dials starting at 0.5 s, plus a retry every 90 s indefinitely. After: failing hosts keep escalating, and an expected-offline host settles into a rare retry.
Why
On a phone paired with a host that is normally offline (a laptop that is only sometimes on), Orca mobile over Tailscale intermittently stalls and only toggling Tailscale recovers it. That is probably a Tailscale iOS bug (tailscale/tailscale#17967; I opened a possible fix at tailscale/tailscale#22084), but several reporters there fixed it by removing or reviving an offline peer, so the client's dial behaviour toward an offline host is a plausible trigger. It is not confirmed that this is the trigger. Regardless, redialing an offline host from 0.5 s on every app switch is wasteful. I considered detecting the tunnel state and pausing all dials, but iOS gives the app no API for peer state, so this stays purely client-side and independent of multi-endpoint pairing (#15615).
Linked Issue
Refs #13354. It only covers the redial storm toward hosts that keep failing. #13354 also covers reconnect lag on resume for a host that is up and the upstream Tailscale tunnel failure (tailscale/tailscale#17967), which this PR does not claim to fix, so merging it should not close the issue.
Visual Proof
N/A: no visible UI or copy change; only the timing of reconnect attempts changes.
Testing
New
rpc-client-nudge-backoff.test.ts(fake timers): a nudge does not reset a failing host's attempts; a nudge after a successful connection does; the trickle slows after the threshold and pauses in the background; a new client dials immediately. One assertion inrpc-client.test.tsupdated to the new nudge behaviour.pnpm -C mobile teston the four affected transport test files: 48 passed.pnpm check:changed --maxWorkers=2passes (format, lint, typecheck, affected tests, ratchets).Full local run: lint, typecheck and build pass;
pnpm testhas 55 unrelated environment-specific failing files on my machine (details in the checklist), so CI is the authoritative full-suite run.Not tested on a physical device; platform coverage is the unit tests on macOS.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude: Claude Opus (via a sandboxed devcontainer) wrote the change and tests, and Claude Sonnet orchestrated, ran the checks on the host, and prepared this PR. I reviewed the diff before opening it.
Review
Agent skill upstream boundary
AI code review summary
Reviewed by Claude (Sonnet 5.5, the orchestrating agent) against the diff and
mobile/src/transport:recordSocketDeadlineAppState), so the background pause does not apply there and web keeps dialing on schedule. Desktop is untouched.orca servehosts all use the same direct client; older hosts behave exactly as before. Relay reconnect logic is not modified.Platform notes
Tested through unit tests on macOS only. Behaviour on a real iOS or Android device over Tailscale is unverified.
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred). Locally:pnpm lint,pnpm typecheckandpnpm buildpass, andpnpm check:changedpasses.pnpm testran 140,008 tests with 56 failures in 55 files, none inmobile/src/transport; the ones I inspected are environment-specific on my macOS machine (Playwright browsers not installed, macOS bash 3.2 withoutmapfile, a native SQLite open error, shell-prompt integration). The 49 transport tests for this change pass. Please let CI cover the full suite.🤖 Generated with Claude Code