ADR-0012: Intentional disconnect: Disconnect frame with hold semantics
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after Milestone 1 field testing on a Galaxy A55
- Tags:
protocol,reliability,ux
Context
Both the desktop app and the phone app offer a “Disconnect” button. In Milestone 1 it only closed the TCP connection. The other side’s reconnect loop treats a closed connection as a network failure and redials within a second, so the user saw the device reconnect immediately. The desktop side already parked its own redial timer for 60 s, but it still accepted the phone’s inbound connection, so the hold was invisible.
There is no protocol-level way to say “I am closing on purpose, do not come back”. Candidate designs:
- A
Disconnect{hold_seconds, reason}frame sent before closing; the receiver pauses auto-reconnect for the given time (0 = until a user acts). - Replace Disconnect with “Pause sync”: keep the session open, stop sending feature frames. No reconnect churn, but the connection stays up, the phone’s foreground service still shows “connected”, and every feature needs a paused state.
- Treat Disconnect as a soft unpair (remove trust until Connect). Destroys the pairing for a transient wish and would show a SAS prompt again.
Decision
Option 1. Both implementations send Disconnect{hold_seconds = 0, reason = "user"} and close when the user presses Disconnect. Receivers and senders hold:
the reconnect loop and discovery-triggered dials skip the peer until the hold
expires, the local user presses Connect (or pairs), or the peer dials in. A hold
is in-memory only; restarting the daemon or the phone service clears it. An
exiting daemon sends reason = "shutdown", which receivers treat as a hold that
discovery may lift. Disconnect is advertised with the disconnect
capability; against a peer without it the old behaviour (close, 60 s backoff)
applies.
On D-Bus the device gains a Held property so the UI can show “Disconnected —
press Connect to resume” instead of “Reconnecting…”.
Consequences
Positive
- Disconnect means disconnected until the user says otherwise, on both devices.
- Pairing and trust are untouched; reconnect is one click (or a phone reboot).
- Tiny protocol surface: one frame, one capability, two boolean fields of state.
Negative / risks
- An asymmetric hold is possible (one side restarted) and resolves itself on the next successful inbound connection; documented.
- A “disconnect for N minutes” UI is possible but not built;
hold_secondsis carried for it.
Alternatives considered
See options 2 and 3 above; both rejected for complexity or for destroying state the user did not ask to lose.