Skip to content

fix(pair): pairing again opens a fresh connection instead of a stopped one - #59

Merged
viktorvillalobos merged 1 commit into
mainfrom
fix/re-pair-stale-connection
Oct 19, 2026
Merged

viktorvillalobos merged 1 commit into
mainfrom
fix/re-pair-stale-connection

Conversation

@viktorvillalobos

Copy link
Copy Markdown
Contributor

What was wrong

When a host refuses a device (it was revoked, or its pairing removed), that device's connection to the host stops trying for a day. Pairing with that host again reused the stopped connection, so the last step reported the old refusal straight away:

The secure channel did not open: the other computer does not accept this device (it was revoked, or the pairing was removed there)

But the host had just accepted the device and listed it as paired. Restarting Leon on the client was the only way out.

The change

  • RelayHub::ensure_paired (used by the pairing flow): keeps a connection that is online and starts any other one again. Live terminals on an online connection stay open.
  • RelayHub::ensure now also starts the connection again when the host key changed, not only when the relay URL changed.
  • The channel step's advice depends on why the connection stopped. It only says "it will connect when the other computer is reachable" when the connection is still trying. A refused device is told to check the other computer and pair again; a version mismatch is told to update Leon.

Tests

  • pairing_again_after_being_revoked_opens_the_channel: pair, revoke on the host, wait until the client stops trying, then pair again. Without the fix it fails with the error above.
  • only_a_connection_that_keeps_trying_is_said_to_connect_by_itself: the advice for each failure kind.

Ran scripts/check.sh on Linux (Arch): format, CRLF, Cargo.lock, clippy, workspace tests and the key registry pass. The "tests as windows" step failed once on every_option_of_every_section_fits_its_row_at_every_width_and_size (settings layout, unrelated to this change). It passes alone on this branch 3 times out of 3, passes on main, and the whole step then passed on a re-run (2160 passed). The steps after it, run by hand, pass: path spellings, clippy without the POSIX tests, and generated docs.

…d one

A connection the host refused stops trying for a day. Pairing again with
that host reused it, so the channel step reported the old refusal at once
("the other computer does not accept this device") although the host had
just accepted this device. A pairing now starts the connection again
unless it is online, and the hub also restarts a connection whose host
key changed.

The channel step's advice no longer says the machine will connect by
itself when the connection has stopped: a refused device is told to check
the other computer and pair again, a version mismatch to update Leon.
@viktorvillalobos
viktorvillalobos merged commit 95f3444 into main Oct 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant