Repository navigation
feat(peers): pairing client and Connections settings (multi-host PR 4b) - #318
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st match codes Extract AES-256-GCM, HKDF-SHA256 and X25519 helpers into a pure module that both the manual-bootstrap seal and its client open now use. Add the commit/reveal six-digit match code, the host commitment, and the grant envelope sealed to a requester's X25519 key, with shared fixture vectors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p grants Requests are bounded and rate limited, use a commit/reveal match code, and issue the desktop exchange grants only after Allow. The credential is persisted before the envelope is published and revoked when it cannot be delivered. Adds the client-side grant opener for PR 4b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds POST /pairing/requests, POST /pairing/requests/{id}/reveal,
GET (long-poll) and DELETE /pairing/requests/{id}. The poll secret is
header-only, a disconnected long-poll never counts as delivery, and
/health?detail=host reports pairingRequests from the wired service.
Desktop /server projections advertise pairing-requests-v1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The service builds the request service alongside QR pairing, seals the identity of the listener a request arrived on (LAN private CA or the Tailscale Serve pin, reused for 60 s), and exposes list, respond and the persisted "Accept connection requests" setting. Turning the setting off cancels open requests; stopping Remote revokes uncollected approvals. The requester-side opener now treats the endpoint as optional and keeps the SPKI binding mandatory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Store "Accept connection requests" in its own device-local file so an older build never rejects the Remote state after a downgrade; a damaged or unfamiliar file fails closed. Announce each new request once with a system notification that names the device but never the match code, and expose list, respond and toggle IPC to the renderer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the host approval sheet with the match code, the Accept connection requests toggle in Remote Access settings, and rendered tests for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uests' into feat/multi-host-pr4b-pairing-client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pairing and discovery need an unauthenticated JSON client that pins the first leaf SPKI it sees and refuses any other key before a request byte is written. WebPKI mode serves Tailscale names; unverified mode serves LAN requests and setup codes, which the match code or the setup code protect. Rate-limit refusals now keep the host's retryAfterSeconds hint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ewed Tailscale keys The registry can now send a connection request to a discovered desktop, show the shared match code, and wait for the person there to allow it. A setup code opens the host's sealed payload and runs the normal pinned exchange. Every pairing confirms the credential over the pinned transport and saves it before the host appears. A Tailscale host whose WebPKI-valid key changed is re-pinned only after /server answers with the same installation for our credential. LAN hosts stay strictly pinned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gnostics Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' into feat/multi-host-pr4b-pairing-client
…uests' into feat/multi-host-pr4b-pairing-client
… sheet A queued request that replaced a cancelled or expired one kept the focused Allow button, so Enter could approve a device whose code was never compared. Deny now takes focus on every change of request, and Allow stays off for its first second on screen. The requester also accepts every host name the host allows, counting characters as the host does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PeerDiscovery reads tailscale status once per scan, keeps only online macOS and Linux peers, and merges a Bonjour browse. Each candidate gets a bounded health probe (four at a time, three seconds each). Devices are deduplicated by installation, Tailscale is preferred, this installation is excluded, and addresses stay in the main process. Nothing persists and nothing runs after stop. A setup code for a discovered device is bound to its installation rather than the address it was found at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Discovery starts and stops with the sheet, ref-counted per document and closed when a document reloads. Connection requests, setup codes and pairing links each return a typed result; the match code goes only to the requesting document. Discovered devices are named by ID, so no address, credential or pin crosses to the renderer. A re-pair resumes supervision of the host. Rename and Reconnect complete the paired-device row actions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uests' into feat/multi-host-pr4b-pairing-client
Connection-request routes now get no protocol header, a capability_denied refusal reads as closed, and host and saved names are bounded by Unicode characters as the host counts them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' into feat/multi-host-pr4b-pairing-client
Map paired-host supervisor status to labels and actions, merge status broadcasts by generation, phrase pairing outcomes, and validate local names. Share the host query keys with the remote sidebar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retitle Remote Access as Connections with two segments. Control this device keeps the existing remote access settings; Control other devices lists paired computers with live status, Reconnect, an enable switch and rename, re-pair and forget actions. The Add device sheet pairs a discovered computer by request, setup code or pairing link and shows the match code while waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' into feat/multi-host-pr4b-pairing-client
There was a problem hiding this comment.
Important
Two reproduced issues need fixes before merging: pending TLS sockets survive cancellation, and LAN pairing loses the address fallback that made discovery succeed.
Reviewed changes — Reviewed the full host and client pairing diff, including the merged PR 4a changes, against feat/multi-host-pr3-peer-manager.
- Host pairing requests. Admission limits, commit/reveal match codes, sealed grants, durable approval and rollback, settings persistence, notification and approval sheet, and API contracts.
- Client and transport. Tailscale/Bonjour discovery, bootstrap TLS pinning, request/setup-code/link pairing, registry persistence and replacement, reconnect, and Tailscale re-pinning.
- Connections settings. Device management, pairing steps, IPC ownership, status-cache merging, navigation copy, and tests.
- Validation. 241 focused tests and both project/E2E type checks passed; four affected Playwright specs collected. Electron execution requires macOS and was not run on this Linux runner. Both findings were confirmed with real TCP/HTTPS reproductions.
gpt-6.1-sol | 𝕏
A deadline or cancellation destroyed only the HTTP request, which does not own the socket until the handshake and pin check finish. A peer that accepted TCP but never answered the ClientHello kept one connection per timed-out probe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Discovery falls back to the IPv4 address Bonjour reports when a host's .local name does not resolve, but pairing and later connections used the sealed .local endpoint again, so a controller without system mDNS could not finish pairing or reconnect. Pairing at a discovered address (a connection request or a setup code) now remembers it for that installation, and discovery reports it for paired hosts pinned to the key seen there. Connections resolve the .local name through the system first and use the address only when that fails. TLS still verifies the .local name, the private CA and the SPKI pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Important
One recovery issue remains: a Tailscale-first discovery result prevents the new LAN address fallback from restoring an existing LAN connection after restart.
Reviewed changes Re-reviewed the two commits since 98683d2f, using the full PR diff for context.
- Closed pending TLS sockets. Added ownership and cleanup during the bootstrap handshake, with real socket coverage for timeout and cancellation.
- Preserved LAN address fallback. Added an in-memory, installation-scoped IPv4 resolver for authenticated pairing and pooled connections, plus pin-checked discovery updates and restart coverage.
- Validated the delta. All 96 peer tests, 47 CI-policy tests, and application type checking passed; a separate real-HTTPS reproduction confirmed the discovery-order issue inline.
gpt-6.1-sol | 𝕏
Discovery skipped the Bonjour probe for any device Tailscale had already reached, so after a restart a LAN pairing on a controller without mDNS never relearned the address its .local name stands for. A paired device is now still probed over the LAN when its Bonjour answer arrives after its Tailscale one. The registry keeps the address only for the key it pinned, and Tailscale stays the device's listed pairing route. Unpaired devices found through Tailscale are not probed again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hermes Review BotConfidence: 5 Engine: SummaryIntroduces client-side desktop pairing, device discovery via Tailscale and Bonjour, and the Settings → Connections UI (multi-host PR 4b), incorporating the host-side connection requests service (PR 4a). A desktop controller discovers other Aiden desktops only while the Add device sheet is open, sends unauthenticated Confidence Score: 5/5Full end-to-end trace completed across cryptographic primitives (X25519, HKDF-SHA256, AES-256-GCM), TLS bootstrap transport pinning, discovery queue drain and settle mechanics, commit-reveal state machines, IPC channel registrations, query key cache invalidation, and rendered settings UI components. 📁 Important Files Changed
FindingsNo findings. Sequence DiagramsequenceDiagram
autonumber
participant Requester as Requester Desktop
participant Host as Host Desktop
participant HostUI as Host UI
Requester->>Host: POST /pairing/requests (publicKey, deviceName, deviceType)
Host-->>Requester: 201 Created (requestId, pollSecret, hostCommitment)
Requester->>Host: POST /pairing/requests/{id}/reveal (requesterNonce)
Host-->>Requester: 200 OK (hostNonce)
Host->>HostUI: Broadcast request (derive match code)
HostUI->>HostUI: Mount approval sheet (focus Deny, arm Allow after 1s)
Requester->>Requester: Verify commitment & display match code
Requester->>Host: GET /pairing/requests/{id} (long-poll with secret)
HostUI->>Host: User clicks Allow
Host->>Host: Persist device & seal grant with requester X25519 key
Host-->>Requester: 200 OK (state: approved, envelope)
Requester->>Requester: Open grant, verify server SPKI & persist host
[]
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Re-reviewed b0171435 against the prior review at 5670f501, with the full PR diff as context.
- Restored discovery-order-independent LAN recovery. Paired installations still receive a Bonjour probe when Tailscale discovery finishes first, allowing saved
.localconnections to relearn their IPv4 fallback without changing the preferred Tailscale pairing route or weakening pin verification. - Added end-to-end restart coverage. The new test exercises real discovery and HTTPS against a restarted registry without mDNS, verifies authenticated access is restored, and checks that discovery still lists one device with a Tailscale pairing target.
- Validated the delta. All 97 peer tests, application type checking, and ESLint on both changed TypeScript files passed.
gpt-6.1-sol | 𝕏
…t' into feat/multi-host-pr4a-pairing-requests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # android/app/src/test/resources/contract.json
…' into feat/multi-host-pr4b-pairing-client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # android/app/src/test/resources/contract.json
…uests' into feat/multi-host-pr4b-pairing-client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t' into feat/multi-host-pr4a-pairing-requests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' into feat/multi-host-pr4b-pairing-client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uests' into feat/multi-host-pr4b-pairing-client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t' into feat/multi-host-pr4a-pairing-requests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/plans/README.md
…' into feat/multi-host-pr4b-pairing-client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/plans/README.md # package.json
PR #313 claims contract revision 19 for the host feed, run streams, run control and message paging, and it reaches main before this branch. The desktop pairing-request additions (pairing-requests-v1, the /pairing/requests* routes and their fixture section and match-code vectors) therefore move to revision 20, as the API doc planned. - Bump AIDEN_REMOTE_CONTRACT_REVISION, the shared fixture and its host health descriptor to 20, and gate the fixture's pairingRequests section on revision 20. - Mark the pairing-request routes and schema as revision 20 in OpenAPI and the API doc. The host descriptor, feed, run streams and run control stay attributed to revision 19. - A revision-19 host already carries pairingRequests in its descriptor but serves no /pairing/requests* route, so the docs now tell requesters to also require contractRevision 20 or newer. - Move the iOS and Android fixture revision assertions to 20 together. Neither client caps the revision it accepts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uests' into feat/multi-host-pr4b-pairing-client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/plans/README.md
A host before contract revision 20 cannot serve /pairing/requests, so discovery no longer trusts its pairingRequests claim alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Re-reviewed the revision-20 and discovery changes through 88064a35, using the prior full review and intervening merge-only reviews as the baseline for unchanged functionality.
- Claimed revision 20 for pairing requests. Updated the host constant, canonical fixture, fixture validation, API/OpenAPI documentation, and iOS/Android assertions together; revision-19 fixtures remain valid without the new pairing-request section.
- Restricted discovery's Connect action. Required both
pairingRequests: trueand contract revision 20 or newer, retaining discovered older hosts and their setup-code fallback. The added test checks the exact revision-19 rejection alongside revision-20 acceptance. - Validated compatibility. Passed all 97 peer tests, 131 focused protocol/router/Connections rendering tests, 15 Android contract tests, application type checking, and scoped ESLint. Android passed on the single offline rerun after the initial invocation exceeded the 120-second tool limit; iOS XCTest could not run locally because
xcodebuildis unavailable on Linux. Exact-head hosted CI is still running and remains the merge gate.
gpt-6.1-sol | 𝕏

