Skip to content

feat(app): take pairing requests only for 3 minutes after the owner turns pairing on - #547

Merged
linroid merged 8 commits into
mainfrom
feat/pairing-window
Oct 14, 2026
Merged

linroid merged 8 commits into
mainfrom
feat/pairing-window

Conversation

@linroid

@linroid linroid commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Follow-up to #545, which was merged before these two commits were pushed.

Why

Since #545, devices on the LAN can ask to pair whenever this device is shared, and the owner answers in Settings › Sharing. Being shared should not mean always taking pairing requests: pairing is now something the owner turns on, briefly, when they mean to pair.

What changed

Pairing is off until the owner turns it on

  • Settings › Sharing has a Pairing requests row with Turn on (PairingWindowGroup). Requests are taken for 3 minutes (PairingRequests.WINDOW), counted down there and in a banner on every other page ("Pairing is on for 2m 41s", with Show and Turn off).
  • The window ends early once a device is allowed in, so each window lets one device in at most. It also ends when the owner turns it off or sharing stops.
  • While pairing is off, the server answers 403 pairing_closed without asking the owner (KetchServer(pairingOpen = ...)), and these requests count against no address's backoff. RemotePairing returns PairingResult.Closed, and the asking device explains how to turn pairing on there.
  • mDNS still advertises pairing=1 whenever a device can pair. A device found while pairing is off gets the Closed message rather than being hidden.

Finding devices on the local network

  • The Add device sheet searches as it opens on phones too, as it already did on desktop. Android asks for its nearby devices permission first.
  • "Find on network" now reads "Find on local network", in the sheet and the device switcher, and the section heading reads "On your local network", so it is clear only the LAN is searched.

Server

  • The wrong-token lockout's Retry-After rounds the remaining wait up, as pairing's already does: a client that waited as told was refused again. Both now share retryAfterSeconds.

All new strings are translated into the ten languages. AGENTS.md and docs/architecture.md are updated.

Testing

  • :library:server:test: pairing route refused while closed (no strike), retryAfterSeconds rounding
  • :library:remote:jvmTest: pairingTurnedOff_isClosed
  • :app:shared:jvmTest: PairingRequestsTest (window opens for 3 minutes, Allow closes it, Don't allow keeps it), toast and notification tests
  • :app:desktop:test
  • Compiled :app:android, iOS tests and :cli
  • Snapshots: ConnectSnapshots.pairingWindow_offAndCountingDown and the pairing banner in PulseUiSnapshots
  • Not run on a device: the countdown banner, the Android permission prompt when the sheet opens, and pairing end to end between two devices

The wrong-token lockout truncated its remaining wait like pairing did, so
a client that waited as told was refused again. Both now share
retryAfterSeconds, which rounds up.
…urns pairing on

Devices could ask to pair whenever this device was shared. Pairing is now
off until the owner turns it on in Settings › Sharing, which takes
requests for 3 minutes, counted down there and in a banner on every other
page, and ends early once a device is let in, the owner turns it off or
sharing stops. Requests meanwhile get 403 pairing_closed, which the
asking device explains.

The Add device sheet now searches the local network as it opens on
phones too, and its button reads Find on local network, so it is clear
nothing is searched beyond the LAN.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T02:16:05.557881Z 2103638 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2103638c38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…lowed

Allowing a device closed the pairing window, but requests already waiting
could still be allowed after it, letting several devices in on one
window. Allowing one now turns the others away.
Turning sharing on now also starts it with Ketch, and Stop sharing stops
that too, so a device shared once stays reachable after a restart until
it is stopped. The Start sharing when Ketch opens switch moves out of
Advanced to the top of Settings › Sharing.
…evices control Ketch

Pairing requests and Share when Ketch opens (renamed from Start sharing
when Ketch opens) are now rows of the Pair a device card, shown while
sharing runs, instead of cards of their own.

Sharing texts said other devices control this Mac, when they only control
Ketch on it; they now say so in every language (German, whose device noun
is accusative, says they manage its downloads).
New code, and Rotate under Advanced, replaced the code at once, which
disconnects every paired device and voids the pairing link and QR code.
Both now ask first, with a Danger button; creating the first code still
does not. Pairing requests now show below the Pair a device card, under
the pairing controls they answer to.
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 1 910 files  ± 0   1 937 suites  ±0   23m 2s ⏱️ - 2m 11s
12 898 tests +16  12 651 ✅ +14  247 💤 +2  0 ❌ ±0 
15 453 runs  +16  15 206 ✅ +14  247 💤 +2  0 ❌ ±0 

Results for commit bf8ace5. ± Comparison against base commit 9121cf5.

@linroid
linroid enabled auto-merge (squash) October 14, 2026 02:48
@linroid
linroid disabled auto-merge October 14, 2026 02:48
# Conflicts:
#	app/shared/src/commonMain/kotlin/com/linroid/ketch/app/ui/feedback/BannerHost.kt
A request that brought the owner to Sharing shows first again, above the
Pair a device card.
@linroid
linroid merged commit a33d13b into main Oct 14, 2026
11 checks passed
@linroid
linroid deleted the feat/pairing-window branch October 14, 2026 02:57
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