Repository navigation
Description
Problem Statement
A Human at home should be able to use the installed DeepSeekBot phone app to reach their own Host over the local network without a Connect account, Tailscale, certificate installation, an IP address or router configuration. Today the accepted route preference mentions LAN, but the available route validators and discovery do not provide that path. Moving between home Wi-Fi and mobile data also lacks proactive recovery to a preferred local route.
The feature must preserve the same Remote Host, Paired Device authority and conversations across routes. A local IP address is neither a Host identity nor proof that the network is trusted. The newly merged Connect encryption is reusable foundation, so this work must extend the existing trust and device-gateway owners rather than invent another pairing system or expose the whole DSH Host.
Parent: #1643. Related: #2387, #2547, #2517, #2581, #2098.
Solution
Provide an independent encrypted LAN entry for installed iOS and Android apps. LAN starts disabled. The first explicit enablement of phone connectivity on the computer enables LAN with a clear notice; the Human can disable LAN separately later. Add this choice to the existing first-run and Add Host pairing flow rather than introducing a second Host-management surface.
The phone scans a trusted code displayed by the computer, obtains the intended Host identity and requests enrollment. The Human approves that exact phone/device key on the computer once. The established trust survives ordinary restarts and route changes. No account, VPN, manual certificate installation, manual IP entry or router change is required for LAN; necessary system network permission prompts are acceptable.
Reuse the pinned-Host-key Noise channel from #2547. Prefer eligible, authenticated routes in the order LAN, Tailscale HTTPS, Connect. Fall back when necessary and return to LAN when it is available, while protecting ongoing operations. Rediscover changed LAN addresses even without Internet access. Maintain no home-Wi-Fi allowlist: device authorization and authenticated encryption remain the authority on every reachable local network.
Older pairings remain usable through their current supported routes. A pairing missing the required keys receives a one-time scan-and-approve upgrade before using encrypted LAN; already encrypted pairings do not enroll again just to add a route.
User Stories
- As a Human at home, I want to pair my phone over LAN without creating a Connect account, so that local access has no account prerequisite.
- As a Human at home, I want LAN access without installing Tailscale, so that I do not need a VPN for this local use case.
- As a Host owner, I want LAN access disabled until I explicitly enable phone connectivity, so that installation alone does not open a network entry.
- As a Host owner, I want enablement to explain that LAN access is being opened, so that I understand the change.
- As a Host owner, I want to disable LAN independently, so that I can close local access while retaining separately configured remote routes.
- As a new phone user, I want LAN pairing in the existing first-run chooser, so that I can connect without searching another settings surface.
- As an existing phone user, I want to add a LAN Host from the existing Host drawer flow, so that Host management remains consistent.
- As a phone user, I want to scan the computer's trusted pairing code, so that I reach the intended Host without entering its address.
- As a Host owner, I want to approve the exact new device key once on the computer, so that another device sharing the Wi-Fi is not automatically authorized.
- As a phone user, I want expired, reused, rejected and cancelled enrollment attempts to have clear outcomes, so that I know whether pairing happened and how to retry.
- As a phone user, I want no manual certificate or router setup, so that pairing is practical for a nontechnical person.
- As a phone user, I want chat content and device credentials protected on LAN, so that a local network participant cannot read them.
- As a phone user, I want a changed or incorrect Host key to be refused, so that another computer at a familiar IP cannot impersonate my Host.
- As a phone user, I want an already paired LAN connection to work without Internet access, so that a WAN outage does not prevent reading locally available Host state.
- As a phone user, I want local connection status distinguished from model/provider availability, so that an unavailable external model does not look like a failed LAN connection.
- As a phone user, I want the same Host and conversations after switching routes, so that I do not get duplicate Host entries or lose my place.
- As a phone user, I want eligible LAN routes preferred at home, so that local traffic can stay on the local path.
- As a phone user leaving home, I want automatic fallback to an already configured Tailscale or Connect route, so that I can continue working without editing addresses.
- As a phone user returning home, I want authenticated LAN availability detected and used again, so that I do not remain on a remote path unnecessarily.
- As a phone user, I want the active route and truthful connecting, reconnecting or unavailable state visible, so that I can understand what the app is doing.
- As a phone user, I want route optimization to preserve an ongoing upload or write on a healthy connection, so that returning home does not interrupt my work.
- As a phone user, I want interrupted live reads to resume from the Host's authoritative state, so that a brief reconnect does not leave stale or duplicated conversation state.
- As a phone user, I want the app to reconcile an uncertain send or approval before retrying it, so that a connection loss does not cause duplicate actions.
- As a phone user, I want an unresolved operation outcome shown honestly, so that the app does not claim success or failure it cannot establish.
- As a phone user, I want changed LAN addresses rediscovered without a usable remote route, so that DHCP changes do not require typing an IP or repeating authorization.
- As a traveling user, I want my authorized phone to connect on any reachable local network, so that I do not need to maintain a home-Wi-Fi list.
- As a phone user, I want ordinary app and Host restarts to retain valid pairing, so that reconnecting is routine.
- As a user with a legacy pairing, I want my existing route to keep working until an encrypted upgrade succeeds, so that an upgrade attempt cannot strand me.
- As a user with a legacy pairing, I want one explicit key enrollment when first using LAN, so that stronger authentication does not silently change trust.
- As a user with a completed encrypted pairing, I want LAN added without another approval, so that changing transport does not become a new identity.
- As a phone user upgrading a pairing, I want the same saved Host, conversation history and local presentation state retained, so that the upgrade does not feel like adding a different computer.
- As a Host owner, I want revocation to close existing connections and refuse later access on every route, so that a lost phone cannot evade removal by switching networks.
- As an iOS or Android user, I want clear permission-denied and network-isolation recovery guidance, so that blocked local access does not become an endless spinner.
- As an assistive-technology or large-text user, I want pairing, approval, route status and retry controls accessible in English and Chinese, so that I can complete the same flow.
- As an agent or operator, I want to enable, inspect, pair, approve, diagnose and revoke through the existing CLI owner, so that the behavior is testable without the Web UI or a model.
- As an operator, I want bounded, structured connection diagnostics without secrets or message content, so that I can distinguish discovery, identity, permission and transport failures safely.
Implementation Decisions
Existing authority and module boundaries
- Application-defined device access owner: reuse the current Device Pairing authority, durable device records, key approval, revocation and encrypted device gateway. An address or route is a way to reach a Host, not a new Host, Paired Device or conversation store. Preserve the existing Host Feed and business-operation owners.
- DSH/Cordis seams: a Plugin/Fiber owns the LAN adapter's lifecycle and cleanup; Host Service commands remain the management authority. Client and CLI are Consumers of those commands. Preserve the native API Gateway and Typert boundary; do not introduce another API interceptor or a LAN-specific business-method dispatcher.
- Restricted network exposure: keep the DSH operator surface loopback-bound. LAN must expose only the intended encrypted device entry, including the tightly bounded pre-admission handshake/enrollment exchange; it must not expose operator APIs, general proxying or the full Web Client. The first slice must qualify the concrete exposure mechanism against the existing same-listener decision. If a restricted adapter requires a separate listener, record the explicit ADR refinement and lifecycle before shipping it; do not hide the change inside a URL-validator patch.
- Trusted client delivery: this LAN entry is for installed native apps. Do not serve an unauthenticated HTTP page containing the encryption implementation and treat that as equivalent trust. Existing browser entry paths remain separate.
Pairing and encrypted transport
- Reuse the existing Noise protocol and pinned Host key. Extend route admission and protocol binding deliberately: current Connect-only classification must not be bypassed by disguising a LAN origin as Connect. Complete Host authentication before sending credentials or private content. Transport failures must never enable raw plaintext fallback.
- A trusted computer-displayed QR binds the intended Host key and a short-lived enrollment opportunity. The computer approves the exact phone key using the existing owner. Preserve expiration, single-use, rejection, cancellation and revocation semantics. Do not require a manual fingerprint transcription in the normal trusted-scan path.
- Already approved device keys and a valid Host pin are reusable across eligible routes. Legacy pairings without these facts require explicit enrollment. Keep working legacy access until the new channel succeeds; preserve the logical saved Host and local state. Any device-record replacement or key association must go through the canonical pairing owner and must not leave a hidden authorization that survives logical device revocation.
- Extend the saved Host's route/trust representation compatibly. Keep persistent route preference distinct from the last successful route. Never rewrite preference merely because a remote route happened to work first. Keep secrets in existing protected stores.
- Native transport policy is part of qualification. Existing HTTPS-only assumptions must be reconciled explicitly with a local carrier whose application payload is authenticated and encrypted. Do not broadly relax cleartext rules and assume Noise automatically fixes platform permission or browser-code-delivery requirements.
Discovery and connection lifecycle
- Discovery provides candidate routes only. Existing trusted connections may report routes, but offline LAN rediscovery must also survive an address change when all remote routes are unavailable. Choose and qualify an appropriate native discovery mechanism; no specific mDNS package or subnet scan is preselected by this spec. Avoid broadcasting secrets, message content or unnecessary user-identifying data.
- One Host connection owner coordinates route eligibility, bounded probes, backoff, recovery and handover. Screens consume its state rather than running independent retry loops. Prefer LAN, then Tailscale HTTPS, then Connect among routes that meet their respective trust contracts; retain supported Tailscale behavior.
- Check preferred routes on relevant network/foreground changes and through a bounded recovery policy. Use cancellation, backoff and anti-flapping behavior; define and test concrete budgets in implementation rather than promising the T3 reference timings as our SLA.
- Prepare and authenticate a new route before planned handover. Keep healthy in-flight mutations/uploads on their existing connection until a safe handover, and ensure old connection callbacks cannot dispose the replacement. Live subscriptions resume with authoritative state and existing generation/cursor semantics.
- On actual loss, a rejected request does not prove the Host did not execute it. Reconcile through the operation's existing owner where possible, and surface an unknown result where it cannot be established. No generic mutation replay queue or exactly-once claim is introduced.
- A Host key change is a trust change and requires the existing explicit recovery/enrollment rules. A changed IP alone never changes the pinned identity. Revocation remains enforced even during probing, handover and reconnection.
Product surfaces and operations
- Extend the existing pairing chooser, Host drawer and Devices management surface. Preserve account and Tailscale paths, including their ongoing work in Phone: the left drawer chooses the view and manages Hosts; first run pairs by account or Tailscale #2517 and Mobile: native Connect account list and multi-computer pairing #2581. The first explicit LAN enablement requires clear notice; keep a separate disable control. Existing users must not gain a newly listening LAN entry just by updating the app or plugin.
- Use short bilingual text and existing native design/accessibility conventions. Surface the active route and actionable refusal state without exposing protocol details as normal user setup.
- All new or changed Host management commands ship CLI parity in the same PR: inspect/enable/disable LAN, create and observe protected enrollment, approve the intended key, inspect route/recovery state, and revoke as applicable. Reuse delivered command coverage and coordinate with Tob CLI 12A: close paired-device CLI gaps end to end #2098 instead of duplicating its owner. CLI emits one JSON result, coded refusals and nonsecret diagnostics; offers, private keys and device credentials use protected inputs/outputs, never ordinary model-visible stdout.
- Lifecycle logs identify initiator, phase, duration and refusal category with bounded output. Do not log credentials, QR payloads, Noise keys or message contents. Keep telemetry and public evidence free of raw private addresses and identifying network details.
Delivery order: runnable vertical slices
- Independent encrypted LAN pairing and one real DM: a Host management control and matching CLI enable the restricted entry; a native phone scans and receives approval; the shared encrypted carrier reads the real Host Feed and sends a DM; revocation terminates access. Verify disconnected-from-Internet local state separately from a real-model DM. Start with one reserved Host/phone QA combination and obtain Human feedback before expanding. An unattached listener, backend-only crypto extension or disconnected UI is not this slice.
- The same conversation survives network and address changes: add bounded preferred-route discovery, fallback, safe return to LAN and offline address rediscovery through the same owners and visible route state. Demonstrate a real read/write path, safe handling of in-flight work and wrong-Host rejection, with matching CLI diagnostics and regression coverage.
- Existing users and complete platform qualification: finish the legacy upgrade path through native UI and CLI, prove cancellation/failure preservation and successful state retention, and qualify the complete accepted behavior on both iOS and Android. Preserve existing encrypted enrollment and supported remote routes. Do not claim a platform is qualified from another platform's screenshots or from protocol tests alone.
These are sequencing boundaries within one specification, not a request to open speculative sibling tickets or to ship horizontal foundations independently. Every slice includes its owning Host behavior, durable authority, adapter, Client interaction, agent path and focused tests. Cross-platform enablement can follow device availability, but completed product scope includes both installed mobile platforms.
Testing Decisions
Primary seam
Use the existing Host client against the real authenticated device gateway and pairing owner as the highest automated behavior seam. Drive enrollment, Host Feed reads, representative mutations, reconnect and revocation across controllable network carriers, and assert the externally visible results and canonical Host facts. This is the same end-to-end path accepted during design. Use narrower tests only for independently meaningful security/protocol invariants that this seam cannot isolate; do not create a parallel test-only pairing protocol.
Prior art and module coverage
- Extend the existing live Host-client journey and device-gateway/pairing contract tests for native client behavior against an isolated Host.
- Reuse the merged Connect Noise, encrypted-gateway, encrypted-carrier, encrypted-upload and pairing-verification test families for handshake identity, admission, tamper/replay rejection and resource boundaries.
- Extend existing route selection, Host session, pairing chooser and device CLI behavior coverage. Exercise actual service outcomes rather than asserting helper calls, internal map layouts or a copied sorting implementation.
- Native UI and network behavior require the repository's shared device QA workflow, isolated verified Host and existing feature journeys. Update the phone-pairing feature map and bilingual CLI/connection guides with the changed user path. Native configuration changes require compatible rebuilt apps.
Required observable acceptance
- With no account, Tailscale or Internet route, enable LAN explicitly, scan, approve the exact device key and read real Host state on the installed app. Verify DM delivery and reply separately with a reachable model. A missing external model is not a local-transport failure.
- Before approval, after expiry/reuse/rejection, and after revocation, the same device cannot obtain authorized Host state. Show the corresponding UI/CLI refusal and verify admitted streams actually close on revocation.
- Inspect the LAN wire during pairing and ordinary use: no device secret, private payload or operator credential is carried in cleartext. Wrong Host keys, wrong device keys, tampering, replay, malicious candidates and attempts to reach non-device surfaces must fail.
- Leave home Wi-Fi with a configured remote route, continue the same conversation there, and return to LAN without a duplicate Host or repeated enrollment. A failed or untrusted preferred route cannot leak credentials or displace a working safe route.
- Keep a write/upload in flight on a healthy remote route while LAN appears. The optimization must not abort or replay it. Separately drop the actual connection around a Host commit and prove state reconciliation or an explicit unknown outcome instead of duplicate send/approval.
- Change the Host's LAN address while Internet and remote routes are unavailable. Rediscover it, validate its existing key and resume without IP entry. Reassign the old address to a different Host and prove that identity is refused.
- Exercise backoff, repeated network flaps, app foreground/background transitions and ordinary Host restart. Bound outstanding probes, connection generations and resources; stale callbacks must not damage a replacement connection. Preserve valid trust across restart.
- For a legacy pairing, cancel and fail the upgrade at meaningful stages and prove the previous supported route remains usable. Complete the upgrade and retain the same logical Host and local state. Existing encrypted pairings add a route without another authorization.
- Disable LAN and prove its entry closes while independently configured remote routes and their authorization remain intact. Revoke the device during handover and prove neither route can keep serving it.
- On both iOS and Android, verify granted/denied network permissions, actual LAN reachability, reconnect UI, accessible controls, light/dark appearance and large text. Capture redacted evidence; never publish QR secrets or credentials. AP isolation and unavailable discovery must produce truthful actionable failure, not a spinner or plaintext fallback.
- Perform management and protocol verification through the CLI/direct client without a model or Web UI, and inspect the same canonical state in the UI. Record real-model, native-platform and Human-feedback results separately from automated protocol results.
Out of Scope
- A new VPN, hosted mesh, public relay service, encryption algorithm or parallel pairing/credential store.
- LAN delivery of an unauthenticated browser client, arbitrary WebView pages or a full DSH/operator surface.
- Replacing Tailscale's encryption or changing the existing supported Tailscale contract merely to add LAN.
- Automatic installation of certificates, router changes, public port forwarding or silent global firewall/cleartext-policy relaxation.
- A home-Wi-Fi allowlist, user-maintained IP list, exhaustive subnet scanning requirement, RTT-based route auction or general-purpose route-management product.
- Generic mutation replay, resumable-upload promises or exactly-once semantics beyond what existing business owners can actually establish.
- Computer/Browser media transport, WebRTC signaling integration and TURN changes. In particular, feat(connect): encrypt paired-device traffic with pinned Noise XK #2547 does not establish complete viewer support; that work remains in its own specifications, including Spec: Local Computer video — explicit control, durable pause, no image fallback #2555 and Local Computer Video T6: 经 Connect 加密信令与控制观看、接管 Windows #2563.
- Starting new Hosts, rebuilding mobile apps, changing live network settings, implementing code, deploying or releasing as part of publishing this spec.
Further Notes
- The Human accepted the product decisions through the 2026-10-22 design interview. This issue is self-contained: its requirements do not depend on reading the private conversation or unpublished local document edits.
- Verified upstream baseline:
914bfa57ed04807dc3f94a1ed6a4e678da898591. Connect encryption merged as #2547, commitebab8f9dcf78e0624c6e6f805742840e066736f1. At that baseline LAN validation/discovery, healthy-connection proactive handover and legacy key upgrade remain implementation gaps. This spec is not runtime evidence. - Existing architecture references: device-gateway ownership, hosted route design, and merged encrypted channel contract. Historical assumptions about account-only enrollment or Cloudflare-readable payloads are superseded by the merged encryption contract.
- Primary reference for route behavior: T3 remote access. Its route strategy informs this design; its exact timing, transport permissions and plaintext-LAN branches are not copied as our guarantees.
- Restricted LAN exposure, native discovery choice and OS transport policy are bounded technical qualification work in the first relevant vertical slice. Preserve the accepted safety and setup requirements, document the concrete choice and reconcile affected ADR/mobile guidance. If a genuine platform limitation blocks that contract, report the specific failed requirement rather than silently reducing scope.
- Before implementation, inspect current claims and adjacent UI/CLI work, use an isolated branch/worktree, and record the repository's required task claim. Keep ADRs, living architecture, verification journeys and bilingual release/CLI documentation aligned with delivered behavior. No new claim is made by this specification publication.
Activity
DoodleBears commentedon Oct 22, 2026
Agent work claim
codex/local/01a1639d-a211-7a30-a976-b6f6416ca9b1(not a DSH Session)codex/2599-lan-pairingDoodleBears commentedon Oct 22, 2026
Agent implementation progress
codex/local/01a1639d-a211-7a30-a976-b6f6416ca9b1013bf12ab51ad5d9e2fbf150ebf494f097f1625f.DoodleBears commentedon Oct 22, 2026
Agent work outcome
codex/local/01a1639d-a211-7a30-a976-b6f6416ca9b1bac5bf9d7bc461f4d5bea33aff020dc6236f331e. Source branch is clean and pushed.DoodleBears commentedon Oct 22, 2026
Merged; native acceptance remains open
codex/local/01a1639d-a211-7a30-a976-b6f6416ca9b19cd926c0b3e34a376c0d7f715712f77bb6ce9770on 2026-10-22 18:50:57 UTC.