Delivery PR 4b of the desktop multi-host control plan: the client side of pairing, plus Settings → Connections.
Plan:
docs/plans/desktop-multi-host-pr4b-pairing-client.mdWhat changes
Main
main/services/peer-discovery.ts):tailscale status --json, then WebPKIGET /health?detail=hostprobes, 4 at a time with a 3 s timeout) and a Bonjour_aiden-agent._tcpbrowse.{id, name, platform?, route, pairingRequests, paired}. Main resolves addresses from the id.main/services/peer-bootstrap-transport.ts):createConnection, before any request byte is written.main/services/peer-pairing-client.ts):If-None-Matchlong poll, and a sealed grant opened against that SPKI.paired,denied,expired,cancelled,rate_limited,closed,unsupportedorfailed.POST /pairing/manual-bootstrap, then the existing setup-code decryption and the normal pinned exchange. Paste pairing link remains an advanced path.main/services/peer-lan-addresses.ts):.localname does not resolve, connections use the IPv4 address Bonjour reported for that installation. This is remembered from pairing at that address, or from discovery when the key seen there matches the paired host's pin..localname, the CA and the SPKI pin.identity_changed, main confirms the sameinstanceIdthrough/serverwith the stored credential over WebPKI, saves the new SPKI and retries once.pairWithRequest,pairWithSetupCode,replaceHostId(re-pair, keeps the local name),rename, andreconnect(hostId).main/handlers/peer-pairing.ts):remote:peerDiscoveryStart,remote:peerDiscoveryRefresh,remote:peerDiscoveryStop, broadcasting onremote:peer-discovery.remote:peerPairRequest,remote:peerPairSetupCode,remote:peerPairLink,remote:peerPairCancel, with progress onremote:peer-pairing-progress.remote:peersRename,remote:peersReconnect.PeerPairingResult. Attempt IDs are minted by the renderer.Renderer
remoteAccesssettings section keeps its id and is retitled Connections, with two segments:renderer/lib/hosts/host-query-keys.tsis identical to feat(sidebar): list paired hosts' workspaces and chats in the sidebar #316's, so the sidebar and settings share the["hosts","list"]and["hosts","statuses"]caches. Status broadcasts merge by generation.Buttonsfocus-visibleon the segments, switches and menuNo server or mobile contract changes. The host routes are #315's, so the protocol revision, OpenAPI, fixtures and the iOS and Android clients are untouched.
Tests
npm run test:peer-hosts:.localname on a controller without mDNS (peer-lan-addresses.test.tsand the pairing suite), including after a restart when Tailscale discovery reaches the host before its Bonjour answernpm run test:aiden-remotenow also runs:renderer/lib/peer-connections.test.ts: status presentation, generation-guarded merge, outcome copy, local-name limits and attempt IDsrenderer/components/settings/connections-settings.test.tsx: rendered sheet steps, host-row actions and the segment tablisttests/e2e/remote-access-lifecycle.spec.ts:tests/e2e/settings-model-picker.spec.tsuses the new section name.npm run type-check,npm run type-check:e2e, eslint on the touched files,npm run test:aiden-remote,npm run test:settings-design,npm run test:onboarding,npm run test:ci-policy, and both Playwright specs.🤖 Generated with Claude Code