[Bug]: Preserve mobile host name and address after Edit host Save
- Dominant language
- TypeScript
- Stars
- 71.3k
- Forks
- 4.7k
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 520
Description
## Operating system
Android mobile client connecting to a Windows desktop over Tailscale.
## Orca version
Desktop: 1.4.200. Android app build: not yet available from the reporter.
## Summary
Editing an existing mobile host's name and address and pressing **Save** returns to the main screen without an error, but both fields revert to their previous values (`Host 1` and the original LAN address). This prevents switching an existing pairing from LAN to Tailscale.
## Steps to reproduce (reported on a real device)
1. Use an existing mobile pairing with a desktop LAN endpoint. The connection is failing and relay recovery is retrying.
2. Open the host menu → **Edit host**.
3. Change the name and replace the LAN address with the desktop's reachable Tailscale address, retaining port 6768.
4. Press **Save** in the top right (not Back). The screen automatically returns home; no error is displayed.
5. Observe the old name and LAN address again.
Expected: both edits persist and reconnect uses the new address.
Actual: both edits revert. The reporter explicitly confirmed pressing Save and automatic navigation back.
## Diagnostics
The desktop listener binds to `0.0.0.0:6768`. After correcting the tailnet access policy, a second tailnet node received `HTTP/1.1 101 Switching Protocols` from the desktop at its Tailscale address. The subsequent problem is the mobile profile reverting, not the previously blocked TCP path.
Mobile logs before editing included:
```
[liveness-timeout · relay] Relay health check failed — probe-timeout
[relay-dial-failed · relay] Relay: relay dial failed — Error: replacement session authentication timed out
[relay-dial-failed · relay] Relay: relay dial failed — Error: relay_outer_4404
```
Direct connection attempts continued targeting the old LAN address.
## Suspected stale-write path (source inspection, not yet reproduced with an automated test)
At commit `a0a654c3a9793970aeb77e6615a9650ba7b5d231`:
- `mobile/app/h/[hostId]/edit.tsx` awaits `updateHostNameAndEndpoint`, primes the fresh profiles, navigates back and requests reconnect.
- `mobile/src/transport/mobile-endpoint-supervisor.ts` retains a HostProfile snapshot and calls `persistRelayHost(this.host, resolved, ...)` after relay resolution.
- `mobile/src/transport/mobile-endpoint-supervisor-support.ts` spreads that snapshot and calls `saveHost(updated)`.
- `mobile/src/transport/host-store.ts` replaces the whole stored row when `saveHost` updates an existing host.
A delayed relay resolution may therefore overwrite newly saved name/endpoint values with the old snapshot. Please verify this against the affected Android build; the precise on-device cause is not yet established.
Suggested regression scenario: hold relay resolution pending, save a new name and endpoint, stop/reconnect the old client, then complete its pending resolution. Verify that the new fields remain and a retired supervisor cannot restore old metadata.
## Definition of Done (DoD)
- [ ] Saving a host name/address preserves both values on return to the main screen and after restarting the mobile app.
- [ ] Reconnect uses the saved endpoint, including while relay recovery is pending.
- [ ] A regression test covers late relay persistence overlapping a host edit and retired-client callbacks.
Related but distinct: #19406 concerns the initial unnamed host; this report concerns existing edits reverting after Save.
Contributor guide
Research direction
Start with mobile/app/h/[hostId]/edit.tsx, then inspect mobile/src/transport/mobile-endpoint-supervisor.ts, mobile-endpoint-supervisor-support.ts, and host-store.ts at commit a0a654c3a9793970aeb77e6615a9650ba7b5d231. Reproduce or test a pending relay resolution overlapping a host edit and a retired-client callback. Done means the saved name and endpoint survive restart and reconnect uses the new endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100