Skip to content

feat(discovery): add bounded opt-in discovery across paired devices #367

Open

Description

@abruption

Problem

The default session-peer list discovers local sessions. list --device <fingerprint> queries one explicitly selected paired receiver; --all includes stale/local discovery records and does not mean all paired devices. There is no explicit aggregate discovery workflow for already paired receivers.

In a user-reported KR workflow, an agent inspected only the standalone CLI and initially missed an existing package-managed Relay environment and existing paired-device state. After selecting that environment, the agent discovered an allowed remote Codex target and submitted one request. The reported queued/receiverAccepted result did not establish consumption. This is a usability case, not a reproduced pairing or transport defect.

Proposal

Design an explicit opt-in paired-device discovery mode, provisionally list --paired (name and contract to be reviewed). Preserve default local listing and the existing meaning of --all. Do not silently turn ordinary discovery into network fan-out.

Acceptance criteria

  • Select one explicit, existing device-state context. Missing, ambiguous or unsafe state must be reported without initializing an identity, creating state, repairing permissions or scanning arbitrary private directories.
  • Take a bounded snapshot of eligible paired peers; exclude pending/revoked entries. A paired record alone grants no list permission: each receiver's current policy remains authoritative and exposes only permitted target aliases.
  • Define finite peer-count, concurrency, per-peer/total-time and output budgets. Specify whether local results are included; do not infer inclusion silently.
  • Preserve existing explicit route/admission controls. No automatic login, installation, re-pairing, endpoint rewrite, transport fallback after uncertainty, or native send/wake.
  • Retain provenance per result: peer identity, selected route and receiver target alias. Do not merge targets solely because native IDs or labels match across devices/homes. Labels and returned text remain untrusted data.
  • Preserve partial successes and separately classify unavailable/denied/timeout/unsupported/truncated peers. An incomplete discovery must not become an empty successful result or prove that sessions are absent.
  • Define aggregate text/JSON and exit behavior while preserving existing local/single-device output contracts. Discovery/readiness must not be described as submission, consumption or ACK.
  • Add offline tests for mixed peer states, policy refusal, duplicate labels/IDs across peers, unreachable peers, partial failures, budget/cancellation boundaries, missing Relay dependencies and unsafe/missing state. Keep native/real-network acceptance claims separate from fixtures.

Related scope

A companion skill issue will document how to locate an already installed Relay-capable runtime and perform existing single-device discovery now. That guidance must not wait for or advertise the proposed flag.

This issue records design/development work only. It does not authorize deployment, pairing/state changes, publication or broaden ordinary list/send permissions. No release date or milestone is promised here.

Companion documentation issue: abruption/session-peer-skill#44

Activity

  1. self-assigned this
    on Nov 2, 2026
  2. added
    enhancement
    priority:P2
    on Nov 2, 2026
  3. abruption commented on Nov 15, 2026

    @abruption
    OwnerAuthor

    Release-candidate validation checkpoint — 2026-11-15

    Deferred from the next feature-release scope; no Draft PR was created. #393 proceeds separately.

    An isolated implementation attempted existing-state SQL reads without Store initialization, bounded per-peer fixed-list workers, explicit route/admission controls, per-peer provenance and partial-result reporting. Actual loopback TLS and blocked HTTP Relay-admission worker termination/reaping passed. The dedicated suite has 16 passes and 1 failure; six existing regressions also pass. The parent independently reran and reproduced the same failure. No assertion was weakened, skipped or marked expected-failure.

    The failed invariant is concrete: after WAL/SHM preflight, close the last Store SQLite connection before the new readonly connection's first query. SQLite removes sidecars on last-owner close, then mode=ro recreates both device.sqlite-wal and device.sqlite-shm while the query succeeds (createdSidecars=[wal,shm], refused=false). A shared state.lock does not exclude that SQLite-close race. An idle WAL store with missing sidecars is also a usability gap for the current fail-closed prototype.

    immutable=1 is not a general remedy: an owned live-WAL counterexample shows a normally committed row to mode=ro but no row to immutable mode. Existing Store also opens its recovery probe before taking state.lock, so assuming all readers/writers are serialized by that lock is invalid. SQLite's WAL documentation describes readonly sidecar creation and last-connection cleanup.

    Both independent technical reviewers confirmed this specific gate and the decision to preserve the prototype/failing regression outside the release and outside the #393 branch. This is not a full safety approval of the prototype and not a defect newly demonstrated in the already published ordinary single-device command.

    Re-entry requires a reviewed existing-state/snapshot ownership protocol that preserves live-WAL data and the intended no-initialization/state-preservation contract, with idle/last-close/concurrency tests. Do not auto-start a service, initialize state, change permissions, re-pair or suppress the regression to obtain a green run. Receiver permissions, route selection/no uncertain resend, bounded output/process cleanup and no-consumption/ACK claims remain required. No production state, real peers, service settings or native sessions were used or changed.

    Tracking: MCP-NEXT-RELEASE-DRAFTS-20261115.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementpriority:P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions